Parses the range definition to evaluate the minimum and maximum
thresholds.

@throws BadThresholdException
-
491128
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 + ")");
        }

    }
407763
private static List<Integer> parseRange(String range, int max) {
        List<Integer> idx = new ArrayList<Integer>();
        String[] n = range.split(",");
        for (String s : n) {
            String[] d = s.split("-");
            int mi = Integer.parseInt(d[0]);
            if (mi < 0 || mi >= max) {
                throw new IllegalArgumentException(range);
            }
            if (d.length == 2) {
                if (d[1].equals("*")) {
                    d[1] = Integer.toString(max - 1);
                }
                int ma = Integer.parseInt(d[1]);
                if (ma <= mi || ma >= max || ma < 0) {
                    throw new IllegalArgumentException(range);
                }
                for (int i = mi; i <= ma; i++) {
                    idx.add(i);
                }
            } else {
                idx.add(mi);
            }
        }
        return idx;
    }
229671
private void validateBoundsDefinitions() {
        // bounds should be only set for numeric arguments and if the type is integer it should
        // be set to an integer
        if (!Number.class.isAssignableFrom(getUnderlyingFieldClass())) {
            if (hasBoundedRange() || hasRecommendedRange()) {
                throw new CommandLineException.CommandLineParserInternalException(
                        String.format(
                                "Min/max value ranges can only be set for numeric arguments. " +
                                "Argument --%s has a minimum or maximum value but has a non-numeric type.",
                                getLongName()));
            }
        }
        if (Integer.class.isAssignableFrom(getUnderlyingFieldClass())) {
            if (!isInfinityOrMathematicalInteger(getMaxValue())
                    || !isInfinityOrMathematicalInteger(getMinValue())
                    || !isInfinityOrMathematicalInteger(getMaxRecommendedValue())
                    || !isInfinityOrMathematicalInteger(getMinRecommendedValue())) {
                throw new CommandLineException.CommandLineParserInternalException(
                        String.format(
                                "Integer argument --%s has a minimum or maximum attribute with a non-integral value.",
                                getLongName()));
            }
        }
    }
219250
protected RangeToken parseSetOperations() throws ParseException {
		RangeToken tok = this.parseCharacterClass(false);
		int type;
		while ((type = this.read()) != T_RPAREN) {
			int ch = this.chardata;
			if (type == T_CHAR && (ch == '-' || ch == '&') || type == T_PLUS) {
				this.next();
				if (this.read() != T_LBRACKET)
					throw ex("parser.ope.1", this.offset - 1);
				RangeToken t2 = this.parseCharacterClass(false);
				if (type == T_PLUS)
					tok.mergeRanges(t2);
				else if (ch == '-')
					tok.subtractRanges(t2);
				else if (ch == '&')
					tok.intersectRanges(t2);
				else
					throw new RuntimeException("ASSERT");
			} else {
				throw ex("parser.ope.2", this.offset - 1);
			}
		}
		this.next();
		return tok;
	}
571654
public void setRange(final double MIN_VALUE, final double MAX_VALUE) {
        maxValue = MAX_VALUE;
        minValue = MIN_VALUE;
        calculate();
        validate();
        calcAngleStep();
        fireStateChanged();
    }
1089186
public VersionRange range(final int... parts) {
    checkNotNull(parts);
    checkArgument(parts.length != 0);

    StringBuilder buff = new StringBuilder()
        .append("[");

    for (int i = 0; i < parts.length; i++) {
      buff.append(parts[i]);
      if (i + 1 < parts.length) {
        buff.append(".");
      }
    }

    buff.append(",");

    for (int i = 0; i < parts.length; i++) {
      if (i + 1 == parts.length) {
        buff.append(parts[i] + 1);
      }
      else {
        buff.append(parts[i])
            .append(".");
      }
    }

    buff.append(")");

    log.trace("Range pattern: {}", buff);

    return parseRange(buff.toString());
  }
904473
def _read_range(self, start, end=0):
        
        try:
            with _handle_client_exception():
                return self._client.get_object(*self._client_args, headers=dict(
                    Range=self._http_range(start, end)))[1]

        except _ClientException as exception:
            if exception.http_status == 416:
                # EOF
                return b''
            raise
1065654
public void setThreshold(final double THRESHOLD) {
        originalThreshold = THRESHOLD;
        if (null == threshold) {
            _threshold = clamp(getMinValue(), getMaxValue(), THRESHOLD);
            fireTileEvent(RESIZE_EVENT);
        } else {
            threshold.set(THRESHOLD);
        }
    }
205390
@Override
  public void exitRange(VersionParser.RangeContext ctx)
  {
    Object o = stack.pop();
    if (o instanceof IVersion) {
      //range = new SemanticVersionRange((SemanticVersion)o);
      range = new VersionSet((IVersion) o);
    }
    else if (o instanceof IVersionRange) {
      range = (IVersionRange) o;
    }

  }
605272
public ValidatorBuilderInteger<PARENT> range(int min, int max) {

    return range(new Range<>(Integer.valueOf(min), Integer.valueOf(max)));
  }
573176
private static void checkBoundaries(final RangeConfig rc) throws RangeException {
        if (rc.isNegativeInfinity()) {
            // No other checks necessary. Negative infinity is less than any
            // number
            return;
        }

        if (rc.isPositiveInfinity()) {
            // No other checks necessary. Positive infinity is greater than any
            // number
            return;
        }

        if (rc.getLeftBoundary().compareTo(rc.getRightBoundary()) > 0) {
            throw new RangeException("Left boundary must be less than right boundary (left:" + rc.getLeftBoundary() + ", right:"
                    + rc.getRightBoundary() + ")");
        }
    }
274923
private void parseMaxPersist(Map<Object, Object> props) {
        // -1 means unlimited
        // 0..1 means 1
        // X means X
        Object value = props.get(HttpConfigConstants.PROPNAME_MAX_PERSIST);
        if (null != value) {
            try {
                this.maxPersistRequest = minLimit(convertInteger(value), HttpConfigConstants.MIN_PERSIST_REQ);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Config: Max persistent requests is " + getMaximumPersistentRequests());
                }
            } catch (NumberFormatException nfe) {
                FFDCFilter.processException(nfe, getClass().getName() + ".parseMaxPersist", "1");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Config: Invalid max persistent requests; " + value);
                }
            }
        }
    }
554237
public static void AssertSliceInRange(int sliceSize) throws ParamException {
        int maxSliceSize = 10 * 1024 * 1024; // 10MB
        int minSliceSize = 64 * 1024; // 64KB
        if (sliceSize > maxSliceSize || sliceSize < minSliceSize) {
            throw new ParamException("sliceSize legal value is [64KB, 100MB]");
        }
    }
1348283
private static short rangeCheck(short value) throws NumberFormatException {
        if (value < MIN_VALUE || value > MAX_VALUE)
            throw new NumberFormatException("Value is out of range : " + value);

        return value;
    }
57707
public static boolean isValid(Range range) {
        if (range == null) {
            return false;
        }
        
        double min = range.getMinimum().doubleValue();
        double max = range.getMaximum().doubleValue();
        
        return min != max && !Double.isNaN(min) && !Double.isInfinite(min) &&
                !Double.isNaN(max) && !Double.isInfinite(max);
    }
183294
function getThreshold(threshold) {
			if (min > threshold) {
				threshold = min;
			} else if (max < threshold) {
				threshold = max;
			}

			return translate(threshold, 0, 1);
		}
651017
private static void checkPreconditions(final int min, final int max) {
        if( min > max ) {
            throw new IllegalArgumentException(String.format("max (%d) should not be < min (%d)", max, min));
        }
        
        if( min < 0 ) {
            throw new IllegalArgumentException(String.format("min length (%d) should not be < 0", min));
        }
    }