Package org.moeaframework.core.variable
Class AbstractVariable
java.lang.Object
org.moeaframework.core.variable.AbstractVariable
- Direct Known Subclasses:
BinaryVariable,Grammar,Permutation,Program,RealVariable,Subset
Abstract class for implementing variables.
Variables can be assigned a name, but if unset will derive its name from its current index by calling
Variable.getNameOrDefault(Variable, int). Such variables are also called "anonymous".
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.moeaframework.core.Defined
Defined.ConstructorComparator -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new, anonymous variable.AbstractVariable(String name) Constructs a new variable with the given name. -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.moeaframework.core.Defined
getDefinition
-
Field Details
-
name
The variable name, ornullif anonymous.
-
-
Constructor Details
-
AbstractVariable
public AbstractVariable()Constructs a new, anonymous variable. -
AbstractVariable
Constructs a new variable with the given name.- Parameters:
name- the variable name, ornullto create an anonymous variable
-
-
Method Details
-
getName
Description copied from interface:NamedReturns the name of this object. The format for the name depends on the specific implementation, but in general we recommend:- Prefer using alphanumeric characters including
'_'and'-'. - Avoid whitespace and other control characters.
nullcan be returned, if allowed by the implementation, to indicate the object is anonymous or has no assigned name.
- Prefer using alphanumeric characters including
-
hashCode
public int hashCode() -
equals
-