All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Zql.ZExpression

java.lang.Object
   |
   +----Zql.ZExpression

public class ZExpression
extends Object
implements ZExp
ZExpression: an SQL Expression An SQL expression is an operator and one or more operands Example: a AND b AND c -> operator = AND, operands = (a, b, c)


Constructor Index

 o ZExpression(String)
Create an SQL Expression given the operator
 o ZExpression(String, ZExp)
Create an SQL Expression given the operator and 1st operand
 o ZExpression(String, ZExp, ZExp)
Create an SQL Expression given the operator, 1st and 2nd operands

Method Index

 o addOperand(ZExp)
Add an operand to the current expression.
 o getOperand(int)
Get an operand according to its index (position).
 o getOperands()
Get this expression's operands.
 o getOperator()
Get this expression's operator.
 o nbOperands()
Get the number of operands
 o setOperands(Vector)
Set the operands list
 o toReversePolish()
String form of the current expression (reverse polish notation).
 o toString()

Constructors

 o ZExpression
 public ZExpression(String op)
Create an SQL Expression given the operator

Parameters:
op - The operator
 o ZExpression
 public ZExpression(String op,
                    ZExp o1)
Create an SQL Expression given the operator and 1st operand

Parameters:
op - The operator
o1 - The 1st operand
 o ZExpression
 public ZExpression(String op,
                    ZExp o1,
                    ZExp o2)
Create an SQL Expression given the operator, 1st and 2nd operands

Parameters:
op - The operator
o1 - The 1st operand
o2 - The 2nd operand

Methods

 o getOperator
 public String getOperator()
Get this expression's operator.

Returns:
the operator.
 o setOperands
 public void setOperands(Vector v)
Set the operands list

Parameters:
v - A vector that contains all operands (ZExp objects).
 o getOperands
 public Vector getOperands()
Get this expression's operands.

Returns:
the operands (as a Vector of ZExp objects).
 o addOperand
 public void addOperand(ZExp o)
Add an operand to the current expression.

Parameters:
o - The operand to add.
 o getOperand
 public ZExp getOperand(int pos)
Get an operand according to its index (position).

Parameters:
pos - The operand index, starting at 0.
Returns:
The operand at the specified index, null if out of bounds.
 o nbOperands
 public int nbOperands()
Get the number of operands

Returns:
The number of operands
 o toReversePolish
 public String toReversePolish()
String form of the current expression (reverse polish notation). Example: a > 1 AND b = 2 -> (AND (> a 1) (= b 2))

Returns:
The current expression in reverse polish notation (a String)
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index