01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2002, Centre for Computational Geography
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.data.shapefile.indexed;
18:
19: import org.geotools.index.Data;
20: import java.util.Comparator;
21:
22: /**
23: * A Comparator for sortin search results in ascending record number. So we can
24: * read dbf & shape file forward only
25: *
26: * @author Tommaso Nolli
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/DataComparator.java $
28: */
29: public class DataComparator implements Comparator {
30: /**
31: * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
32: */
33: public int compare(Object o1, Object o2) {
34: Integer i1 = (Integer) ((Data) o1).getValue(0);
35: Integer i2 = (Integer) ((Data) o2).getValue(0);
36:
37: return i1.compareTo(i2);
38: }
39: }
|