Class AlgorithmInventoryService

java.lang.Object
es.urjc.etsii.grafo.autoconfig.inventory.AlgorithmInventoryService

@Service public class AlgorithmInventoryService extends Object
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.
  • Field Details

  • Constructor Details

  • Method Details

    • registerAlias

      public void registerAlias(String alias, String target)
      Create an alias for target with name alias. Example registerAlias("ILS", "IteratedLocalSearch")
      Parameters:
      alias - New name, reference target
      target - target name
    • registerFactory

      public void registerFactory(AlgorithmComponentFactory factory)
      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

      protected boolean checkComponentName(Set<String> invalidNames, String name)
    • runComponentDiscovery

      public void runComponentDiscovery(String pkgs)
    • 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

      public AlgorithmComponentFactory getFactoryFor(Class<?> clazz)