|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object relop.Predicate
public class Predicate
Internal representation of simple SQL expressions. Operators are referenced by constants in global.AttrOperator, and operands can be constants or field numbers (i.e. if referring to an attribute).
Field Summary | |
---|---|
protected java.lang.Object |
left
Left operand. |
protected int |
ltype
Type of left operand. |
protected int |
oper
The operator. |
protected java.lang.Object |
right
Right operand. |
protected int |
rtype
Type of right operand. |
Constructor Summary | |
---|---|
Predicate(int oper,
int ltype,
java.lang.Object left,
int rtype,
java.lang.Object right)
Constructs a predicate, given the expression. |
Method Summary | |
---|---|
boolean |
evaluate(Tuple tuple)
Evaluates the predicate on the given tuple and returns true if it passes. |
protected java.lang.String |
opString(int type,
java.lang.Object operand)
Returns a string representation of an operand. |
java.lang.String |
toString()
Returns a string representation of the Predicate. |
boolean |
validate(Schema schema)
Validates AttrType.COLNAME operands against the given schema. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int oper
protected int ltype
protected java.lang.Object left
protected int rtype
protected java.lang.Object right
Constructor Detail |
---|
public Predicate(int oper, int ltype, java.lang.Object left, int rtype, java.lang.Object right)
oper
- AttrOperator constantltype
- AttrType of the fieldleft
- operand value, field number, or column namertype
- AttrType of the fieldright
- operand value, field number, or column nameMethod Detail |
---|
public boolean validate(Schema schema)
public boolean evaluate(Tuple tuple)
java.lang.IllegalStateException
- if member data lead to an invalid operationpublic java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String opString(int type, java.lang.Object operand)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |