MUST be called before using range's numeric values.

@param parser used to throw exception if range is invalid.
970972
public void validateRange(final LmlParser parser) {
        if (min >= max || stepSize > max - min || value < min || value > max || stepSize <= 0f) {
            parser.throwError(
                    "Range widget not properly constructed. Min value has to be lower than max and step size cannot be higher than the difference between min and max values. Initial value cannot be lower than min or higher than max value. Step size cannot be zero or negative.");
        }
    }
107465
private void configureFormatter(NumberFormat formatter) {

        formatter.setGroupingUsed(groupingUsed);
        if (isMaxIntegerDigitsSet()) {
            formatter.setMaximumIntegerDigits(maxIntegerDigits);
        }
        if (isMinIntegerDigitsSet()) {
            formatter.setMinimumIntegerDigits(minIntegerDigits);
        }
        if (isMaxFractionDigitsSet()) {
            formatter.setMaximumFractionDigits(maxFractionDigits);
        }
        if (isMinFractionDigitsSet()) {
            formatter.setMinimumFractionDigits(minFractionDigits);
        }

    }
72415
protected function checkValue(): void
    {
        if (!ctype_digit($this->value) && !is_numeric($this->value) && !empty($this->value)) {
            throw new InvalidArgumentException('NumericParser: Value must be of type numeric');
        }
    }
1353109
@ArgumentsChecked
	@Throws(IllegalNullArgumentException.class)
	public static boolean isInRange(@Nonnull final Number number, @Nonnull final BigInteger min, @Nonnull final BigInteger max) {
		Check.notNull(number, "number");
		Check.notNull(min, "min");
		Check.notNull(max, "max");

		BigInteger bigInteger = null;
		if (number instanceof Byte || number instanceof Short || number instanceof Integer || number instanceof Long) {
			bigInteger = BigInteger.valueOf(number.longValue());
		} else if (number instanceof Float || number instanceof Double) {
			bigInteger = new BigDecimal(number.doubleValue()).toBigInteger();
		} else if (number instanceof BigInteger) {
			bigInteger = (BigInteger) number;
		} else if (number instanceof BigDecimal) {
			bigInteger = ((BigDecimal) number).toBigInteger();
		} else {
			throw new IllegalNumberArgumentException("Return value is no known subclass of 'java.lang.Number': "
					+ number.getClass().getName());
		}
		return max.compareTo(bigInteger) >= 0 && min.compareTo(bigInteger) <= 0;
	}
230572
Record
parseRR(Tokenizer st, int classValue, long TTLValue)
throws IOException
{
	Name name = st.getName(zone);
	long ttl;
	int type;
	Record record;

	String s = st.getString();

	try {
		ttl = TTL.parseTTL(s);
		s = st.getString();
	}
	catch (NumberFormatException e) {
		ttl = TTLValue;
	}

	if (DClass.value(s) >= 0) {
		classValue = DClass.value(s);
		s = st.getString();
	}

	if ((type = Type.value(s)) < 0)
		throw new IOException("Invalid type: " + s);

	record = Record.fromString(name, type, classValue, ttl, st, zone);
	if (record != null)
		return (record);
	else
		throw new IOException("Parse error");
}
941954
@Override
  public void exitMaven_ranges(VersionParser.Maven_rangesContext ctx) {
    if (ctx.getChildCount() == 3) {
      IVersionRange r1 = (IVersionRange) stack.pop();
      IVersionRange r2 = (IVersionRange) stack.pop();
      stack.push(new OrRange(r2, r1));
    }
    else {
      if (strict) {
        throw new InvalidRangeRuntimeException("Cannot have an empty set range");
      }
    }
  }
987721
protected void parseRange(String range) {
        String prefix = "bytes=";
        if (!range.startsWith(prefix) || StringUtils.containsNone(range, "-")) {
            throw new IllegalArgumentException(getUsage(range));
        } else {
            // Strip the prefix and drop all but the first range (if there is a list)
            String byteRange = range.substring(prefix.length()).split(",")[0];

            try {
                // Parse out the range values
                setRangeStart(byteRange.substring(0, byteRange.indexOf("-")));
                setRangeEnd(byteRange.substring(byteRange.indexOf("-") + 1, byteRange.length()));
            } catch (NumberFormatException e) {
                throw new IllegalArgumentException(getUsage(range));
            }

            // Verify that there is either a start or end value for the range (or both)
            if (null == getRangeStart() && null == getRangeEnd()) {
                throw new IllegalArgumentException(getUsage(range));
            }
        }
    }
584027
private static void checkNumericIndex(long index) {
		if (index > Integer.MAX_VALUE) {
			throw EvaluationException.create(MSG_INDEX_EXCEEDS_MAXIMUM, index,
					Integer.MAX_VALUE);
		} else if (index < Integer.MIN_VALUE) {
			throw EvaluationException.create(MSG_INDEX_BELOW_MINIMUM, index,
					Integer.MIN_VALUE);
		}
	}
546158
public void setCurrentIndex(long curr) {
        try {
            if (curr < 0 || curr > count) {
                throw new RuntimeException(curr + " is not in the range 0 to " + count);
            }
            seek(getHeaderSize() + curr * getEntryLength());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
816882
private Integer parseIntegerFromParam(final String value, final int defaultValue) {
        try {
            return Integer.valueOf(value);
        } catch (NumberFormatException | NullPointerException e) {
            return defaultValue;
        }
    }
612338
public static void acceptsNodeMultiple(OptionParser parser) {
        parser.acceptsAll(Arrays.asList(OPT_N, OPT_NODE), "node id list")
              .withRequiredArg()
              .describedAs("node-id-list")
              .withValuesSeparatedBy(',')
              .ofType(Integer.class);
    }
14085
private static BigDecimal currentTokenAsJavaDecimal(JsonParser parser, int precision, int scale)
            throws IOException
    {
        BigDecimal result;
        switch (parser.getCurrentToken()) {
            case VALUE_NULL:
                return null;
            case VALUE_STRING:
            case FIELD_NAME:
                result = new BigDecimal(parser.getText());
                result = result.setScale(scale, HALF_UP);
                break;
            case VALUE_NUMBER_FLOAT:
            case VALUE_NUMBER_INT:
                result = parser.getDecimalValue();
                result = result.setScale(scale, HALF_UP);
                break;
            case VALUE_TRUE:
                result = BigDecimal.ONE.setScale(scale, HALF_UP);
                break;
            case VALUE_FALSE:
                result = BigDecimal.ZERO.setScale(scale, HALF_UP);
                break;
            default:
                throw new JsonCastException(format("Unexpected token when cast to DECIMAL(%s,%s): %s", precision, scale, parser.getText()));
        }

        if (result.precision() > precision) {
            // TODO: Should we use NUMERIC_VALUE_OUT_OF_RANGE instead?
            throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast input json to DECIMAL(%s,%s)", precision, scale));
        }
        return result;
    }
146969
@Override
  public void set(JsonParser parser) {
    this.parser = parser;
    if ( parser == null ) {
      content = null;
    } else if ( parser.getInputSource() instanceof InputStream ) {
      content = (InputStream) parser.getInputSource();
    }
  }
449399
public void setRange(String range) {
        String single = range.trim();
        int hyphenIndex = range.indexOf('-');

        if (hyphenIndex > 0) {
            this.start = rangeSingle(range.substring(0, hyphenIndex));
            this.end = rangeSingle(range.substring(hyphenIndex + 1));
        } else {
            int number = rangeSingle(range);
            if (number >= 0) { // first n attributes
                this.start = 0;
                this.end = number;
            } else { // last n attributes
                this.start = this.upperLimit + number > 0 ? this.upperLimit + number : 0;
                this.end = this.upperLimit - 1;
            }
        }
    }
97465
public void addRuleParserAt(IRuleParser parser, Class<? extends IRuleParser> atParser) {
        int index = getIndexOfClass(ruleParsers, atParser);
        if (index == -1) {
            throw new ParserAddException("parser " + atParser.getSimpleName() + " has not been added");
        }
        ruleParsers.remove(index);
        ruleParsers.add(index, parser);
    }
1305671
public static void acceptsZone(OptionParser parser) {
        parser.acceptsAll(Arrays.asList(OPT_Z, OPT_ZONE), "zone id")
              .withRequiredArg()
              .describedAs("zone-id")
              .ofType(Integer.class);
    }
134891
public void setRange(Annotation v) {
    if (OntRelationMention_Type.featOkTst && ((OntRelationMention_Type)jcasType).casFeat_range == null)
      jcasType.jcas.throwFeatMissing("range", "de.julielab.jules.types.OntRelationMention");
    jcasType.ll_cas.ll_setRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_range, jcasType.ll_cas.ll_getFSRef(v));}