Class TestingAlgorithmService
java.lang.Object
org.episteme.core.technical.algorithm.TestingAlgorithmService
- All Implemented Interfaces:
AlgorithmService
Restricted implementation of
AlgorithmService for testing.
Only allows a specific set of providers.- Since:
- 1.2
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
ConstructorsConstructorDescriptionTestingAlgorithmService(List<AlgorithmProvider> providers) TestingAlgorithmService(List<AlgorithmProvider> providers, boolean fallbackAllowed) TestingAlgorithmService(AlgorithmProvider... providers) -
Method Summary
Modifier and TypeMethodDescriptionblockFallbackFor(Class<? extends AlgorithmProvider> providerClass) Blocks fallback for a specific interface, forcing the use of allowedProviders only.<P extends AlgorithmProvider, R>
RexecuteWithFallback(Class<P> providerClass, Function<P, R> operation) Executes an operation with automatic fallback through the provider chain.<P extends AlgorithmProvider>
PgetProvider(Class<P> providerClass) Gets the best available provider for the given class.<P extends AlgorithmProvider>
List<P> getProviders(Class<P> providerClass) Gets all available providers for the given class, sorted by priority.booleanisFiltered(String name) Checks if a provider with the given name is filtered out by global configuration.voidrefresh()Refreshes the provider cache.voidshutdown()Shuts down the service and all managed providers.
-
Constructor Details
-
TestingAlgorithmService
-
TestingAlgorithmService
-
TestingAlgorithmService
-
-
Method Details
-
blockFallbackFor
Blocks fallback for a specific interface, forcing the use of allowedProviders only. -
getProvider
Description copied from interface:AlgorithmServiceGets the best available provider for the given class.- Specified by:
getProviderin interfaceAlgorithmService
-
getProviders
Description copied from interface:AlgorithmServiceGets all available providers for the given class, sorted by priority.- Specified by:
getProvidersin interfaceAlgorithmService
-
executeWithFallback
public <P extends AlgorithmProvider, R> R executeWithFallback(Class<P> providerClass, Function<P, R> operation) Description copied from interface:AlgorithmServiceExecutes an operation with automatic fallback through the provider chain.- Specified by:
executeWithFallbackin interfaceAlgorithmService
-
isFiltered
Description copied from interface:AlgorithmServiceChecks if a provider with the given name is filtered out by global configuration.- Specified by:
isFilteredin interfaceAlgorithmService- Parameters:
name- the provider name- Returns:
- true if filtered out
-
refresh
public void refresh()Description copied from interface:AlgorithmServiceRefreshes the provider cache.- Specified by:
refreshin interfaceAlgorithmService
-
shutdown
public void shutdown()Description copied from interface:AlgorithmServiceShuts down the service and all managed providers.- Specified by:
shutdownin interfaceAlgorithmService
-