com.epochx.representation.dbl
Class SignumFunction

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.SignumFunction
All Implemented Interfaces:
java.lang.Cloneable

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

A FunctionNode which performs the mathematical sign function that extracts the sign of a number.


Constructor Summary
SignumFunction()
          Construct a SignumFunction with no children.
SignumFunction(Node<java.lang.Double> child)
          Construct a SignumFunction with one child.
 
Method Summary
 java.lang.Double evaluate()
          Evaluating a SignumFunction involves evaluating the child then the result will be zero if it resolves to zero, 1.0 if greater than zero and -1.0 if less than zero.
 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

SignumFunction

public SignumFunction()
Construct a SignumFunction with no children.


SignumFunction

public SignumFunction(Node<java.lang.Double> child)
Construct a SignumFunction with one child. When evaluated, the child will be evaluated with signum performed on the result.

Parameters:
child - The child which signum will be performed on.
Method Detail

evaluate

public java.lang.Double evaluate()
Evaluating a SignumFunction involves evaluating the child then the result will be zero if it resolves to zero, 1.0 if greater than zero and -1.0 if less than zero.

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 SignumFunction which is SGN.