KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.calipso.reportgenerator.reportcalculator.expression;
2
3 import com.calipso.reportgenerator.reportcalculator.SharedString;
4
5 import java.util.Comparator JavaDoc;
6
7 /**
8  *
9  * User: Breto
10  * Date: Oct 23, 2003
11  * Time: 5:06:40 PM
12  *
13  */

14 public class SharedStringComparator implements Comparator JavaDoc{
15   public int compare(Object JavaDoc o1, Object JavaDoc o2) {
16     if (o2 instanceof String JavaDoc) {
17       return ((SharedString)o1).value().compareToIgnoreCase(((String JavaDoc) o2));
18     }
19     else {
20       return ((SharedString)o1).value().compareToIgnoreCase(((SharedString) o2).value());
21     }
22   }
23 }
Popular Tags