An ExpressionNode that handles exponentiation. More...


Public Member Functions | |
| ExponentiationExpressionNode (ExpressionNode base, ExpressionNode exponent) | |
| Construct the ExponentiationExpressionNode with base and exponent. | |
| int | getType () |
| Returns the type of the node, in this case ExpressionNode.EXPONENTIATION_NODE. | |
| double | getValue () |
| Returns the value of the sub-expression that is rooted at this node. | |
| void | accept (ExpressionNodeVisitor visitor) |
| Implementation of the visitor design pattern. | |
Private Attributes | |
| ExpressionNode | base |
| the node containing the base | |
| ExpressionNode | exponent |
| the node containing the exponent | |
Additional Inherited Members | |
Static Public Attributes inherited from uk.co.cogitolearning.cogpar.ExpressionNode | |
| static final int | VARIABLE_NODE = 1 |
| Node id for variable nodes. | |
| static final int | CONSTANT_NODE = 2 |
| Node id for constant nodes. | |
| static final int | ADDITION_NODE = 3 |
| Node id for addition nodes. | |
| static final int | MULTIPLICATION_NODE = 4 |
| Node id for multiplication nodes. | |
| static final int | EXPONENTIATION_NODE = 5 |
| Node id for exponentiation nodes. | |
| static final int | FUNCTION_NODE = 6 |
| Node id for function nodes. | |
An ExpressionNode that handles exponentiation.
The node holds a base and an exponent and calulates base^exponent
Definition at line 32 of file ExponentiationExpressionNode.java.
| uk.co.cogitolearning.cogpar.ExponentiationExpressionNode.ExponentiationExpressionNode | ( | ExpressionNode | base, |
| ExpressionNode | exponent | ||
| ) |
Construct the ExponentiationExpressionNode with base and exponent.
| base | the node containing the base |
| exponent | the node containing the exponent |
Definition at line 44 of file ExponentiationExpressionNode.java.
| void uk.co.cogitolearning.cogpar.ExponentiationExpressionNode.accept | ( | ExpressionNodeVisitor | visitor | ) |
Implementation of the visitor design pattern.
Calls visit on the visitor and then passes the visitor on to the accept method of the base and the exponent.
| visitor | the visitor |
Implements uk.co.cogitolearning.cogpar.ExpressionNode.
Definition at line 77 of file ExponentiationExpressionNode.java.
| double uk.co.cogitolearning.cogpar.ExponentiationExpressionNode.getValue | ( | ) |
Returns the value of the sub-expression that is rooted at this node.
Calculates base^exponent
Implements uk.co.cogitolearning.cogpar.ExpressionNode.
Definition at line 63 of file ExponentiationExpressionNode.java.
1.8.1.2