Class ArithmeticFactor

  • All Implemented Interfaces:
    Expression

    public final class ArithmeticFactor
    extends AbstractExpression
    This expression simply adds a plus or minus sign to the arithmetic primary expression.
    BNF: arithmetic_factor ::= [{+|-}] arithmetic_primary

    Since:
    2.3
    Version:
    2.5
    Author:
    Pascal Filion
    • Constructor Detail

      • ArithmeticFactor

        public ArithmeticFactor​(AbstractExpression parent,
                                java.lang.String arithmeticFactor)
        Creates a new ArithmeticFactor.
        Parameters:
        parent - The parent of this expression
        arithmeticFactor - The arithmetic factor, which is either '+' or '-'
    • Method Detail

      • getExpression

        public Expression getExpression()
        Returns the Expression representing the arithmetic primary.
        Returns:
        The expression representing the arithmetic primary
      • hasExpression

        public boolean hasExpression()
        Determines whether the arithmetic primary was parsed.
        Returns:
        true the arithmetic primary was parsed; false if nothing was parsed
      • hasSpaceAfterArithmeticOperator

        public boolean hasSpaceAfterArithmeticOperator()
        Determines whether a whitespace was parsed after the arithmetic operator.
        Returns:
        true if there was a whitespace after the arithmetic operator; false otherwise
      • isNegative

        public boolean isNegative()
        Determines if the arithmetic primary is prepended with the minus sign.
        Returns:
        true if the expression is prepended with '-'; false otherwise
      • isPositive

        public boolean isPositive()
        Determines if the arithmetic primary is prepended with the plus sign.
        Returns:
        true if the expression is prepended with '+'; false otherwise