01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library 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 GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.feature;
17:
18: /**
19: * An Index is built up around a FeatureCollection, using one of the
20: * attributes in the FeatureCollection as a comparable reference.
21: * <p>
22: * An object in a column can be any object, but must either be a java
23: * base-type Object (Integer, String, Character, etc.) or implement
24: * Comparable.
25: * <p>
26: * An Index built on such a column will sort its array of object
27: * references using FeatureComparator. Implement this to perform more
28: * complex Index building.
29: *
30: * @author Ray Gallagher
31: * @author Ian Schneider
32: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/feature/FeatureIndex.java $
33: * @version $Id: FeatureIndex.java 20651 2006-07-21 07:51:54Z jgarnett $
34: */
35: public interface FeatureIndex extends CollectionListener {
36: /** Gets an "in order" Iterator of the Features as indexed.
37: * @return An Iterator of the Features within this index.
38: */
39: java.util.Iterator getFeatures();
40:
41: /** Find all the Features within this index using a key.
42: * @return A java.util.Collection containing the matches. May be empty.
43: * @throws IllegalArgumentException If the key is incompatable with this index.
44: * @param key A key to look up the Features with.
45: */
46: java.util.Collection find(Object key)
47: throws IllegalArgumentException;
48:
49: /** Find the first Feature using the given key.
50: * @return A Feature, or null if none is found.
51: * @throws IllegalArgumentException If the key is incompatable with this index.
52: * @param key A key to look up the Feature with.
53: */
54: Feature findFirst(Object key) throws IllegalArgumentException;
55: }
|