KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > reportcalculator > expression > SharedIntegerComparator


1 package com.calipso.reportgenerator.reportcalculator.expression;
2
3 import com.calipso.reportgenerator.reportcalculator.SharedInteger;
4
5 import java.util.Comparator JavaDoc;
6
7 /**
8  *
9  * User: soliveri
10  * Date: Jan 5, 2004
11  * Time: 4:28:32 PM
12  *
13  */

14
15 public class SharedIntegerComparator implements Comparator JavaDoc {
16
17   public int compare(Object JavaDoc o1, Object JavaDoc o2) {
18     if(o2 instanceof String JavaDoc) {
19       SharedInteger integer = SharedInteger.newFrom(Integer.valueOf(o2.toString()));
20       return ((SharedInteger)o1).compareTo(integer);
21     } else {
22       return ((SharedInteger)o1).compareTo(o2);
23     }
24   }
25
26 }
27
Popular Tags