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.
-
SYM_EXPRNODE
- The symbol type representing a reduced expression node.
-
SYM_TERMINAL
- The symbol type representing a terminal symbol.
-
SYM_UNKNOWN
- The symbol type representing unknown symbol.
-
TK_BRACKETL
- The token representing a left bracket in an expression.
-
TK_BRACKETR
- The token representing a right bracket in an expression.
-
TK_DIV
- The token representing a division sign in an expression.
-
TK_EOE
- The token representing the end of an expression.
-
TK_FUNCTION
- The token representing a function in an expression.
-
TK_MINUS
- The token representing a minus sign in an expression.
-
TK_MULT
- The token representing a multply sign in an expression.
-
TK_NUMBER
- The token representing a number in an expression.
-
TK_PLUS
- The token representing a plus sign in an expression.
-
TK_POW
- The token representing a power sign in an expression.
-
TK_VARIABLE
- The token representing a variable in an expression.
-
enode
- The reduced expression node, if symbol type if SYM_EXPRNODE.
-
func
- The function of a TK_FUNCTION token.
-
nval
- The value of a TK_NUMBER token.
-
stype
- Symbol type of the symbol.
-
ttype
- The terminal type of the symbol, if symbol type if SYM_TERMINAL.
-
variable
- The variable of a TK_VARIABLE token.
-
Symbol()
- Create an empty symbol.
-
Symbol(int, int)
- Create a token symbol with symbol type and token type.
-
Symbol(int, int, double)
- Create a Number token with symbol type specified as SYM_TERMINAL,
token type specified as TK_NUMBER and a value
-
Symbol(int, int, char)
-
-
Symbol(int, int, String)
- Create a Variable token or Function token with symbol type specified
as SYM_TERMINAL.
-
Symbol(int, ExprNode)
- Create a Function token with symbol type specified as SYM_EXPRNODE,
and an expression node.
-
equal(Symbol)
- Returns true if current symbol has the same precedence as symbol a.
-
greater(Symbol)
- Returns true if current symbol has higher precedence than symbol a.
-
isEOE()
- Returns true if the symbol represents the end of an expression.
-
isExprNode()
- Returns true if the symbol represents an expression node.
-
less(Symbol)
- Returns true if current symbol has lower precedence than symbol a.
-
toString()
- Returns the string representation of the current symbol.
SYM_UNKNOWN
public final static int SYM_UNKNOWN
- The symbol type representing unknown symbol.
SYM_EXPRNODE
public final static int SYM_EXPRNODE
- The symbol type representing a reduced expression node.
SYM_TERMINAL
public final static int SYM_TERMINAL
- The symbol type representing a terminal symbol.
TK_EOE
public final static int TK_EOE
- The token representing the end of an expression.
TK_NUMBER
public final static int TK_NUMBER
- The token representing a number in an expression.
TK_VARIABLE
public final static int TK_VARIABLE
- The token representing a variable in an expression.
TK_BRACKETL
public final static int TK_BRACKETL
- The token representing a left bracket in an expression.
TK_BRACKETR
public final static int TK_BRACKETR
- The token representing a right bracket in an expression.
TK_PLUS
public final static int TK_PLUS
- The token representing a plus sign in an expression.
TK_MINUS
public final static int TK_MINUS
- The token representing a minus sign in an expression.
TK_MULT
public final static int TK_MULT
- The token representing a multply sign in an expression.
TK_DIV
public final static int TK_DIV
- The token representing a division sign in an expression.
TK_POW
public final static int TK_POW
- The token representing a power sign in an expression.
TK_FUNCTION
public final static int TK_FUNCTION
- The token representing a function in an expression.
stype
public int stype
- Symbol type of the symbol.
ttype
public int ttype
- The terminal type of the symbol, if symbol type if SYM_TERMINAL.
enode
public ExprNode enode
- The reduced expression node, if symbol type if SYM_EXPRNODE.
nval
public double nval
- The value of a TK_NUMBER token.
func
public Function func
- The function of a TK_FUNCTION token.
variable
public Variable variable
- The variable of a TK_VARIABLE token.
Symbol
public Symbol()
- Create an empty symbol.
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.
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
Symbol
public Symbol(int type,
int tk,
char vchar) throws ExpressionParseException
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.
Symbol
public Symbol(int type,
ExprNode en)
- Create a Function token with symbol type specified as SYM_EXPRNODE,
and an expression node.
isEOE
public boolean isEOE()
- Returns true if the symbol represents the end of an expression.
isExprNode
public boolean isExprNode()
- Returns true if the symbol represents an expression node.
less
public boolean less(Symbol a) throws ExpressionParseException
- Returns true if current symbol has lower precedence than symbol a.
equal
public boolean equal(Symbol a) throws ExpressionParseException
- Returns true if current symbol has the same precedence as symbol a.
greater
public boolean greater(Symbol a) throws ExpressionParseException
- Returns true if current symbol has higher precedence than symbol a.
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