Class AlgorithmBuilderService
java.lang.Object
es.urjc.etsii.grafo.autoconfig.builder.AlgorithmBuilderService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildAlgorithmComponentByName
(String name, Map<String, Object> params) Build any algorithm component given its name and a map of parametersBuild any algorithm from the given string description.Algorithm
<?, ?> Build any algorithm from the given string description.static AlgorithmParser
Get an instance of the algorithm parser, initialized as Parser --> TokenStream --> Lexer --> String
-
Constructor Details
-
AlgorithmBuilderService
-
-
Method Details
-
buildAlgorithmComponentByName
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 classnameparams
- parameter map used to create this component, provides the necessary args to call the constructor- Returns:
- built component
-
buildAlgorithmFromString
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
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
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.
-