jmathlib.core.tokens
Class MathLibObject

java.lang.Object
  extended by jmathlib.core.interpreter.RootObject
      extended by jmathlib.core.tokens.Token
          extended by jmathlib.core.tokens.OperandToken
              extended by jmathlib.core.tokens.DataToken
                  extended by jmathlib.core.tokens.MathLibObject
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ErrorCodes, TokenConstants

public class MathLibObject
extends DataToken

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jmathlib.core.tokens.DataToken
dataType, noElem, sizeA, sizeX, sizeY
 
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
MathLibObject()
          Create a new structure
MathLibObject(MathLibObject oldVal)
          Create a structure and copy it's data from another structure
 
Method Summary
 OperandToken add(OperandToken arg)
          add this token to another
 OperandToken divide(OperandToken arg)
          divide this token by another
 OperandToken evaluate(Token[] operands, GlobalValues globals)
          Evaluates the structure
 OperandToken getFieldData(java.lang.String fieldName)
          Get the value of a particular field
 java.util.Iterator getFields()
           
 java.util.HashMap getFieldsHash()
           
 Variable getFieldVariable(java.lang.String fieldName)
          Get the value of a particular field
 OperandToken multiply(OperandToken arg)
          multiply this token by another
 OperandToken power(OperandToken arg)
          raise this token to the power of another
 void setField(java.lang.String fieldName, OperandToken value)
          Set the value of one of the structures fields
 OperandToken subtract(OperandToken arg)
          subtract this token from another
 java.lang.String toString()
          Turns the structure into a string
 
Methods inherited from class jmathlib.core.tokens.DataToken
checkEqualDimensions, getDataType, getDimensions, getElement, getElement, getElementSized, getNumberOfElements, getSize, getSizeX, getSizeY, setElement, setElement, setSize
 
Methods inherited from class jmathlib.core.tokens.OperandToken
asArray, Children, ctranspose, derivative, expand, factorial, integral, isLeaf, isNull, isNumeric, leftDivide, mpower, mPower, negate, scalarDivide, scalarLeftDivide, scalarMultiply, simplify, subst, 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

MathLibObject

public MathLibObject()
Create a new structure


MathLibObject

public MathLibObject(MathLibObject oldVal)
Create a structure and copy it's data from another structure

Parameters:
oldVal - = the structure to copy the values from
Method Detail

setField

public void setField(java.lang.String fieldName,
                     OperandToken value)
Set the value of one of the structures fields

Parameters:
fieldName - = the name of the field to set
value - = the value to set the field to

getFieldData

public OperandToken getFieldData(java.lang.String fieldName)
Get the value of a particular field

Parameters:
fieldName - = the name of the field
Returns:
the fields data

getFieldVariable

public Variable getFieldVariable(java.lang.String fieldName)
Get the value of a particular field

Parameters:
fieldName - = the name of the field
Returns:
a variable pointing to the fields data

getFields

public java.util.Iterator getFields()
Returns:
a list of all fields

getFieldsHash

public java.util.HashMap getFieldsHash()
Returns:
a list of all fields

toString

public java.lang.String toString()
Turns the structure into a string

Specified by:
toString in class Token
Returns:
a string representation of the token

evaluate

public OperandToken evaluate(Token[] operands,
                             GlobalValues globals)
Evaluates the structure

Specified by:
evaluate in class Token
Parameters:
operands - = an array of RootObject containing the tokens operands
Returns:
the structure itself

add

public OperandToken add(OperandToken arg)
Description copied from class: OperandToken
add this token to another

Overrides:
add in class OperandToken
Parameters:
-
Returns:

subtract

public OperandToken subtract(OperandToken arg)
Description copied from class: OperandToken
subtract this token from another

Overrides:
subtract in class OperandToken
Parameters:
-
Returns:

multiply

public OperandToken multiply(OperandToken arg)
Description copied from class: OperandToken
multiply this token by another

Overrides:
multiply in class OperandToken
Parameters:
arg -
Returns:

divide

public OperandToken divide(OperandToken arg)
Description copied from class: OperandToken
divide this token by another

Overrides:
divide in class OperandToken
Parameters:
-
Returns:

power

public OperandToken power(OperandToken arg)
Description copied from class: OperandToken
raise this token to the power of another

Overrides:
power in class OperandToken
Parameters:
-
Returns:
the result as an OperandToken