de.fzi.XPath
Class Expr

java.lang.Object
  |
  +--de.fzi.XPath.Expr
Direct Known Subclasses:
FilterExpr, FunctionCall, Literal, LocationPath, NaryExpr, Number, Variable

public class Expr
extends java.lang.Object

Class Expr correspons to XPath expression in general. It is a base class for other types of expressions.


Field Summary
static int ADD_OP
          + (addition) operator code.
static int AND_OP
          and operator code.
static int DIV_OP
          div (division) operator code.
static int EQ_OP
          = (equal) operator code.
static int GT_OP
          > (greater-than) operator code.
static int GTE_OP
          >= (greater-than or equal) operator code.
static int LT_OP
          < (less-than) operator code.
static int LTE_OP
          <= (less-than or equal) operator code.
static int MOD_OP
          mod (modula) operator code.
static int MUL_OP
          * (multiplication) operator code.
static int NEQ_OP
          != (not equal) operator code.
static int NOP_OP
          No operator code.
static int OR_OP
          or operator code.
static int SUB_OP
          - (substraction) operator code.
static int U_OP
          | (union) operator code.
 
Constructor Summary
Expr()
           
 
Method Summary
 boolean getNegative()
          Returns true if this expression is negative.
 int getOperator()
          Returns operator code of this expression.
 java.lang.String getOperatorAsString()
          Returns operator of this expression in string representation.
static java.lang.String getOperatorName(int operator)
          Returns string representation of given Operator.
 boolean getPositive()
          Returns true if this expression is positive.
 void setOperator(int operator)
          Sets operator code of this expression.
 void setPositive(boolean thepositive)
          Sets the sign of the expression.
 java.lang.String toString()
          Returns string representation of expression.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOP_OP

public static final int NOP_OP
No operator code.

OR_OP

public static final int OR_OP
or operator code.

AND_OP

public static final int AND_OP
and operator code.

EQ_OP

public static final int EQ_OP
= (equal) operator code.

NEQ_OP

public static final int NEQ_OP
!= (not equal) operator code.

LT_OP

public static final int LT_OP
< (less-than) operator code.

LTE_OP

public static final int LTE_OP
<= (less-than or equal) operator code.

GT_OP

public static final int GT_OP
> (greater-than) operator code.

GTE_OP

public static final int GTE_OP
>= (greater-than or equal) operator code.

ADD_OP

public static final int ADD_OP
+ (addition) operator code.

SUB_OP

public static final int SUB_OP
- (substraction) operator code.

MUL_OP

public static final int MUL_OP
* (multiplication) operator code.

DIV_OP

public static final int DIV_OP
div (division) operator code.

MOD_OP

public static final int MOD_OP
mod (modula) operator code.

U_OP

public static final int U_OP
| (union) operator code.
Constructor Detail

Expr

public Expr()
Method Detail

setPositive

public void setPositive(boolean thepositive)
Sets the sign of the expression.
Parameters:
thepositive - if true, expression will become positive, otherwise - negative.

getPositive

public boolean getPositive()
Returns true if this expression is positive.
Returns:
Returns true if this expression is positive. Otherwise returns false.
See Also:
getNegative()

getNegative

public boolean getNegative()
Returns true if this expression is negative.
Returns:
Returns true if this expression is negative. Otherwise returns false.
See Also:
getPositive()

toString

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

setOperator

public void setOperator(int operator)
Sets operator code of this expression.
Parameters:
operator - code of operator (one of CODE_OP fields of this class) that precedes this exception.
For example, if in an expression we have
-a + b * - c
- will be the sign of expression a, + will be the operator of expression b, * will be the operator of expression c, AND - will be the sign of expression c.
See Also:
setPositive(boolean), getPositive(), getNegative()

getOperator

public int getOperator()
Returns operator code of this expression.
Returns:
Returns code of operator preceding this expression (one of CODE_OP fields of this class).

getOperatorAsString

public java.lang.String getOperatorAsString()
Returns operator of this expression in string representation.
Returns:
Returns string representing the operator preceding this expression (one ofCODE_OP fields of this class).

getOperatorName

public static java.lang.String getOperatorName(int operator)
Returns string representation of given Operator.
Parameters:
Operator - Operator code.
Returns:
Returns string representing given Operator or "" if Operator is not defined.