01: /**
02: * com.mckoi.util.IndexComparator 01 Jul 2000
03: *
04: * Mckoi SQL Database ( http://www.mckoi.com/database )
05: * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * 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: */package com.mckoi.util;
24:
25: /**
26: * A comparator that is used within BlockIntegerList that compares two int
27: * values which are indices to data that is being compared. For example, we
28: * may have an BlockIntegerList that contains indices to cells in the column
29: * of a table. To make a sorted list, we use this comparator to lookup the
30: * index values in the list for sorting and searching.
31: *
32: * @author Tobias Downer
33: */
34:
35: public interface IndexComparator {
36:
37: /**
38: * Returns > 0 if the value pointed to by index1 is greater than 'val',
39: * or < 0 if the value pointed to by index 1 is less than 'val'. If the
40: * indexed value is equal to 'val', it returns 0.
41: */
42: int compare(int index1, Object val);
43:
44: /**
45: * Returns >0 if the value pointed to by index1 is greater than the value
46: * pointed to by index2, or &tl; 0 if the value pointed to by index 1 is less
47: * than the value pointed to by index 2. If the indexed value's are equal,
48: * it returns 0.
49: */
50: int compare(int index1, int index2);
51:
52: }
|