public final class VariableNode extends Object
The result of evaluating this node will vary based on the Assignments
specified.
Constructor and Description |
---|
VariableNode(int id,
Type type)
Constructs a new
VariableNode with the specified ID. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Two VariableNode references are only "equal" if they refer to the same instance.
|
Object |
evaluate(Assignments assignments)
Returns the value assigned to this
VariableNode by the specified Assignments . |
int |
getHeight()
Returns the height of this
Node . |
int |
getId()
Returns the ID associated with the variable.
|
int |
getNodeCount()
Returns the total number of nodes represented by this
Node - including any child-nodes. |
NodeType |
getNodeType()
Returns the
NodeType of this Node . |
Type |
getType()
Returns the
Type of this Node . |
int |
hashCode() |
String |
toString() |
public VariableNode(int id, Type type)
VariableNode
with the specified ID.id
- represents the index to specify when getting the value for this variable from an Assignments
type
- the Type
that the values represented by this node are ofpublic int getId()
The ID indicates the index to specify when getting the value for this variable from an Assignments
.
public Object evaluate(Assignments assignments)
VariableNode
by the specified Assignments
.assignments
- represents the values to assign to any variables used in the evaluation of this Node
Assignments
at the index specified by the ID of this VariableNode
public Type getType()
Node
Type
of this Node
.
This indicates the type of the value returned when #evaluate(Assignments)
is called on this Node
.
public NodeType getNodeType()
Node
NodeType
of this Node
.
This can be used to determine if the node is a function, constant or variable node.
public boolean equals(Object o)
public final int getHeight()
Node
Node
.
The height of a node is the number of edges on the longest downward path between that node and a leaf.
public final int getNodeCount()
Node
Node
- including any child-nodes.getNodeCount
in interface Node
OakGP Genetic Programming Framework