|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjmathlib.core.interpreter.RootObject
jmathlib.core.tokens.Token
jmathlib.core.tokens.OperandToken
jmathlib.core.tokens.Expression
public class Expression
Class implementing a tree where each node has a variable no of children
| Field Summary |
|---|
| Fields inherited from class jmathlib.core.tokens.Token |
|---|
priority |
| Fields inherited from interface jmathlib.core.constants.TokenConstants |
|---|
ADDSUB_PRIORITY, AND_PRIORITY, ANDAND_PRIORITY, ASSIGN_PRIORITY, BRACKET_PRIORITY, COMPARE_PRIORITY, CONCAT, MATRIX, MULDIV_PRIORITY, OR_PRIORITY, OROR_PRIORITY, PARAMETER, POWER_PRIORITY, RELATION_PRIORITY, SINGLE, ttDelimiter, ttNotSet, ttOperand, ttOperator |
| Fields inherited from interface jmathlib.core.constants.ErrorCodes |
|---|
ERR_BRACKET_OPEN, ERR_BRACKET_ORDER, ERR_FUNCTION_NOT_FOUND, ERR_FUNCTION_NOT_IMPLEMENTED, ERR_INSUFFICIENT_PARAMETERS, ERR_INVALID_PARAMETER, ERR_LVALUE_REQUIRED, ERR_MATRIX_SINGULAR, ERR_NOT_SQUARE_MATRIX, ERR_OPNOTSUPPORTED, ERR_TOO_MANY_PARAMETERS, ERR_USER_ERROR, ERR_VARIABLE_NOTDEFINED, OK, OK_FUNCTION_PROCESS |
| Constructor Summary | |
|---|---|
Expression()
Default constructor - creates an expression with a null operator and no operands |
|
Expression(OperatorToken _data)
Creates an expression with no operands |
|
Expression(OperatorToken _data,
OperandToken operand)
Creates an expression with one operand |
|
Expression(OperatorToken _data,
OperandToken[] _children,
int _noChildren)
Creates an expression with an array of operands |
|
Expression(OperatorToken _data,
OperandToken left,
OperandToken right)
Creates an expression with two operands |
|
Expression(OperatorToken _data,
OperandToken op1,
OperandToken op2,
OperandToken op3)
Creates an expression with three operands |
|
| Method Summary | |
|---|---|
OperandToken |
evaluate(Token[] ops,
GlobalValues globals)
evaluate the data item held within this node |
OperandToken |
getChild(int childNo)
Get the a child with a specific index |
int |
getChildNo()
|
java.util.Enumeration |
getChildren()
function to access all children of a node within the expression tree |
OperandToken |
getCurrentChild()
|
OperatorToken |
getData()
retrieves the data object |
OperandToken |
getLeft()
Get the first child of this node |
int |
getNumberOfChildren()
|
OperandToken |
getRight()
Get the last child of this node |
void |
insert(Token _data)
insert a child node on this Expression if _data is a Expression then it just gets added to the current node Otherwise a new node is created and this is added to the current node |
boolean |
isLeaf()
checks if this is a leaf node of the expression tree |
boolean |
isNumeric()
Checks if this operand is a numeric value |
void |
setChild(int childNo,
OperandToken child)
set the child with a specific index |
void |
setData(OperatorToken _data)
Sets the operator of the expression |
java.lang.String |
toString()
Converts the expression to a string |
| Methods inherited from class jmathlib.core.tokens.OperandToken |
|---|
add, asArray, Children, ctranspose, derivative, divide, expand, factorial, integral, isNull, leftDivide, mpower, mPower, multiply, negate, power, scalarDivide, scalarLeftDivide, scalarMultiply, simplify, subst, subtract, transpose |
| Methods inherited from class jmathlib.core.tokens.Token |
|---|
isDisplayResult, setDisplayResult, toMathMlString, toString |
| Methods inherited from class jmathlib.core.interpreter.RootObject |
|---|
clone, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Expression()
public Expression(OperatorToken _data)
_data - = the expressions operator
public Expression(OperatorToken _data,
OperandToken operand)
_data - = the expressions operatoroperand - = the expressions operand
public Expression(OperatorToken _data,
OperandToken left,
OperandToken right)
_data - = the expressions operatorleft - = the left hand operandright - = the right hand operand
public Expression(OperatorToken _data,
OperandToken op1,
OperandToken op2,
OperandToken op3)
_data - = the expressions operatorfirst - = the left hand operandsecond - = the middle operandthird - = the right hand operand
public Expression(OperatorToken _data,
OperandToken[] _children,
int _noChildren)
data - = the expressions operatoroperands - = and array of operands_noChildren - = the number of operands| Method Detail |
|---|
public OperatorToken getData()
public int getNumberOfChildren()
public void setData(OperatorToken _data)
_data - = the expressions operatorpublic OperandToken getChild(int childNo)
childNo - = the index of the operand
public void setChild(int childNo,
OperandToken child)
childNo - = the index of the childchild - = the value to set it topublic OperandToken getLeft()
public OperandToken getRight()
public void insert(Token _data)
_data - = the operand to add
public OperandToken evaluate(Token[] ops,
GlobalValues globals)
evaluate in class Tokenops - = the expressions operands
public java.lang.String toString()
toString in class Tokenpublic boolean isNumeric()
isNumeric in class OperandTokenpublic int getChildNo()
public OperandToken getCurrentChild()
public boolean isLeaf()
isLeaf in class OperandTokenpublic java.util.Enumeration getChildren()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||