|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.epochx.representation.Node<TYPE>
com.epochx.representation.FunctionNode<java.lang.Double>
com.epochx.representation.dbl.ProtectedDivisionFunction
public class ProtectedDivisionFunction
A FunctionNode which performs the arithmetic function of
division. The division is protected to avoid the scenario where division
by zero is attempted - which is undefined. Division by zero evaluates to
zero.
| Constructor Summary | |
|---|---|
ProtectedDivisionFunction()
Construct a ProtectedDivisionFunction with no children. |
|
ProtectedDivisionFunction(java.lang.Double protectionValue)
Construct a ProtectedDivisionFunction with a protection value to assign during divide-by-zero. |
|
ProtectedDivisionFunction(Node<java.lang.Double> dividend,
Node<java.lang.Double> divisor)
Construct a ProtectedDivisionFunction with 2 children. |
|
ProtectedDivisionFunction(Node<java.lang.Double> dividend,
Node<java.lang.Double> divisor,
java.lang.Double protectionValue)
Construct a ProtectedDivisionFunction with 2 children and a divide-by-zero protection value. |
|
| Method Summary | |
|---|---|
java.lang.Double |
evaluate()
Evaluating a ProtectedDivisionFunction involves dividing
the result of 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 |
|---|
public ProtectedDivisionFunction()
public ProtectedDivisionFunction(java.lang.Double protectionValue)
protectionValue - a double value to return in the case of
divide-by-zeros.
public ProtectedDivisionFunction(Node<java.lang.Double> dividend,
Node<java.lang.Double> divisor)
dividend - The first child node - the dividend.divisor - The second child node - the divisor.
public ProtectedDivisionFunction(Node<java.lang.Double> dividend,
Node<java.lang.Double> divisor,
java.lang.Double protectionValue)
dividend - The first child node - the dividend.divisor - The second child node - the divisor.protectionValue - a double value to return in the case of
divide-by-zeros.| Method Detail |
|---|
public java.lang.Double evaluate()
ProtectedDivisionFunction involves dividing
the result of evaluating both children. If the divisor resolves to zero
then the result returned will be zero to avoid the divide by zero issue.
evaluate in class Node<java.lang.Double>public java.lang.String getFunctionName()
getFunctionName in class FunctionNode<java.lang.Double>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||