KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > IntegerCompare


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util;
11
12 /**
13  * Class to compare two strings, used by SortedVector.
14  * @see org.mmbase.util.SortedVector
15  * @see org.mmbase.util.CompareInterface
16  * @deprecated Should implement java.util.Comparator, or should not exist, because this is java.lang.Integer's 'natural' order.
17  *
18  * @author Rico Jansen
19  * @version $Id: IntegerCompare.java,v 1.6 2005/10/05 10:44:00 michiel Exp $
20  */

21 public class IntegerCompare implements CompareInterface {
22
23     /**
24      * Make the comparison.
25      * The result is a negative value if the first object is 'smaller' than the second,
26      * a positive value if it is 'larger', and 0 if both objects are 'equal'.
27      * @param thisOne the first object to compare. should be a <code>Integer</code>.
28      * @param other the second object to compare. should be a <code>Integer</code>.
29      * @return the result of the comparison
30      */

31     public int compare(Object JavaDoc thisOne, Object JavaDoc other) {
32         return ((Integer JavaDoc)thisOne).intValue() - ((Integer JavaDoc)other).intValue();
33     }
34 }
35
Popular Tags