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

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

public class ExpressionNode
extends Object

A reduced expression node in an operator-precedence parsing tree.


Field Summary
protected  ExpressionNode _node1
          Expression node 1 contained in the current expression node.
protected  ExpressionNode _node2
          Expression node 2 contained in the current expression node.
protected  String _nval
          Constant contained in the current expression node.
protected  int _operator
          One of Symbol.TK_AND, Symbol.TK_OR, Symbol.TK_NOT.
 int etype
          Expression node type.
 
Constructor Summary
ExpressionNode()
          Create a default empty expression node.
 
Method Summary
protected  void _pushExpression(ExpressionNode n)
          Pushes an expression node into the expression node.
protected  void _pushNumber(long nval)
          Pushes a const into the expression node.
protected  void _pushOperator(int operator)
          Pushes a function into the expression node.
 boolean eval(HashSet value)
          Evaluate the expression node.
 void push(Symbol sym)
          Pushes a symbol into the expression node.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

etype

public int etype
Expression node type.


_node1

protected ExpressionNode _node1
Expression node 1 contained in the current expression node. It is valid when the type of current expression node is one of the following: EXPNODE_NODE, EXPNODE_UNARYFUNC and EXPNODE_BINFUNC.


_node2

protected ExpressionNode _node2
Expression node 2 contained in the current expression node. It is valid when the type of current expression node is EXPNODE_BINFUNC.


_nval

protected String _nval
Constant contained in the current expression node. It is valid when the type of current expression node is EXPNODE_CONST.


_operator

protected int _operator
One of Symbol.TK_AND, Symbol.TK_OR, Symbol.TK_NOT.

Constructor Detail

ExpressionNode

public ExpressionNode()
Create a default empty expression node.

Method Detail

push

public void push(Symbol sym)
          throws ExpressionException
Pushes a symbol into the expression node. It will dispatch corresponding operation depending on the type of input symbol.

Throws:
ExpressionException

_pushExpression

protected void _pushExpression(ExpressionNode n)
                        throws ExpressionException
Pushes an expression node into the expression node.

Throws:
ExpressionException

_pushOperator

protected void _pushOperator(int operator)
                      throws ExpressionException
Pushes a function into the expression node.

Throws:
ExpressionException

_pushNumber

protected void _pushNumber(long nval)
                    throws ExpressionException
Pushes a const into the expression node.

Throws:
ExpressionException

eval

public boolean eval(HashSet value)
             throws ExpressionException
Evaluate the expression node.

Throws:
ExpressionException

toString

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


Copyright © 1997-2008 Aduna. All Rights Reserved.