Class AlgorithmInventoryService
java.lang.Object
es.urjc.etsii.grafo.autoconfig.inventory.AlgorithmInventoryService
Manage algorithm components at runtime. When starting the application, discovers all available components.
Can build any configured component easily from string,
as long as there is a matching constructor in the algorithm component.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<Class<?>, Collection<Class<?>>> protected Map<String, AlgorithmComponentFactory> protected String -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmInventoryService(IInventoryFilter filterStrategy, List<AlgorithmComponentFactory> factoryList, List<ParameterProvider> paramProviders) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckComponentName(Set<String> invalidNames, String name) getFactoryFor(Class<?> clazz) Get current algorithm inventory, ie the sum of all algorithm components, either autodetected or manually registeredvoidregisterAlias(String alias, String target) Create an alias for target with name alias.voidregisterFactory(AlgorithmComponentFactory factory) Provide a function that given a parameter map can create components with id 'name'protected voidvoidrunComponentDiscovery(String pkgs)
-
Field Details
-
componentsByType
-
componentByName
-
aliases
-
factories
-
pkgs
-
-
Constructor Details
-
AlgorithmInventoryService
public AlgorithmInventoryService(IInventoryFilter filterStrategy, List<AlgorithmComponentFactory> factoryList, List<ParameterProvider> paramProviders)
-
-
Method Details
-
registerAlias
Create an alias for target with name alias. Example registerAlias("ILS", "IteratedLocalSearch")- Parameters:
alias- New name, reference targettarget- target name
-
registerFactory
Provide a function that given a parameter map can create components with id 'name'- Parameters:
factory- function to execute such as f(params) --> returns component of type name
-
runComponentDiscovery
@PostConstruct protected void runComponentDiscovery() -
checkComponentName
-
runComponentDiscovery
-
getInventory
Get current algorithm inventory, ie the sum of all algorithm components, either autodetected or manually registered- Returns:
- unmodifiable algorithm inventory. Do not attempt to modify its data structures
-
getFactoryFor
-