Class NumberToken

  • All Implemented Interfaces:
    java.io.Serializable

    public class NumberToken
    extends Token
    Represent numbers.
    Author:
    Richard Morris
    See Also:
    Serialized Form
    • Constructor Detail

      • NumberToken

        public NumberToken​(java.lang.String source,
                           java.lang.Object value)
                    throws ParseException
        Construct a number token.
        Parameters:
        source - text of the input matched
        value - value of the object
        Throws:
        ParseException - on syntax error
    • Method Detail

      • getValue

        public java.lang.Object getValue()
        Gets the value of the object.
        Returns:
        A Double or other object containing the value.
      • isNumber

        public boolean isNumber()
        Overrides:
        isNumber in class Token
      • isImplicitMulRhs

        public boolean isImplicitMulRhs()
        Whether numbers can appear on the rhs of implicit multiplication 'x 2'.
        Overrides:
        isImplicitMulRhs in class Token
        Returns:
        true