An ExpressionNode that handles multiplications and divisions. More...


Public Member Functions | |
| MultiplicationExpressionNode () | |
| Default constructor. | |
| MultiplicationExpressionNode (ExpressionNode a, boolean positive) | |
| Constructor to create a multiplication with the first term already added. | |
| int | getType () |
| Returns the type of the node, in this case ExpressionNode.MULTIPLICATION_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. | |
Public Member Functions inherited from uk.co.cogitolearning.cogpar.SequenceExpressionNode | |
| SequenceExpressionNode () | |
| Default constructor. | |
| SequenceExpressionNode (ExpressionNode a, boolean positive) | |
| Constructor to create a sequence with the first term already added. | |
| void | add (ExpressionNode node, boolean positive) |
| Add another term to the sequence. | |
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. | |
Protected Attributes inherited from uk.co.cogitolearning.cogpar.SequenceExpressionNode | |
| ArrayList< Term > | terms |
| the list of terms in the sequence | |
An ExpressionNode that handles multiplications and divisions.
The node can hold an arbitrary number of factors that are either multiplied or divided to the product.
Definition at line 32 of file MultiplicationExpressionNode.java.
| uk.co.cogitolearning.cogpar.MultiplicationExpressionNode.MultiplicationExpressionNode | ( | ExpressionNode | a, |
| boolean | positive | ||
| ) |
Constructor to create a multiplication with the first term already added.
| node | the term to be added |
| positive | a flag indicating whether the term is multiplied or divided |
Definition at line 48 of file MultiplicationExpressionNode.java.
| void uk.co.cogitolearning.cogpar.MultiplicationExpressionNode.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 all the terms in the product.
| visitor | the visitor |
Implements uk.co.cogitolearning.cogpar.ExpressionNode.
Definition at line 88 of file MultiplicationExpressionNode.java.
| double uk.co.cogitolearning.cogpar.MultiplicationExpressionNode.getValue | ( | ) |
Returns the value of the sub-expression that is rooted at this node.
All the terms are evaluated and multiplied or divided to the product.
Implements uk.co.cogitolearning.cogpar.ExpressionNode.
Definition at line 66 of file MultiplicationExpressionNode.java.
1.8.1.2