/**
 * The IntegerComparator class implements the Comparator interface 
 * for Integer keys.
 *
 * @version     1.2    Nay 30, 2002
 * @author      Franck van Breugel
 * @see Comparator
 */
public class IntegerComparator implements Comparator 
{

    /** Tests if the first specified object is less than the second one. */
    public boolean isLessThan(Object a, Object b) 
    {
        return (((Integer) a).intValue() < ((Integer) b).intValue());
    }

    /** 
     * Tests if the first specified object is less than or equal to 
     * the second one. 
     */
    public boolean isLessThanOrEqualTo(Object a, Object b) 
    {
        return (isLessThan(a, b) || isEqualTo(a, b));
    }

    /** Tests if the first specified object is equal to the second one. */
    public boolean isEqualTo(Object a, Object b) 
    {
        return a.equals(b);
    }

    /** Tests if the first specified object is greater than the second one. */
    public boolean isGreaterThan(Object a, Object b) 
    {
        return isLessThan(b, a);
    }

    /** 
     * Tests if the first specified object is greater than or equal to 
     * the second one. 
     */
    public boolean isGreaterThanOrEqualTo(Object a, Object b) 
    {
        return (isGreaterThan(a, b) || isEqualTo(a, b));
    }

    /** Tests if the specified element is comparable. */
    public boolean isComparable(Object a) 
    {
        return (a instanceof Integer);
    }
}
