Package org.uma.evolver.parameter
Class Parameter<T>
java.lang.Object
org.uma.evolver.parameter.Parameter<T>
- Type Parameters:
T- the type of the parameter value
- Direct Known Subclasses:
BooleanParameter,CategoricalIntegerParameter,CategoricalParameter,RangeParameter,StringParameter
Represents a configurable parameter with a value of type
T, supporting hierarchical
sub-parameters.
A Parameter can have:
- Global sub-parameters: Always relevant, regardless of this parameter's value.
- Specific sub-parameters: Only relevant when this parameter has a certain value or condition.
- Non-configurable sub-parameters: Internal or fixed configuration values.
Subclasses must implement the parse(String[]) method to define how the parameter
value is parsed from arguments. This class provides fluent methods for adding sub-parameters and
utilities for parsing and retrieving them.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConditionalParameter(Boolean dependsOn, Parameter<?> parameter) Adds a specific sub-parameter that depends on a boolean value.addConditionalParameter(String dependsOn, Parameter<?> parameter) Adds a specific sub-parameter that depends on a string value.addGlobalSubParameter(Parameter<?> parameter) Adds a global sub-parameter to this parameter.addNonConfigurableSubParameter(String parameterName, Object value) Adds a non-configurable sub-parameter to this parameter.Returns the list of specific sub-parameters associated with this parameter.Parameter<?> findConditionalParameter(String parameterName) Finds a specific sub-parameter given its name.findConditionalParameters(String parameterValue) Finds a list of the specific sub-parameters associated with a particular parameter value.Parameter<?> findGlobalSubParameter(String parameterName) Finds a global sub-parameter given its name.Returns the list of global sub-parameters associated with this parameter.name()Returns the name of this parameter.Returns a map of non-configurable sub-parameters associated with this parameter.abstract voidParses the value for this parameter from the given arguments.voidParses the value for this parameter using the provided function and arguments, and also parses all global and specific sub-parameters.toString()Returns a string representation of this parameter, including its value and sub-parameters.value()Returns the current value of this parameter.voidSets the value of this parameter.
-
Constructor Details
-
Parameter
Constructs a parameter with the given name.- Parameters:
name- the name of the parameter
-
-
Method Details
-
parse
Parses the value for this parameter from the given arguments. Subclasses must implement this method to define their parsing logic.- Parameters:
arguments- the arguments from which to parse the parameter value
-
parse
Parses the value for this parameter using the provided function and arguments, and also parses all global and specific sub-parameters.- Parameters:
parseFunction- the function to convert a string to the parameter value typeargs- the argument array
-
name
-
value
-
value
-
globalSubParameters
-
addGlobalSubParameter
-
conditionalParameters
Returns the list of specific sub-parameters associated with this parameter. Specific sub-parameters are only relevant when the parameter has a certain value or condition.- Returns:
- a list of specific sub-parameters
-
addConditionalParameter
-
addConditionalParameter
-
addNonConfigurableSubParameter
Adds a non-configurable sub-parameter to this parameter. These are typically used for internal or fixed configuration values.- Parameters:
parameterName- the name of the sub-parametervalue- the value of the sub-parameter
-
nonConfigurableSubParameters
-
findGlobalSubParameter
-
findConditionalParameter
-
findConditionalParameters
Finds a list of the specific sub-parameters associated with a particular parameter value.- Parameters:
parameterValue- the value that activates the specific sub-parameters- Returns:
- a list of specific sub-parameters for the given value
-
toString
-