Constructor
new ExpressionTree(expressionString)
Construct an expression tree object representing an expression
Parameters:
Name | Type | Description |
---|---|---|
expressionString |
string | The expression used to build this tree |
- Source:
Members
expressionString
The expression used to build this tree
- Source:
root
The root node of this tree
- Source:
Methods
buildNode(operator, expression) → {BinaryNode}
Builds a single node with null pointers. If this is the last node in the sequence, it will have a numeric/variable value, otherwise it will be an operator
Parameters:
Name | Type | Description |
---|---|---|
operator |
string | The value to be placed in this node if operator is defined and not null |
expression |
Array.<string> | The mathematical expression that will be used to build the pointers to the next nodes |
- Source:
Returns:
A binary node
- Type
- BinaryNode
buildNodePointers(node, expression)
Attemps to reconfigure a binary node's null pointers so they will each point to another node
Parameters:
Name | Type | Description |
---|---|---|
node |
BinaryNode | The node whose pointers are being built |
expression |
Array.<string> | The mathematical expression that will be used to build this node |
- Source:
buildTree(expressionString)
Build an expression tree representing an expression; ERASES CURRENT TREE DATA ON THIS OBJECT
Parameters:
Name | Type | Description |
---|---|---|
expressionString |
string | The expression used to build this tree |
- Source:
findLowestPrecedence(expression)
Returns information regarding the operator of lowest precedence
Parameters:
Name | Type | Description |
---|---|---|
expression |
Array.<string> | The expression whose operators are being analyzed |
- Source:
isEqual(obj)
Check if an object is equal to this object
Parameters:
Name | Type | Description |
---|---|---|
obj |
* | The object that will be compared with this object |
- Source: