Class Condition

  • All Implemented Interfaces:
    Cloneable, XMLInterface

    public class Condition
    extends Object
    implements Cloneable, XMLInterface
    This class describes a condition in a general meaning. A condition can either be

    1) Atomic (a=10, B='aa')

    2) Composite ( NOT Condition1 AND Condition2 OR Condition3 )

    If the nr of atomic conditions is 0, the condition is atomic, otherwise it's Composit.

    Precedence doesn't exist. Conditions are evaluated in the order in which they are found.

    A condition can be negated or not.

    Since:
    8-06-2004
    Author:
    Matt
    • Method Detail

      • getObjectId

        public ObjectId getObjectId()
        Returns the database ID of this Condition if a repository was used before.
        Returns:
        the ID of the db connection.
      • setObjectId

        public void setObjectId​(ObjectId id)
        Set the database ID for this Condition in the repository.
        Parameters:
        id - The ID to set on this condition.
      • setOperator

        public void setOperator​(int operator)
      • getOperator

        public int getOperator()
      • getOperatorDesc

        public String getOperatorDesc()
      • getOperator

        public static final int getOperator​(String description)
      • getOperators

        public static final String[] getOperators()
      • getRealOperators

        public static final String[] getRealOperators()
      • setLeftValuename

        public void setLeftValuename​(String leftValuename)
      • getLeftValuename

        public String getLeftValuename()
      • getFunction

        public int getFunction()
      • setFunction

        public void setFunction​(int function)
      • getFunctionDesc

        public String getFunctionDesc()
      • getFunction

        public static final int getFunction​(String description)
      • setRightValuename

        public void setRightValuename​(String rightValuename)
      • getRightValuename

        public String getRightValuename()
      • getRightExactString

        public String getRightExactString()
      • getRightExactID

        public ObjectId getRightExactID()
        Get the id of the RightExact Value in the repository
        Returns:
        The id of the RightExact Value in the repository
      • setRightExactID

        public void setRightExactID​(ObjectId idRightExact)
        Set the database ID for the RightExact Value in the repository.
        Parameters:
        idRightExact - The ID to set on this Value.
      • isAtomic

        public boolean isAtomic()
      • isComposite

        public boolean isComposite()
      • isNegated

        public boolean isNegated()
      • setNegated

        public void setNegated​(boolean negate)
      • negate

        public void negate()
      • isEmpty

        public boolean isEmpty()
        A condition is empty when the condition is atomic and no left field is specified.
      • clearFieldPositions

        public void clearFieldPositions()
        We cache the position of a value in a row. If ever we want to change the rowtype, we need to clear these cached field positions...
      • evaluate

        public boolean evaluate​(RowMetaInterface rowMeta,
                                Object[] r)
        Evaluate the condition...
        Parameters:
        rowMeta - the row metadata
        r - the row data
        Returns:
        true if the condition evaluates to true.
      • addCondition

        public void addCondition​(Condition cb)
      • addCondition

        public void addCondition​(int idx,
                                 Condition cb)
      • removeCondition

        public void removeCondition​(int nr)
      • simplify

        public boolean simplify()
        This method moves up atomic conditions if there is only one sub-condition.
        Returns:
        true if there was a simplification.
      • nrConditions

        public int nrConditions()
      • getCondition

        public Condition getCondition​(int i)
      • setCondition

        public void setCondition​(int i,
                                 Condition subCondition)
      • toString

        public String toString​(int level,
                               boolean showNegate,
                               boolean showOperator)
      • getUsedFields

        public String[] getUsedFields()
      • getUsedFields

        public void getUsedFields​(Map<String,​String> fields)