jmathlib.core.interpreter
Class Variable

java.lang.Object
  extended by jmathlib.core.interpreter.RootObject
      extended by jmathlib.core.interpreter.Variable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ErrorCodes, TokenConstants

public class Variable
extends RootObject

class for binding a variable name to some data

See Also:
Serialized Form

Field Summary
private  OperandToken data
          variable data
private  boolean globalB
          local or global context
private  java.lang.String name
          variable name
 
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
 
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
 
Constructor Summary
Variable()
          default constructor
Variable(java.lang.String _name)
          constructor containing a variable name
Variable(java.lang.String _name, OperandToken _data)
          constructor containing the variables name and data
 
Method Summary
 OperandToken assign(OperandToken _data)
          Assign a new value to the variable
 boolean equals(java.lang.Object _data)
          implement the equals operator to find a variable with the correct name if _data is an instance of Variable then it compares the name of _data to the variable otherwise it calls the superclasses version
 OperandToken getData()
          Returns the variables data
 java.lang.String getName()
          Returns the variables name
 boolean isGlobal()
           
 void setGlobal(boolean globalB)
           
 java.lang.String toString()
          Converts the variable into a string.
 java.lang.String toString(java.lang.String[] operands)
          Converts the variable to a string.
 
Methods inherited from class jmathlib.core.interpreter.RootObject
clone, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name
variable name


data

private OperandToken data
variable data


globalB

private boolean globalB
local or global context

Constructor Detail

Variable

public Variable()
default constructor


Variable

public Variable(java.lang.String _name)
constructor containing a variable name

Parameters:
_name -

Variable

public Variable(java.lang.String _name,
                OperandToken _data)
constructor containing the variables name and data

Parameters:
_name -
_data -
Method Detail

assign

public OperandToken assign(OperandToken _data)
Assign a new value to the variable

Parameters:
_data -
Returns:

equals

public boolean equals(java.lang.Object _data)
implement the equals operator to find a variable with the correct name if _data is an instance of Variable then it compares the name of _data to the variable otherwise it calls the superclasses version

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Converts the variable into a string.

Overrides:
toString in class java.lang.Object
Returns:

toString

public java.lang.String toString(java.lang.String[] operands)
Converts the variable to a string.


getName

public java.lang.String getName()
Returns the variables name

Returns:

getData

public OperandToken getData()
Returns the variables data

Returns:

isGlobal

public boolean isGlobal()
Returns:

setGlobal

public void setGlobal(boolean globalB)
Parameters:
globalB -

FOOTER

BOTTOM