Class Operator

java.lang.Object
com.mckoi.database.Operator
All Implemented Interfaces:
Serializable

public abstract class Operator extends Object implements Serializable
An operator for an expression.
Author:
Tobias Downer
See Also:
  • Field Details

  • Constructor Details

    • Operator

      protected Operator(String op)
      Constructs the Operator.
    • Operator

      protected Operator(String op, int precedence)
    • Operator

      protected Operator(String op, int precedence, int set_type)
  • Method Details

    • is

      public boolean is(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 invalid input: '<' 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 invalid input: '<'>, > becomes invalid input: '<'=, 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(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 String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object ob)
      Overrides:
      equals in class Object
    • get

      public static Operator get(String op)
      Returns an Operator with the given string.