info.aduna.gee.publication.servlets.car
Class Symbol

java.lang.Object
  extended by info.aduna.gee.publication.servlets.car.Symbol

public class Symbol
extends Object

An input symbol in an expression.


Field Summary
 ExpressionNode enode
          The reduced expression node, if symbol type if SYM_EXPRNODE.
 long nval
          The value of a TK_NUMBER token.
 int stype
          Symbol type of the symbol.
static int SYM_EXPRNODE
           
static int SYM_TERMINAL
           
static int SYM_UNKNOWN
           
static int TK_AND
           
static int TK_BRACKETL
           
static int TK_BRACKETR
           
static int TK_EOE
           
static int TK_NOT
           
static int TK_NUMBER
           
static int TK_OR
           
 int ttype
          The terminal type of the symbol, if symbol type if SYM_TERMINAL.
 
Constructor Summary
Symbol()
          Create an empty symbol.
Symbol(int type, ExpressionNode en)
          Create an Expression token with symbol type specified as SYM_EXPRNODE, and an expression node.
Symbol(int type, int tk)
          Create a token symbol with symbol type and token type.
Symbol(int type, int tk, long val)
          Create a Number token with symbol type specified as SYM_TERMINAL, token type specified as TK_NUMBER and a value
 
Method Summary
 boolean equal(Symbol a)
           
 boolean greater(Symbol a)
           
 boolean isEOE()
           
 boolean isExpressionNode()
           
 boolean less(Symbol a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SYM_UNKNOWN

public static final int SYM_UNKNOWN
See Also:
Constant Field Values

SYM_EXPRNODE

public static final int SYM_EXPRNODE
See Also:
Constant Field Values

SYM_TERMINAL

public static final int SYM_TERMINAL
See Also:
Constant Field Values

TK_EOE

public static final int TK_EOE
See Also:
Constant Field Values

TK_NUMBER

public static final int TK_NUMBER
See Also:
Constant Field Values

TK_BRACKETL

public static final int TK_BRACKETL
See Also:
Constant Field Values

TK_BRACKETR

public static final int TK_BRACKETR
See Also:
Constant Field Values

TK_NOT

public static final int TK_NOT
See Also:
Constant Field Values

TK_AND

public static final int TK_AND
See Also:
Constant Field Values

TK_OR

public static final int TK_OR
See Also:
Constant Field Values

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 ExpressionNode enode
The reduced expression node, if symbol type if SYM_EXPRNODE.


nval

public long nval
The value of a TK_NUMBER token.

Constructor Detail

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,
              long 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,
              ExpressionNode en)
Create an Expression token with symbol type specified as SYM_EXPRNODE, and an expression node.

Method Detail

isEOE

public boolean isEOE()
Returns:
true if the symbol represents the end of an expression.

isExpressionNode

public boolean isExpressionNode()
Returns:
true if the symbol represents an expression node.

equal

public boolean equal(Symbol a)
              throws ExpressionException
Returns:
true if current symbol has equal precedence to symbol a.
Throws:
ExpressionException

less

public boolean less(Symbol a)
             throws ExpressionException
Returns:
true if current symbol has lower precedence than symbol a.
Throws:
ExpressionException

greater

public boolean greater(Symbol a)
                throws ExpressionException
Returns:
true if current symbol has higher precedence than symbol a.
Throws:
ExpressionException

toString

public String toString()
Overrides:
toString in class Object
Returns:
the string representation of the current symbol.


Copyright © 1997-2008 Aduna. All Rights Reserved.