com.epochx.representation.action
Class Seq3Function

java.lang.Object
  extended by com.epochx.representation.Node<TYPE>
      extended by com.epochx.representation.FunctionNode<Action>
          extended by com.epochx.representation.action.Seq3Function
All Implemented Interfaces:
java.lang.Cloneable

public class Seq3Function
extends FunctionNode<Action>

A FunctionNode which provides the facility to sequence three instructions - which may be other functions or terminal nodes with actions.


Constructor Summary
Seq3Function()
          Construct a Seq3Function with no children.
Seq3Function(Node<Action> child1, Node<Action> child2, Node<Action> child3)
          Construct a Seq3Function with two children.
 
Method Summary
 Action evaluate()
          Evaluating a Seq3Function involves evaluating each of the children in sequence - the first child node, followed by the second child node, followed by the third child node.
 java.lang.String getFunctionName()
          Get the unique name that identifies this function.
 
Methods inherited from class com.epochx.representation.FunctionNode
equals, toString
 
Methods inherited from class com.epochx.representation.Node
clone, getArity, getChild, getChildren, getDepth, getFunctionNodes, getLength, getNodesAtDepth, getNoDistinctFunctions, getNoDistinctTerminals, getNoFunctions, getNoTerminals, getNthNode, getTerminalNodes, hashCode, setChild, setChildren, setNthNode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Seq3Function

public Seq3Function()
Construct a Seq3Function with no children.


Seq3Function

public Seq3Function(Node<Action> child1,
                    Node<Action> child2,
                    Node<Action> child3)
Construct a Seq3Function with two children. When evaluated, the three children will be evaluated in order. As such they will have been executed in sequence.

Parameters:
child1 - The first child node to be executed first in sequence.
child2 - The second child node to be executed second in sequence.
child3 - The third child node to be executed third in sequence.
Method Detail

evaluate

public Action evaluate()
Evaluating a Seq3Function involves evaluating each of the children in sequence - the first child node, followed by the second child node, followed by the third child node.

Each of the children will thus have been evaluated (triggering execution of actions at the TerminalNodes) and then this method which must return an Action, returns Action.DO_NOTHING which any functions higher up in the program tree will execute, but with no effect.

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

getFunctionName

public java.lang.String getFunctionName()
Get the unique name that identifies this function.

Specified by:
getFunctionName in class FunctionNode<Action>
Returns:
the unique name for the Seq3Function which is SEQ3.