Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.epochx.representation.bool
Class IfFunction

    java.lang.Object
      com.epochx.representation.Node<TYPE>
          com.epochx.representation.FunctionNode<java.lang.Boolean>
              com.epochx.representation.bool.IfFunction

All Implemented Interfaces:
  java.lang.Cloneable

    public class IfFunction

extends FunctionNode<java.lang.Boolean>

A `FunctionNode` which represents the conditional if-then-else statement.

Constructor Summary
`IfFunction()` Construct an IfFunction with no children.
`IfFunction(Node<java.lang.Boolean> condition, Node<java.lang.Boolean> ifStatement, Node<java.lang.Boolean> elseStatement)` Construct an IfFunction with three children.

Method Summary
`java.lang.Boolean` | `evaluate()` Evaluating an `IfFunction` involves evaluating the first child, if it evaluates to true then the second child is evaluated as the result.
`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

### IfFunction

    public IfFunction()

  Construct an IfFunction with no children.

### IfFunction

    public IfFunction(Node<java.lang.Boolean> condition,
                      Node<java.lang.Boolean> ifStatement,
                      Node<java.lang.Boolean> elseStatement)

  Construct an IfFunction with three children. When evaluated, if the first child evaluates to true then the second child is evaluated and return, otherwise the third child is evaluated and returned.

  Parameters:
    `condition` - The first child node.
    `ifStatement` - The second child node.
    `elseStatement` - The third child node.

Method Detail

### evaluate

    public java.lang.Boolean evaluate()

  Evaluating an `IfFunction` involves evaluating the first child, if it evaluates to true then the second child is evaluated as the result. Otherwise the third child is evaluated and returned.

  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 IfFunction which is IF.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD