jmathlib.core.tokens
Class OperandToken

java.lang.Object
  extended by jmathlib.core.interpreter.RootObject
      extended by jmathlib.core.tokens.Token
          extended by jmathlib.core.tokens.OperandToken
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ErrorCodes, TokenConstants
Direct Known Subclasses:
ClassdefToken, CommandToken, ConditionToken, DataToken, DelimiterToken, Expression, FunctionToken

public abstract class OperandToken
extends Token

The base class of all operands used in an expression

See Also:
Serialized Form

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
OperandToken()
          Default Constructor
OperandToken(int _priority)
          Constructor
 
Method Summary
 OperandToken add(OperandToken arg)
          add this token to another
 java.util.ArrayList asArray()
           
 java.util.Enumeration Children()
          function to access all children of a node within the expression tree
 OperandToken ctranspose()
          calculate the conjugate transpose
 OperandToken derivative(java.lang.String deriveBy)
          Symbolic function - calculates the the derivative of the token
 OperandToken divide(OperandToken arg)
          divide this token by another
 OperandToken expand()
          Symbolic function - expands the token
 OperandToken factorial()
          calculate the factorial
 OperandToken integral(java.lang.String integrateBy)
          Symbolic function - calculates the the integral of the token
 boolean isLeaf()
          checks if this is a leaf node of the expression tree
 boolean isNull()
           
 boolean isNumeric()
          Checks if this operand is a numeric value
 OperandToken leftDivide(OperandToken arg)
           
 OperandToken mpower(OperandToken arg)
          raise this token to the power of another
 OperandToken mPower(OperandToken arg)
          raise this token to the matrix power of another
 OperandToken multiply(OperandToken arg)
          multiply this token by another
 OperandToken negate()
          calculate the transpose
 OperandToken power(OperandToken arg)
          raise this token to the power of another
 OperandToken scalarDivide(OperandToken arg)
          divide this token by another
 OperandToken scalarLeftDivide(OperandToken arg)
           
 OperandToken scalarMultiply(OperandToken arg)
          scalar multiply this token by another
 OperandToken simplify()
          Symbolic function - simplifies the token
 OperandToken subst(OperandToken old, OperandToken substBy)
          Symbolic expression - replaces a symbol with an expression
 OperandToken subtract(OperandToken arg)
          subtract this token from another
 OperandToken transpose()
          calculate the transpose
 
Methods inherited from class jmathlib.core.tokens.Token
evaluate, isDisplayResult, setDisplayResult, toMathMlString, toString
 
Methods inherited from class jmathlib.core.interpreter.RootObject
clone, getContextList, getDebug, getFunctionManager, getGlobalVariables, getGraphicsManager, getInterpreter, getPluginsManager, getVariable, getVariables, getWorkingDirectory, setConstants, setDebug, setWorkingDirectory, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OperandToken

public OperandToken()
Default Constructor


OperandToken

public OperandToken(int _priority)
Constructor

Parameters:
_priority, - priority of token
_typeName - - a string representing the type, used for casting
Method Detail

multiply

public OperandToken multiply(OperandToken arg)
multiply this token by another

Parameters:
arg - = the amount to multiply it by
Returns:
the result as an OperandToken

scalarMultiply

public OperandToken scalarMultiply(OperandToken arg)
scalar multiply this token by another

Parameters:
arg - = the amount to multiply it by
Returns:
the result as an OperandToken

add

public OperandToken add(OperandToken arg)
add this token to another

Parameters:
arg - = the amount to add to it
Returns:
the result as an OperandToken

subtract

public OperandToken subtract(OperandToken arg)
subtract this token from another

Parameters:
arg - = the amount to subtract from it
Returns:
the result as an OperandToken

divide

public OperandToken divide(OperandToken arg)
divide this token by another

Parameters:
arg - = the amount to divide it by
Returns:
the result as an OperandToken

scalarDivide

public OperandToken scalarDivide(OperandToken arg)
divide this token by another

Parameters:
arg - = the amount to divide it by
Returns:
the result as an OperandToken

leftDivide

public OperandToken leftDivide(OperandToken arg)

scalarLeftDivide

public OperandToken scalarLeftDivide(OperandToken arg)

power

public OperandToken power(OperandToken arg)
raise this token to the power of another

Parameters:
arg - = the amount to raise it by
Returns:
the result as an OperandToken

mPower

public OperandToken mPower(OperandToken arg)
raise this token to the matrix power of another

Parameters:
arg - = the amount to raise it by
Returns:
the result as an OperandToken

mpower

public OperandToken mpower(OperandToken arg)
raise this token to the power of another

Parameters:
arg - = the amount to multiply it by
Returns:
the result as an OperandToken

factorial

public OperandToken factorial()
calculate the factorial

Returns:
the result as an OperandToken

transpose

public OperandToken transpose()
calculate the transpose

Returns:
the result as an OperandToken

ctranspose

public OperandToken ctranspose()
calculate the conjugate transpose

Returns:
the result as an OperandToken

negate

public OperandToken negate()
calculate the transpose

Returns:
the result as an OperandToken

simplify

public OperandToken simplify()
Symbolic function - simplifies the token


expand

public OperandToken expand()
Symbolic function - expands the token


derivative

public OperandToken derivative(java.lang.String deriveBy)
Symbolic function - calculates the the derivative of the token

Parameters:
deriveBy - = the symbol to derive by

integral

public OperandToken integral(java.lang.String integrateBy)
Symbolic function - calculates the the integral of the token

Parameters:
deriveBy - = the symbol to integrate by

subst

public OperandToken subst(OperandToken old,
                          OperandToken substBy)
Symbolic expression - replaces a symbol with an expression

Parameters:
old - = the symbol to replace
substBy - = the expression to replace it with

isNumeric

public boolean isNumeric()
Checks if this operand is a numeric value

Returns:
true if this is a number, false if it's an algebraic expression

isNull

public boolean isNull()
Returns:
true if the token is null

isLeaf

public boolean isLeaf()
checks if this is a leaf node of the expression tree

Returns:
true

Children

public java.util.Enumeration Children()
function to access all children of a node within the expression tree

Returns:
all the nodes children as a enumeration

asArray

public java.util.ArrayList asArray()
Returns:
the token as an ArrayList