An interface for expression nodes. More...

Public Member Functions | |
| int | getType () |
| Returns the type of the node.ExpressionNode. | |
| double | getValue () |
| Calculates and returns the value of the sub-expression represented by the node. | |
| void | accept (ExpressionNodeVisitor visitor) |
| Method needed for the visitor design pattern. | |
Static Public Attributes | |
| 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 interface for expression nodes.
Every concrete type of expression node has to implement this interface.
Definition at line 32 of file ExpressionNode.java.
| void uk.co.cogitolearning.cogpar.ExpressionNode.accept | ( | ExpressionNodeVisitor | visitor | ) |
Method needed for the visitor design pattern.
| visitor | the visitor |
Implemented in uk.co.cogitolearning.cogpar.FunctionExpressionNode, uk.co.cogitolearning.cogpar.VariableExpressionNode, uk.co.cogitolearning.cogpar.AdditionExpressionNode, uk.co.cogitolearning.cogpar.MultiplicationExpressionNode, uk.co.cogitolearning.cogpar.ConstantExpressionNode, and uk.co.cogitolearning.cogpar.ExponentiationExpressionNode.
| int uk.co.cogitolearning.cogpar.ExpressionNode.getType | ( | ) |
Returns the type of the node.ExpressionNode.
Each class derived from ExpressionNode representing a specific role in the expression should return the type according to that role.
Implemented in uk.co.cogitolearning.cogpar.FunctionExpressionNode, uk.co.cogitolearning.cogpar.ConstantExpressionNode, uk.co.cogitolearning.cogpar.VariableExpressionNode, uk.co.cogitolearning.cogpar.AdditionExpressionNode, uk.co.cogitolearning.cogpar.MultiplicationExpressionNode, and uk.co.cogitolearning.cogpar.ExponentiationExpressionNode.
| double uk.co.cogitolearning.cogpar.ExpressionNode.getValue | ( | ) |
Calculates and returns the value of the sub-expression represented by the node.
Implemented in uk.co.cogitolearning.cogpar.FunctionExpressionNode, uk.co.cogitolearning.cogpar.VariableExpressionNode, uk.co.cogitolearning.cogpar.AdditionExpressionNode, uk.co.cogitolearning.cogpar.MultiplicationExpressionNode, uk.co.cogitolearning.cogpar.ExponentiationExpressionNode, and uk.co.cogitolearning.cogpar.ConstantExpressionNode.
1.8.1.2