Class BaseOperator<F extends Filter>

java.lang.Object
com.tangosol.coherence.dslquery.operator.BaseOperator<F>
Direct Known Subclasses:
AdditionOperator, AndOperator, BetweenOperator, ComparisonOperator, ContainsAllOperator, ContainsAnyOperator, ContainsOperator, DivisionOperator, InOperator, LikeOperator, MultiplicationOperator, OrOperator, SubtractionOperator, XorOperator

public abstract class BaseOperator<F extends Filter> extends Object
A base class for CohQL Operator implementations.
Since:
Coherence 12.2.1
Author:
jk 2013.12.03
  • Field Details

    • f_sSymbol

      protected final String f_sSymbol
      The symbol for this operator.
    • f_asAlias

      protected final String[] f_asAlias
      An array of optional aliases for this operator.
    • f_fConditional

      protected final boolean f_fConditional
      Flag indicating whether this operator can be used as a conditional operator, for example ==, >=, etc, as opposed to a non-conditional operator such as +, -, etc.
  • Constructor Details

    • BaseOperator

      protected BaseOperator(String sSymbol, boolean fConditional, String... asAlias)
      Create an instance of a BaseOperator with the specified symbol, conditional flag and aliases.
      Parameters:
      sSymbol - the symbol for this operator
      fConditional - a flag indicating whether this operator is conditional
      asAlias - an optional list of aliases for this operator
  • Method Details

    • getSymbol

      public String getSymbol()
      Return the symbol to use in CohQL that represents this operator.
      Returns:
      the symbol to use in CohQL that represents this operator
    • getAliases

      public String[] getAliases()
      Return the alternative symbols to use in CohQL that represent this operator.
      Returns:
      the alternative symbols to use in CohQL that represent this operator
    • makeFilter

      public F makeFilter(Term termLeft, Term termRight, TermWalker walker)
      Create a Filter for this BaseOperator using the specified left and right Terms.

      Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.

      Parameters:
      termLeft - the left term to use to build a Filter
      termRight - the right term to use to build a Filter
      walker - the TermWalker to use to process the left and right terms
      Returns:
      a Filter representing this operation.
    • makeFilter

      public F makeFilter(Object oLeft, Object oRight)
      Create a Filter for this BaseOperator using the specified left and right values.

      Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.

      Parameters:
      oLeft - the left value to use to build a Filter
      oRight - the right value to use to build a Filter
      Returns:
      a Filter representing this operation
    • makeExtractor

      public ValueExtractor makeExtractor(Term termLeft, Term termRight, TermWalker walker)
      Create a ValueExtractor for this BaseOperator using the specified left and right Terms.

      Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.

      Parameters:
      termLeft - the left term to use to build a ValueExtractor
      termRight - the right term to use to build a ValueExtractor
      walker - the TermWalker to use to process the left and right terms
      Returns:
      a ValueExtractor representing this operation
    • makeExtractor

      public ValueExtractor makeExtractor(Object oLeft, Object oRight)
      Create a ValueExtractor for this BaseOperator using the specified left and right values.

      Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.

      Parameters:
      oLeft - the left value to use to build a ValueExtractor
      oRight - the right value to use to build a ValueExtractor
      Returns:
      a ValueExtractor representing this operation
    • isConditional

      public boolean isConditional()
      Return true if this operator can be used as a conditional operator.
      Returns:
      true if this operator can be used as a conditional operator
    • addToTokenTable

      public abstract void addToTokenTable(TokenTable tokenTable)
      Add this operator to the given TokenTable. This typically means adding this operator using its symbol and also adding any aliases.
      Parameters:
      tokenTable - the TokenTable to add this operator to
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addAliases

      protected void addAliases(TokenTable tokenTable)
      Add any aliases of this operator to the specified token table.
      Parameters:
      tokenTable - the token table to add aliases to
    • unmodifiableSet

      protected static Set unmodifiableSet(Object oValue)
      Return an immutable Set accounting for the provided object being an array, a Collection or a single item in the returned Set.
      Parameters:
      oValue - either an object array, a collection or a single item to be returned as a Set
      Returns:
      a Set contained the provided object