jmathlib.core.tokens.numbertokens
Class UInt8NumberToken

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.NumberToken
                      extended by jmathlib.core.tokens.numbertokens.UInt8NumberToken
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ErrorCodes, TokenConstants

public class UInt8NumberToken
extends NumberToken

See Also:
Serialized Form

Field Summary
private  short[][] values
          Complex values of the token the data is organizes as on single vector.
 
Fields inherited from class jmathlib.core.tokens.NumberToken
IMAG, numFormat, REAL
 
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
UInt8NumberToken()
          Constructor creating empty number token
UInt8NumberToken(int[] _sizeA, short[] _reValues, short[] _imValues)
          Constructor for multidimensional array
UInt8NumberToken(int _dy, int _dx, short[] _reValues, short[] _imValues)
           
UInt8NumberToken(short _value)
          Constructor creating a scalar taking the numbers value as a double
UInt8NumberToken(short[][] _values)
          Constructor taking the numbers value as a double[][]
UInt8NumberToken(short[][][] _values)
          Constructor taking the numbers value as a double[][][]
UInt8NumberToken(short[][] _real, short[][] _imaginary)
          Constructor taking the numbers value as two double[][]
UInt8NumberToken(short _real, short _imaginary)
          Constructor taking the numbers value as a pair of double values representing real and imaginary part
UInt8NumberToken(java.lang.String _real, java.lang.String _imaginary)
          Constructor taking the numbers value as a string
 
Method Summary
private  short add(double a, double b)
           
 OperandToken add(OperandToken arg)
          add arg to this object for a number token
 OperandToken evaluate(Token[] operands)
          Evaluate the token.
 OperandToken getElement(int n)
           
 DataToken getElementSized(int y, int x)
          return a new Number Token of size y*x
 short getValueIm()
           
 short getValueIm(int n)
           
 short getValueIm(int[] index)
           
 short getValueIm(int y, int x)
           
 short getValueRe()
           
 short getValueRe(int n)
           
 short getValueRe(int[] index)
           
 short getValueRe(int y, int x)
           
 short[][] getValuesIm()
           
 short[][] getValuesRe()
           
 void setElement(int n, OperandToken num)
           
 void setSize(int dy, int dx)
          increase/decrease the size of the current DoubleNumberToken to size y*x
 void setValue(int[] index, short _real, short _imag)
           
 void setValue(int y, int x, short _real, short _imag)
          Set value at position y, x
 void setValue(int n, short _real, short _imag)
           
private  short subtract(double a, double b)
           
 OperandToken subtract(OperandToken arg)
          subtract arg from this object for a number token
 java.lang.String toString()
          return the number as a string
private  java.lang.String toString(int[] dim, int i)
           
 java.lang.String toString(short[] _values)
          create string representation of (complex) double values
private  java.lang.String toString2d(int[] nn)
           
 
Methods inherited from class jmathlib.core.tokens.NumberToken
evaluate, getElement, index2n, isNumeric, isScalar, setElement, toString, yx2n
 
Methods inherited from class jmathlib.core.tokens.DataToken
checkEqualDimensions, getDataType, getDimensions, getNumberOfElements, getSize, getSizeX, getSizeY
 
Methods inherited from class jmathlib.core.tokens.OperandToken
asArray, Children, ctranspose, derivative, divide, expand, factorial, integral, isLeaf, isNull, leftDivide, mpower, mPower, multiply, negate, power, 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, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

values

private short[][] values
Complex values of the token the data is organizes as on single vector. e.g. a=[1,2;3,4] will be stored like below values = 1 3 2 4

Constructor Detail

UInt8NumberToken

public UInt8NumberToken()
Constructor creating empty number token


UInt8NumberToken

public UInt8NumberToken(short _value)
Constructor creating a scalar taking the numbers value as a double

Parameters:
_value - = the numbers value as a double

UInt8NumberToken

public UInt8NumberToken(short[][] _values)
Constructor taking the numbers value as a double[][]

Parameters:
_value - = the numbers value as a 2D array of double

UInt8NumberToken

public UInt8NumberToken(java.lang.String _real,
                        java.lang.String _imaginary)
Constructor taking the numbers value as a string

Parameters:
_real - = the numbers real value as a string
_imaginary - = the numbers imaginary value as a string

UInt8NumberToken

public UInt8NumberToken(short _real,
                        short _imaginary)
Constructor taking the numbers value as a pair of double values representing real and imaginary part

Parameters:
_real - = the numbers real value as a double
_imaginary - = the numbers imaginary value as a double

UInt8NumberToken

public UInt8NumberToken(short[][] _real,
                        short[][] _imaginary)
Constructor taking the numbers value as two double[][]

Parameters:
_real - = the numbers value as a 2D array of double
_imaginary - = the numbers value as a 2D array of double

UInt8NumberToken

public UInt8NumberToken(short[][][] _values)
Constructor taking the numbers value as a double[][][]

Parameters:
_values - = the numbers value as a 3D array of double

UInt8NumberToken

public UInt8NumberToken(int _dy,
                        int _dx,
                        short[] _reValues,
                        short[] _imValues)
Parameters:
_dy -
_dx -
_reValues -
_imValues -

UInt8NumberToken

public UInt8NumberToken(int[] _sizeA,
                        short[] _reValues,
                        short[] _imValues)
Constructor for multidimensional array

Parameters:
_sizeA -
_reValues -
_imValues -
Method Detail

getElementSized

public DataToken getElementSized(int y,
                                 int x)
return a new Number Token of size y*x

Overrides:
getElementSized in class DataToken

setSize

public void setSize(int dy,
                    int dx)
increase/decrease the size of the current DoubleNumberToken to size y*x

Overrides:
setSize in class DataToken
Parameters:
dy - number of rows
dx - number of columns

getValueRe

public short getValueRe()
Returns:
the real value of the first number

getValueRe

public short getValueRe(int y,
                        int x)
Parameters:
y -
x -
Returns:
the real value of the number at position y, x

getValueRe

public short getValueRe(int[] index)
Parameters:
index -
Returns:

getValueRe

public short getValueRe(int n)
Parameters:
n -
Returns:

getValueIm

public short getValueIm()
Returns:
the imaginary value of the first number

getValueIm

public short getValueIm(int y,
                        int x)
Returns:
the imaginary value of the number at position y, x

getValueIm

public short getValueIm(int[] index)
Parameters:
index -
Returns:

getValueIm

public short getValueIm(int n)
Parameters:
n -
Returns:

getValuesRe

public short[][] getValuesRe()
Returns:
the real values of the number

getValuesIm

public short[][] getValuesIm()
Returns:
the imaginary values of the number

getElement

public OperandToken getElement(int n)
Overrides:
getElement in class DataToken
Parameters:
n -
Returns:

setElement

public void setElement(int n,
                       OperandToken num)
Overrides:
setElement in class DataToken
Parameters:
n -
num -

setValue

public void setValue(int y,
                     int x,
                     short _real,
                     short _imag)
Set value at position y, x

Parameters:
y - = y position in matrix
x - = x position in matrix
real - = real value
imag - = imaginary value

setValue

public void setValue(int n,
                     short _real,
                     short _imag)
Parameters:
n -
_real -
_imag -

setValue

public void setValue(int[] index,
                     short _real,
                     short _imag)
Parameters:
index - multidimensional index
_real -
_imag -

add

public OperandToken add(OperandToken arg)
add arg to this object for a number token

Overrides:
add in class OperandToken
Parameters:
= - the value to add to it
Returns:
the result as an OperandToken

add

private short add(double a,
                  double b)

subtract

public OperandToken subtract(OperandToken arg)
subtract arg from this object for a number token

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

subtract

private short subtract(double a,
                       double b)

toString

public java.lang.String toString()
return the number as a string

Overrides:
toString in class NumberToken
Returns:
a string representation of the token

toString

private java.lang.String toString(int[] dim,
                                  int i)

toString2d

private java.lang.String toString2d(int[] nn)

toString

public java.lang.String toString(short[] _values)
create string representation of (complex) double values

Parameters:
_values[]={REAL,IMAG} - real and imaginary part of number

evaluate

public OperandToken evaluate(Token[] operands)
Evaluate the token. This causes it to return itself


FOOTER

BOTTOM