com.epochx.representation.dbl
Class InvertFunction

java.lang.Object
  extended by com.epochx.representation.Node<TYPE>
      extended by com.epochx.representation.FunctionNode<java.lang.Double>
          extended by com.epochx.representation.dbl.InvertFunction
All Implemented Interfaces:
java.lang.Cloneable

public class InvertFunction
extends FunctionNode<java.lang.Double>

A FunctionNode which performs the multiplicative inverse (or reciprocal), that is the inverse of x is 1/x.


Constructor Summary
InvertFunction()
          Construct an InvertFunction with no children.
InvertFunction(Node<java.lang.Double> child)
          Construct an InvertFunction with one child.
 
Method Summary
 java.lang.Double evaluate()
          Evaluating an InvertFunction involves calculating the result of 1 divided by the result of evaluating the child.
 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

InvertFunction

public InvertFunction()
Construct an InvertFunction with no children.


InvertFunction

public InvertFunction(Node<java.lang.Double> child)
Construct an InvertFunction with one child. When evaluated, the child will be evaluated before the inversion operation is performed.

Parameters:
child - The child which the reciprocal will be found for.
Method Detail

evaluate

public java.lang.Double evaluate()
Evaluating an InvertFunction involves calculating the result of 1 divided by the result of evaluating the child. The exception to this is where the child evaluates to 0.0. In this case there is no finite reciprocal and the result will be 1.0.

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