package jds.util;
import jds.util.Comparator;
/**
* IntegerComapre - place two Integer objects in order;
* for use with book
* Classic Data Structures
* in Java
* by Timothy A Budd,
* published by Addison-Wesley, 2001.
*
* @author Timothy A. Budd
* @version 1.1 September 1999
* @see java.util.Comparator
*/
public class IntegerCompare implements jds.util.Comparator {
/**
* determine order of two integer objects; -1, 0 or 1
*
* @param left first object
* @param right second object
* @return -1 if left less than right, 0 if equal, 1 otherwise
*/
public int compare (Object left, Object right) {
Integer ileft = (Integer) left;
Integer iright = (Integer) right;
if (ileft.intValue() == iright.intValue())
return 0;
if (ileft.intValue() < iright.intValue())
return -1;
return 1;
}
}