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 abs()
          Standard functions - calculates the absolute value
 OperandToken acos()
          trigonometric functions - calculate the arc cosine of this token
 OperandToken acosh()
          Trigonometric function - calculates the inverse hyperbolic cosine
 OperandToken add(OperandToken arg)
          add this token to another
 OperandToken asin()
          trigonometric functions - calculate the arc sine of this token
 OperandToken atan()
          trigonometric functions - calculate the arc tangent of this token
 OperandToken atanh()
          Trigonometric function - calculates the inverse hyperbolic tangent
 OperandToken cosh()
          Trigonometric function - calculates the hyperbolic cosine
 OperandToken degreesToRadians()
           
 OperandToken divide(OperandToken arg)
          divide this token by another
 OperandToken evaluate(Token[] operands)
          Evaluates the structure
 OperandToken exp()
          Standard functions - calculates the exponent
 OperandToken factorial()
          calculate the factorial
 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
 OperandToken radiansToDegrees()
           
 void setField(java.lang.String fieldName, OperandToken value)
          Set the value of one of the structures fields
 OperandToken sinh()
          Trigonometric function - calculates the hyperbolic sine
 OperandToken subtract(OperandToken arg)
          subtract this token from another
 OperandToken tan()
          trigonometric functions - calculate the tangent of this token
 OperandToken tanh()
          Trigonometric function - calculates the hyperbolic tan
 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, 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
 
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

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)
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:
arg - = the amount to add to it
Returns:
the result as an OperandToken

subtract

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

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

multiply

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

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

divide

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

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

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:
arg - = the amount to raise it by
Returns:
the result as an OperandToken

factorial

public OperandToken factorial()
calculate the factorial

Overrides:
factorial in class OperandToken
Returns:
the result as an OperandToken

tan

public OperandToken tan()
trigonometric functions - calculate the tangent of this token

Returns:
the result as an OperandToken

asin

public OperandToken asin()
trigonometric functions - calculate the arc sine of this token

Returns:
the result as an OperandToken

acos

public OperandToken acos()
trigonometric functions - calculate the arc cosine of this token

Returns:
the result as an OperandToken

atan

public OperandToken atan()
trigonometric functions - calculate the arc tangent of this token

Returns:
the result as an OperandToken

sinh

public OperandToken sinh()
Trigonometric function - calculates the hyperbolic sine

Returns:
the result as an OperandToken

cosh

public OperandToken cosh()
Trigonometric function - calculates the hyperbolic cosine

Returns:
the result as an OperandToken

tanh

public OperandToken tanh()
Trigonometric function - calculates the hyperbolic tan

Returns:
the result as an OperandToken

acosh

public OperandToken acosh()
Trigonometric function - calculates the inverse hyperbolic cosine

Returns:
the result as an OperandToken

atanh

public OperandToken atanh()
Trigonometric function - calculates the inverse hyperbolic tangent

Returns:
the result as an OperandToken

abs

public OperandToken abs()
Standard functions - calculates the absolute value

Returns:
the result as an OperandToken

exp

public OperandToken exp()
Standard functions - calculates the exponent

Returns:
the result as an OperandToken

degreesToRadians

public OperandToken degreesToRadians()

radiansToDegrees

public OperandToken radiansToDegrees()