Class AndExpression

All Implemented Interfaces:
Expression

public final class AndExpression extends LogicalExpression

The AND logical operator chains multiple criteria together. A valid operand of an AND operator must be one of: TRUE, FALSE, and NULL. The AND operator has a higher precedence than the OR operator.

NULL represents unknown. Therefore, if one operand is NULL and the other operand is FALSE the result is FALSE, because one FALSE operand is sufficient for a FALSE result. If one operand is NULL and the other operand is either TRUE or NULL, the result is NULL (unknown).

The following table shows how the AND operator is evaluated based on its two operands:
TRUEFALSENULL
TRUE TRUE FALSE NULL
FALSE FALSE FALSE FALSE
NULL NULL FALSE NULL
BNF: conditional_term ::= conditional_term AND conditional_factor
Version:
2.5
Author:
Pascal Filion
  • Constructor Details

    • AndExpression

      public AndExpression(AbstractExpression parent)
      Creates a new AndExpression.
      Parameters:
      parent - The parent of this expression
  • Method Details

    • accept

      public void accept(ExpressionVisitor visitor)
      Visits this Expression by the given visitor.
      Parameters:
      visitor - The ExpressionVisitor to visit this object
    • getLeftExpressionQueryBNFId

      public String getLeftExpressionQueryBNFId()
      Returns the unique identifier of the JPQLQueryBNF for the left expression.
      Specified by:
      getLeftExpressionQueryBNFId in class CompoundExpression
      Returns:
      The ID of the BNF used when parsing the expression before the identifier
    • getRightExpressionQueryBNFId

      public String getRightExpressionQueryBNFId()
      Returns the unique identifier of the JPQLQueryBNF for the right expression.
      Specified by:
      getRightExpressionQueryBNFId in class CompoundExpression
      Returns:
      The ID of the BNF used when parsing the expression after the identifier
    • isParsingComplete

      protected boolean isParsingComplete(WordParser wordParser, String word, Expression expression)
      Determines whether the parsing is complete based on what is left in the given text. The text is never empty.
      Overrides:
      isParsingComplete in class LogicalExpression
      Parameters:
      wordParser - The text to parse based on the current position of the cursor
      word - The word that was retrieved from the given text, which is the first word in the text
      expression - The Expression that has already been parsed
      Returns:
      true if the text no longer can't be parsed by the current expression; false if more can be parsed