com.epochx.representation
Class TerminalNode<TYPE>

java.lang.Object
  extended by com.epochx.representation.Node<TYPE>
      extended by com.epochx.representation.TerminalNode<TYPE>
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Variable

public class TerminalNode<TYPE>
extends Node<TYPE>

Defines a terminal node.


Constructor Summary
TerminalNode(TYPE value)
          Constructor for a new terminal node.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of this terminal node.
 boolean equals(java.lang.Object obj)
          Compares an object for equivalence to this terminal node.
 TYPE evaluate()
          Evaluation of a terminal node depends on if it is an action or not.
 TYPE getValue()
          Returns the value of the terminal node.
 int hashCode()
           
 void setValue(TYPE value)
          Replaces the value of the terminal node.
 java.lang.String toString()
          Returns a string representation of this TerminalNode.
 
Methods inherited from class com.epochx.representation.Node
getArity, getChild, getChildren, getDepth, getFunctionNodes, getLength, getNodesAtDepth, getNoDistinctFunctions, getNoDistinctTerminals, getNoFunctions, getNoTerminals, getNthNode, getTerminalNodes, setChild, setChildren, setNthNode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TerminalNode

public TerminalNode(TYPE value)
Constructor for a new terminal node.

Parameters:
value - the value of the terminal node.
Method Detail

getValue

public TYPE getValue()
Returns the value of the terminal node.

Returns:
the value of the terminal node.

setValue

public void setValue(TYPE value)
Replaces the value of the terminal node.

Parameters:
value - the new value to store.

evaluate

public TYPE evaluate()
Evaluation of a terminal node depends on if it is an action or not. If the value is an Action, then the action is first executed, then a DO_NOTHING Action value is returned, indicating that no further action is required from this node. Alternatively, for all other terminal nodes, the value is simply returned.

Specified by:
evaluate in class Node<TYPE>
Returns:
The result of evaluating the candidate program.

toString

public java.lang.String toString()
Returns a string representation of this TerminalNode.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this terminal node.

clone

public java.lang.Object clone()
Creates a copy of this terminal node. Values are shallow copied and so the cloned value will point to the same reference.

Overrides:
clone in class Node<TYPE>
Returns:
a copy of this TerminalNode.

equals

public boolean equals(java.lang.Object obj)
Compares an object for equivalence to this terminal node. Another terminal node is equal to this one if they share equal values.

Overrides:
equals in class Node<TYPE>
Parameters:
obj - an object to compare for equivalence.
Returns:
true if the objects are equal, false otherwise.

hashCode

public int hashCode()
Overrides:
hashCode in class Node<TYPE>