Documentation of 'com.jstatcom.parser.NumberRangeParser' Java class
NumberRangeParser
com.jstatcom.parser

Class NumberRangeParser

  • All Implemented Interfaces:
    NumberRangeParserConstants


    public class NumberRangeParser
    extends java.lang.Object
    implements NumberRangeParserConstants
    Parser that assembles number range objects from an input string, for example

    [1,100]
    (-Infinity,Infinity)
    [lowerBound",20)
    (-Infinity, upperBound]
    [1.2,1.2]
    (-1.3e-2,1.3e-2)

    One can use the parser via the parseString, parseStringToRange methods. If parseString is used, symbol names may be specified for the bounds. Valid symbol names start with a non digit and may contain letters, digits and "_" . Reserved keywords are ("+" | "-")? "Infinity" and "NaN" (all case insensititve). If a bound is specified as "NaN", the parser throws an exception. If parseStringToRange is used, only numbers are allowed for the bounds, not symbol names.

    The parser has been generated with javacc.
    See Also:
    NumberRange
    • Constructor Detail

      • NumberRangeParser

        public NumberRangeParser()
        Default constructor.
      • NumberRangeParser

        public NumberRangeParser(java.io.InputStream stream)
      • NumberRangeParser

        public NumberRangeParser(java.io.Reader stream)
    • Method Detail

      • disable_tracing

        public final void disable_tracing()
      • enable_tracing

        public final void enable_tracing()
      • generateParseException

        public final ParseException generateParseException()
      • getNextToken

        public final Token getNextToken()
      • getToken

        public final Token getToken(int index)
      • parseString

        public java.lang.Object[] parseString(java.lang.String inputString)
                                       throws ParseException,
                                              TokenMgrError
        Reinitializes this engine and parses an input string. In this parser run numbers as well as symbol names are allowed for the bounds specification.

        Valid symbol names start with a non digit and may contain letters, digits and "_" . Reserved keywords are ("+" | "-")? "Infinity" and "NaN" (all case insensititve). If a bound is specified as "NaN", the parser throws an exception, because this stands usually for missing value.

        Parameters:
        inputString - the string to parse
        Returns:
        object array (3 x 1) if parser and assembly where successful,
        object[0] = lower bound
        object[1] = upper bound
        object[2] = range type
        Throws:
        ParseException - if parsing failed, contains error description
        TokenMgrError - if tokenizing failed, contains error description
      • parseStringToRange

        public NumberRange parseStringToRange(java.lang.String inputString)
                                       throws ParseException,
                                              TokenMgrError
        Reinitializes this engine and parses an input string. In this parser run, symbol names are not allowed for the bounds specification, only numbers with ("+" | "-")? "Infinity" as possible identifiers.
        Parameters:
        inputString - the string to parse
        Returns:
        a number range if parser and assembly where successful
        Throws:
        ParseException - if parsing failed, contains error description
        TokenMgrError - if tokenizing failed, contains error description
      • ReInit

        public void ReInit(java.io.InputStream stream)
      • ReInit

        public void ReInit(java.io.Reader stream)
      • toeval

        public final int toeval()
                         throws ParseException
        Parses the expression allowing for symbol names as well as numbers.
        Throws:
        ParseException
      • toeval_noSymbols

        public final int toeval_noSymbols()
                                   throws ParseException
        Parses the expression allowing only for numbers.
        Throws:
        ParseException

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.