Class expression.Symbol
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class expression.Symbol

java.lang.Object
   |
   +----expression.Symbol

public class Symbol
extends Object
An input symbol in an expression.

Variable Index

 o SYM_EXPRNODE
The symbol type representing a reduced expression node.
 o SYM_TERMINAL
The symbol type representing a terminal symbol.
 o SYM_UNKNOWN
The symbol type representing unknown symbol.
 o TK_BRACKETL
The token representing a left bracket in an expression.
 o TK_BRACKETR
The token representing a right bracket in an expression.
 o TK_DIV
The token representing a division sign in an expression.
 o TK_EOE
The token representing the end of an expression.
 o TK_FUNCTION
The token representing a function in an expression.
 o TK_MINUS
The token representing a minus sign in an expression.
 o TK_MULT
The token representing a multply sign in an expression.
 o TK_NUMBER
The token representing a number in an expression.
 o TK_PLUS
The token representing a plus sign in an expression.
 o TK_POW
The token representing a power sign in an expression.
 o TK_VARIABLE
The token representing a variable in an expression.
 o enode
The reduced expression node, if symbol type if SYM_EXPRNODE.
 o func
The function of a TK_FUNCTION token.
 o nval
The value of a TK_NUMBER token.
 o stype
Symbol type of the symbol.
 o ttype
The terminal type of the symbol, if symbol type if SYM_TERMINAL.
 o variable
The variable of a TK_VARIABLE token.

Constructor Index

 o Symbol()
Create an empty symbol.
 o Symbol(int, int)
Create a token symbol with symbol type and token type.
 o Symbol(int, int, double)
Create a Number token with symbol type specified as SYM_TERMINAL, token type specified as TK_NUMBER and a value
 o Symbol(int, int, char)
 o Symbol(int, int, String)
Create a Variable token or Function token with symbol type specified as SYM_TERMINAL.
 o Symbol(int, ExprNode)
Create a Function token with symbol type specified as SYM_EXPRNODE, and an expression node.

Method Index

 o equal(Symbol)
Returns true if current symbol has the same precedence as symbol a.
 o greater(Symbol)
Returns true if current symbol has higher precedence than symbol a.
 o isEOE()
Returns true if the symbol represents the end of an expression.
 o isExprNode()
Returns true if the symbol represents an expression node.
 o less(Symbol)
Returns true if current symbol has lower precedence than symbol a.
 o toString()
Returns the string representation of the current symbol.

Variables

 o SYM_UNKNOWN
  public final static int SYM_UNKNOWN
The symbol type representing unknown symbol.
 o SYM_EXPRNODE
  public final static int SYM_EXPRNODE
The symbol type representing a reduced expression node.
 o SYM_TERMINAL
  public final static int SYM_TERMINAL
The symbol type representing a terminal symbol.
 o TK_EOE
  public final static int TK_EOE
The token representing the end of an expression.
 o TK_NUMBER
  public final static int TK_NUMBER
The token representing a number in an expression.
 o TK_VARIABLE
  public final static int TK_VARIABLE
The token representing a variable in an expression.
 o TK_BRACKETL
  public final static int TK_BRACKETL
The token representing a left bracket in an expression.
 o TK_BRACKETR
  public final static int TK_BRACKETR
The token representing a right bracket in an expression.
 o TK_PLUS
  public final static int TK_PLUS
The token representing a plus sign in an expression.
 o TK_MINUS
  public final static int TK_MINUS
The token representing a minus sign in an expression.
 o TK_MULT
  public final static int TK_MULT
The token representing a multply sign in an expression.
 o TK_DIV
  public final static int TK_DIV
The token representing a division sign in an expression.
 o TK_POW
  public final static int TK_POW
The token representing a power sign in an expression.
 o TK_FUNCTION
  public final static int TK_FUNCTION
The token representing a function in an expression.
 o stype
  public int stype
Symbol type of the symbol.
 o ttype
  public int ttype
The terminal type of the symbol, if symbol type if SYM_TERMINAL.
 o enode
  public ExprNode enode
The reduced expression node, if symbol type if SYM_EXPRNODE.
 o nval
  public double nval
The value of a TK_NUMBER token.
 o func
  public Function func
The function of a TK_FUNCTION token.
 o variable
  public Variable variable
The variable of a TK_VARIABLE token.

Constructors

 o Symbol
  public Symbol()
Create an empty symbol.
 o Symbol
  public Symbol(int type,
                int tk)
Create a token symbol with symbol type and token type. It is used for creating symbols for operators, EOE and brackets.
 o Symbol
  public Symbol(int type,
                int tk,
                double val)
Create a Number token with symbol type specified as SYM_TERMINAL, token type specified as TK_NUMBER and a value
 o Symbol
  public Symbol(int type,
                int tk,
                char vchar) throws ExpressionParseException
 o Symbol
  public Symbol(int type,
                int tk,
                String str) throws ExpressionParseException
Create a Variable token or Function token with symbol type specified as SYM_TERMINAL. Variable token will be created if token type is specified as TK_VARIABLE and the string representation of a variable ("X", "Y", "Z", "E", "PI") is given. Function token will be created if token type is specified as TK_FUNCTION and the string representation of the function is given.
 o Symbol
  public Symbol(int type,
                ExprNode en)
Create a Function token with symbol type specified as SYM_EXPRNODE, and an expression node.

Methods

 o isEOE
  public boolean isEOE()
Returns true if the symbol represents the end of an expression.
 o isExprNode
  public boolean isExprNode()
Returns true if the symbol represents an expression node.
 o less
  public boolean less(Symbol a) throws ExpressionParseException
Returns true if current symbol has lower precedence than symbol a.
 o equal
  public boolean equal(Symbol a) throws ExpressionParseException
Returns true if current symbol has the same precedence as symbol a.
 o greater
  public boolean greater(Symbol a) throws ExpressionParseException
Returns true if current symbol has higher precedence than symbol a.
 o toString
  public String toString()
Returns the string representation of the current symbol.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index