Package com.mckoi.database
Class Operator
- java.lang.Object
-
- com.mckoi.database.Operator
-
- All Implemented Interfaces:
java.io.Serializable
public abstract class Operator extends java.lang.Object implements java.io.Serializable
An operator for an expression.- Author:
- Tobias Downer
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object ob)
abstract TObject
eval(TObject ob1, TObject ob2, GroupResolver group, VariableResolver resolver, QueryContext context)
static Operator
get(java.lang.String op)
Returns an Operator with the given string.Operator
getSubQueryForm(int type)
Returns the ANY or ALL form of this operator.Operator
getSubQueryForm(java.lang.String type_str)
Same as above only it handles the type as a string.Operator
inverse()
Returns the inverse operator of this operator.boolean
is(java.lang.String given_op)
Returns true if this operator is equal to the operator string.boolean
isCondition()
boolean
isLogical()
boolean
isMathematical()
boolean
isNot()
boolean
isNotInversible()
Returns true if this operator is not inversible.boolean
isPattern()
boolean
isSubQuery()
boolean
isSubQueryForm(int type)
Given a parameter of either NONE, ANY, ALL or SINGLE, this returns true if this operator is of the given type.int
precedence()
TType
returnTType()
The type of object this Operator evaluates to.Operator
reverse()
Returns an Operator that is the reverse of this Operator.java.lang.String
toString()
-
-
-
Field Detail
-
NONE
public static final int NONE
The ANY and ALL enumerator.- See Also:
- Constant Field Values
-
ANY
public static final int ANY
The ANY and ALL enumerator.- See Also:
- Constant Field Values
-
ALL
public static final int ALL
The ANY and ALL enumerator.- See Also:
- Constant Field Values
-
-
Method Detail
-
is
public boolean is(java.lang.String given_op)
Returns true if this operator is equal to the operator string.
-
eval
public abstract TObject eval(TObject ob1, TObject ob2, GroupResolver group, VariableResolver resolver, QueryContext context)
-
precedence
public int precedence()
-
isCondition
public boolean isCondition()
-
isMathematical
public boolean isMathematical()
-
isPattern
public boolean isPattern()
-
isLogical
public boolean isLogical()
-
isNot
public boolean isNot()
-
isSubQuery
public boolean isSubQuery()
-
reverse
public Operator reverse()
Returns an Operator that is the reverse of this Operator. This is used for reversing a conditional expression. eg. 9 > id becomes id < 9.
-
isNotInversible
public boolean isNotInversible()
Returns true if this operator is not inversible.
-
inverse
public Operator inverse()
Returns the inverse operator of this operator. For example, = becomes <>, > becomes <=, AND becomes OR.
-
isSubQueryForm
public boolean isSubQueryForm(int type)
Given a parameter of either NONE, ANY, ALL or SINGLE, this returns true if this operator is of the given type.
-
getSubQueryForm
public Operator getSubQueryForm(int type)
Returns the ANY or ALL form of this operator.
-
getSubQueryForm
public Operator getSubQueryForm(java.lang.String type_str)
Same as above only it handles the type as a string.
-
returnTType
public TType returnTType()
The type of object this Operator evaluates to.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object ob)
- Overrides:
equals
in classjava.lang.Object
-
get
public static Operator get(java.lang.String op)
Returns an Operator with the given string.
-
-