All Implemented Interfaces:
Expression
Direct Known Subclasses:
AdditionExpression, DivisionExpression, MultiplicationExpression, SubtractionExpression

public abstract class ArithmeticExpression extends CompoundExpression
This expression represents an arithmetic expression, which means the first and second expressions are aggregated with an arithmetic sign.
Since:
2.3
Version:
2.5
See Also:
  • Constructor Details

    • ArithmeticExpression

      protected ArithmeticExpression(AbstractExpression parent, String identifier)
      Creates a new ArithmeticExpression.
      Parameters:
      parent - The parent of this expression
      identifier - The arithmetic sign
  • Method Details

    • findQueryBNF

      public JPQLQueryBNF findQueryBNF(Expression expression)
      Description copied from interface: Expression
      Retrieves the JPQLQueryBNF that represents the fragment of this Expression that was used when parsing the given Expression.
      Specified by:
      findQueryBNF in interface Expression
      Overrides:
      findQueryBNF in class CompoundExpression
      Parameters:
      expression - The Expression that is a descendant of this one
      Returns:
      The JPQLQueryBNF that was used to parse the given expression
    • getArithmeticSign

      public final String getArithmeticSign()
      Returns the arithmetic sign this expression is actually representing.
      Returns:
      The single character value of the arithmetic sign
    • getLeftExpressionQueryBNFId

      public String getLeftExpressionQueryBNFId()
      Description copied from class: CompoundExpression
      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
    • getQueryBNF

      public final JPQLQueryBNF getQueryBNF()
      Description copied from interface: Expression
      Returns the BNF of this Expression.
      Returns:
      The JPQLQueryBNF, which represents the grammar of this Expression
    • getRightExpressionQueryBNFId

      public final String getRightExpressionQueryBNFId()
      Description copied from class: CompoundExpression
      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)
      Description copied from class: AbstractExpression
      Determines whether the parsing is complete based on what is left in the given text. The text is never empty.
      Overrides:
      isParsingComplete in class AbstractExpression
      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
    • parseIdentifier

      protected final String parseIdentifier(WordParser wordParser)
      Description copied from class: CompoundExpression
      Parses the identifier of this expression.
      Specified by:
      parseIdentifier in class CompoundExpression
      Parameters:
      wordParser - The WordParser containing the text to parse, which starts with the identifier
      Returns:
      The identifier for this expression