KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > services > sqldataloader > test > TestComparator


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.services.sqldataloader.test;
19
20 import java.util.Comparator JavaDoc;
21
22 /**
23  * <p>The purpose of this class is to provide a comparator class to construct
24  * a TreeMap instance. This class is used to test the configuration of
25  * comparator for SqlBeanDataLoader </p>
26  *
27  * Copyright 2003 Sapient
28  * @since carbon 2.0
29  * @author Akash Tayal, May 2003
30  * @version $Revision: 1.1 $($Author: ghinkl $ / $Date: 2003/09/30 02:08:19 $)
31  */

32 public class TestComparator implements Comparator JavaDoc {
33
34     /**
35      * Defies normal convention and returns positive integer, zero, or a
36      * negative integer as the the specified object o1 is greater than,
37      * equal to, or less than object o2
38      */

39     public int compare(Object JavaDoc o1, Object JavaDoc o2) throws ClassCastException JavaDoc {
40         String JavaDoc stringO1 = o1.toString();
41         String JavaDoc stringO2 = o2.toString();
42         return -1 * (stringO1.compareTo(stringO2));
43     }
44
45     public boolean equals (Object JavaDoc obj) {
46         return super.equals(obj);
47     }
48 }
Popular Tags