private void parseRange() throws BadThresholdException {

        PushbackReader reader = new PushbackReader(new StringReader(thresholdString));

        StringBuilder currentParsedBuffer = new StringBuilder();

        byte b;

        try {
            while ((b = (byte) reader.read()) != -1) {
                currentParsedBuffer.append((char) b);
                if (b == '@') {
                    if (curState != MINVAL) {
                        throw new BadThresholdException("Unparsable threshold '" + thresholdString + "'. Error at char "
                                + currentParsedBuffer.length() + ": the '@' should not be there.");
                    }
                    negateThreshold = true;
                    continue;
                }
                if (b == ':') {

                    switch (curState) {
                    case MINVAL:
                        if (minVal == null) {
                            minVal = new BigDecimal(0);
                        }
                        curState = MAXVAL;
                        currentParsedBuffer = new StringBuilder();
                        continue;
                    case MAXVAL:
                        throw new BadThresholdException("Unparsable threshold '" + thresholdString + "'. Error at char "
                                + currentParsedBuffer.length() + ": the ':' should not be there.");
                        // m_iCurState = END;
                        // continue;
                    default:
                        curState = MAXVAL;
                    }
                }
                if (b == '~') {
                    switch (curState) {
                    case MINVAL:
                        minVal = new BigDecimal(Integer.MIN_VALUE);
                        currentParsedBuffer = new StringBuilder();
                        // m_iCurState = MAXVAL;
                        continue;
                    case MAXVAL:
                        maxVal = new BigDecimal(Integer.MAX_VALUE);
                        curState = END;
                        currentParsedBuffer = new StringBuilder();
                        continue;
                    default:
                    }

                }

                StringBuilder numberBuffer = new StringBuilder();

                // while (i < vBytes.length &&
                // Character.isDigit((char)vBytes[i]))

                do {
                    numberBuffer.append((char) b);
                } while (((b = (byte) reader.read()) != -1) && (Character.isDigit((char) b) || b == '+' || b == '-' || b == '.'));

                if (b != -1) {
                    reader.unread(b);
                }

                String numberString = numberBuffer.toString();
                if (numberString.trim().length() == 0 || "+".equals(numberString) || "-".equals(numberString)) {
                    throw new BadThresholdException("A number was expected after '" + currentParsedBuffer.toString()
                            + "', but an empty string was found");
                }

                switch (curState) {
                case MINVAL:
                    try {
                        minVal = new BigDecimal(numberString.trim());
                    } catch (NumberFormatException nfe) {
                        throw new BadThresholdException("Expected a number but found '" + numberString + "' instead [" + thresholdString + "]", nfe);
                    }
                    currentParsedBuffer = new StringBuilder();
                    continue;
                case MAXVAL:
                    try {
                        maxVal = new BigDecimal(numberString.trim());
                    } catch (NumberFormatException nfe) {
                        throw new BadThresholdException("Expected a number but found '" + numberString + "' instead", nfe);
                    }
                    currentParsedBuffer = new StringBuilder();
                    continue;
                default:
                    curState = END;
                    currentParsedBuffer = new StringBuilder();
                }
                // if (i < vBytes.length)
                // i-=2;
            }
        } catch (IOException ioe) {
            // Intentionally empty...
        }

        if (curState == MINVAL) {
            maxVal = minVal;
            minVal = new BigDecimal(0);
        }

        if (curState == MAXVAL && maxVal == null && !thresholdString.isEmpty() && thresholdString.charAt(0) == ':') {
            throw new BadThresholdException("At least one of maximum or minimum " + "value must me specified (" + thresholdString + ")");
        }

    }
private void parseRange ( ) throws BadThresholdException { PushbackReader reader = new PushbackReader ( new StringReader ( thresholdString ) ) ; StringBuilder currentParsedBuffer = new StringBuilder ( ) ; byte b ; try { while ( ( b = ( byte ) reader . read ( ) ) != - 1 ) { currentParsedBuffer . append ( ( char ) b ) ; if ( b == '@' ) { if ( curState != MINVAL ) { throw new BadThresholdException ( "Unparsable threshold '" + thresholdString + "'. Error at char " + currentParsedBuffer . length ( ) + ": the '@' should not be there." ) ; } negateThreshold = true ; continue ; } if ( b == ':' ) { switch ( curState ) { case MINVAL : if ( minVal == null ) { minVal = new BigDecimal ( 0 ) ; } curState = MAXVAL ; currentParsedBuffer = new StringBuilder ( ) ; continue ; case MAXVAL : throw new BadThresholdException ( "Unparsable threshold '" + thresholdString + "'. Error at char " + currentParsedBuffer . length ( ) + ": the ':' should not be there." ) ; default : curState = MAXVAL ; } } if ( b == '~' ) { switch ( curState ) { case MINVAL : minVal = new BigDecimal ( Integer . MIN_VALUE ) ; currentParsedBuffer = new StringBuilder ( ) ; continue ; case MAXVAL : maxVal = new BigDecimal ( Integer . MAX_VALUE ) ; curState = END ; currentParsedBuffer = new StringBuilder ( ) ; continue ; default : } } StringBuilder numberBuffer = new StringBuilder ( ) ; do { numberBuffer . append ( ( char ) b ) ; } while ( ( ( b = ( byte ) reader . read ( ) ) != - 1 ) && ( Character . isDigit ( ( char ) b ) || b == '+' || b == '-' || b == '.' ) ) ; if ( b != - 1 ) { reader . unread ( b ) ; } String numberString = numberBuffer . toString ( ) ; if ( numberString . trim ( ) . length ( ) == 0 || "+" . equals ( numberString ) || "-" . equals ( numberString ) ) { throw new BadThresholdException ( "A number was expected after '" + currentParsedBuffer . toString ( ) + "', but an empty string was found" ) ; } switch ( curState ) { case MINVAL : try { minVal = new BigDecimal ( numberString . trim ( ) ) ; } catch ( NumberFormatException nfe ) { throw new BadThresholdException ( "Expected a number but found '" + numberString + "' instead [" + thresholdString + "]" , nfe ) ; } currentParsedBuffer = new StringBuilder ( ) ; continue ; case MAXVAL : try { maxVal = new BigDecimal ( numberString . trim ( ) ) ; } catch ( NumberFormatException nfe ) { throw new BadThresholdException ( "Expected a number but found '" + numberString + "' instead" , nfe ) ; } currentParsedBuffer = new StringBuilder ( ) ; continue ; default : curState = END ; currentParsedBuffer = new StringBuilder ( ) ; } } } catch ( IOException ioe ) { } if ( curState == MINVAL ) { maxVal = minVal ; minVal = new BigDecimal ( 0 ) ; } if ( curState == MAXVAL && maxVal == null && ! thresholdString . isEmpty ( ) && thresholdString . charAt ( 0 ) == ':' ) { throw new BadThresholdException ( "At least one of maximum or minimum " + "value must me specified (" + thresholdString + ")" ) ; } }
Parses the range definition to evaluate the minimum and maximum
thresholds.

@throws BadThresholdException
-