Class AlgorithmBuilderService

java.lang.Object
es.urjc.etsii.grafo.autoconfig.builder.AlgorithmBuilderService

@Service public class AlgorithmBuilderService extends Object
  • Constructor Details

  • Method Details

    • buildAlgorithmComponentByName

      public Object buildAlgorithmComponentByName(String name, Map<String,Object> params)
      Build any algorithm component given its name and a map of parameters
      Parameters:
      name - component name, can be either an alias, a factory reference or a classname
      params - parameter map used to create this component, provides the necessary args to call the constructor
      Returns:
      built component
    • buildAlgorithmFromString

      public Algorithm<?,?> buildAlgorithmFromString(String s)
      Build any algorithm from the given string description. Must follow the format: Component{param1=value1, ...}. Any component can be a parameter too, example: Alg{constructive=GRASP{alpha=1}, ls=MyLS{}}
      Parameters:
      s - String description
      Returns:
      Built component
      Throws:
      AlgorithmParsingException - if the built component is not a valid algorithm
    • buildAlgorithmComponentFromString

      public Object buildAlgorithmComponentFromString(String s)
      Build any algorithm from the given string description. Must follow the format: Component{param1=value1, ...}. Any component can be a parameter too, example: Alg{constructive=GRASP{alpha=1}, ls=MyLS{}}
      Parameters:
      s - String description
      Returns:
      Built component
    • getParser

      public static AlgorithmParser getParser(String s)
      Get an instance of the algorithm parser, initialized as Parser --> TokenStream --> Lexer --> String
      Parameters:
      s - source string
      Returns:
      parser with BailOutStrategy, ie fails at the first error found.