com.epochx.representation.bool
Class XorFunction

java.lang.Object
  extended by com.epochx.representation.Node<TYPE>
      extended by com.epochx.representation.FunctionNode<java.lang.Boolean>
          extended by com.epochx.representation.bool.XorFunction
All Implemented Interfaces:
java.lang.Cloneable

public class XorFunction
extends FunctionNode<java.lang.Boolean>

A FunctionNode which performs exclusive disjunction, also known as exclusive OR.


Constructor Summary
XorFunction()
          Construct an XorFunction with no children.
XorFunction(Node<java.lang.Boolean> child1, Node<java.lang.Boolean> child2)
          Construct an XorFunction with two children.
 
Method Summary
 java.lang.Boolean evaluate()
          Evaluating an XorFunction involves evaluating both children.
 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

XorFunction

public XorFunction()
Construct an XorFunction with no children.


XorFunction

public XorFunction(Node<java.lang.Boolean> child1,
                   Node<java.lang.Boolean> child2)
Construct an XorFunction with two children. When evaluated, if either child evaluates to true (but not both) then the result will be true, otherwise the result will be false.

Parameters:
child1 - The first child node.
child2 - The second child node.
Method Detail

evaluate

public java.lang.Boolean evaluate()
Evaluating an XorFunction involves evaluating both children. If either child evaluates to true (but not both) then the result will be true, otherwise the result will be false.

Specified by:
evaluate in class Node<java.lang.Boolean>
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<java.lang.Boolean>
Returns:
the unique name for the XorFunction which is XOR.