KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > util > IndexComparator


1 /**
2  * com.mckoi.util.IndexComparator 01 Jul 2000
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * Version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License Version 2 for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * Version 2 along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * Change Log:
21  *
22  *
23  */

24
25 package com.mckoi.util;
26
27 /**
28  * A comparator that is used within BlockIntegerList that compares two int
29  * values which are indices to data that is being compared. For example, we
30  * may have an BlockIntegerList that contains indices to cells in the column
31  * of a table. To make a sorted list, we use this comparator to lookup the
32  * index values in the list for sorting and searching.
33  *
34  * @author Tobias Downer
35  */

36
37 public interface IndexComparator {
38
39   /**
40    * Returns > 0 if the value pointed to by index1 is greater than 'val',
41    * or < 0 if the value pointed to by index 1 is less than 'val'. If the
42    * indexed value is equal to 'val', it returns 0.
43    */

44   int compare(int index1, Object JavaDoc val);
45
46   /**
47    * Returns >0 if the value pointed to by index1 is greater than the value
48    * pointed to by index2, or &tl; 0 if the value pointed to by index 1 is less
49    * than the value pointed to by index 2. If the indexed value's are equal,
50    * it returns 0.
51    */

52   int compare(int index1, int index2);
53
54 }
55
Popular Tags