/** Implement the Comparable interface */ public int compare(Object other) { if (!(other instanceof Number)) return 1; Number you = (Number) other; int myInt = this.intValue(); int yourInt = you.intValue(); if (myInt > yourInt) return 1; else if (myInt < yourInt) return -1; else return 0; }
/** * Get a 32 bit signed integer (int) parameter. * * @param key the key identifying the parameter * @param min the minimum allowed value, a {@link java.lang.IllegalArgumentException * IllegalArgumentException} will be thrown if this constraint is violated * @param max the maximum allowed value, a {@link java.lang.IllegalArgumentException * IllegalArgumentException} will be thrown if this constraint is violated * @param def the default value * @return the parameter value, a int parsed from the configuration data */ public final int getInt(final String key, final int min, final int max, final int def) { final String k; final Object v; final java.lang.Number number; k = Configuration.__checkKey(key); synchronized (this.m_data) { v = this.m_data.get(k); if (v == null) { return def; } number = new IntParser(min, max).parse(v); if (number != v) { this.m_data.put(key, v); } } return number.intValue(); }