Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / feature / FeatureIndex.java @ 40435

History | View | Annotate | Download (4.8 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
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 for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22

    
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 {{Company}}   {{Task}}
26
*/
27
 
28

    
29
package org.gvsig.fmap.dal.feature;
30

    
31
import java.util.List;
32

    
33
import org.gvsig.fmap.dal.exception.DataException;
34
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
35

    
36

    
37
/**
38
 * This interface represents a local index on feature based data.
39
 * 
40
 * All indexes are stored in local files. Creating server 
41
 * side indexes is not supported.
42
 * 
43
 * 
44
 * @author jyarza
45
 *
46
 */
47
public interface FeatureIndex {
48
        
49
        /** Index name */
50
        public String getName();
51
        
52
        /** Attribute names */
53
        public List getAttributeNames();
54
        
55
        /** Data type */
56
        public int getDataType();
57
        
58
        /**
59
         * Inserts a Feature in the index.
60
         * The Feature must contain a column that matches this index's column (name and data type)
61
         * @param feat
62
         */
63
    public void insert(Feature feat) throws DataException;
64

    
65
        /**
66
         * Inserts a FeatureSet into this index
67
         * FeatureType is not checked so it will accept any FeatureType
68
         * as long as exists a column with a valid name
69
         */        
70
        public void insert(FeatureSet data) throws DataException;
71
        
72
        /**
73
         * Deletes a Feature in the index.
74
         * The Feature must contain a column that matches this index's column (name and data type)
75
         * @param feat
76
         */
77
    public void delete(Feature feat) throws DataException;
78

    
79
        /**
80
         * Deletes a FeatureSet from this index
81
         * FeatureType is not checked so it will accept any FeatureType
82
         * as long as exists a column with a valid name
83
         */        
84
        public void delete(FeatureSet data) throws FeatureIndexException;        
85
        
86
        /**
87
         * Returns a FeatureSet with the set of values that match the given value. 
88
         * 
89
         * @param value 
90
         *                         is the value to match.
91
         * @return
92
         *                 a FeatureSet containing the values in the index that match the given value.
93
         * 
94
         * @throws FeatureIndexException
95
         */
96
        public FeatureSet getMatchFeatureSet(Object value)
97
                        throws FeatureIndexException;
98

    
99
        /**
100
         * Returns a FeatureSet with the set of values that belong to the range defined by value1 and value2.
101
         * 
102
         * @param value1
103
         *                         range lower limit.
104
         * 
105
         * @param value2
106
         *                         range higher limit.
107
         * 
108
         * @return
109
         *                 a FeatureSet with the set of values that belong to the range defined by value1 and value2.
110
         * 
111
         * @throws FeatureIndexException
112
         */
113
        public FeatureSet getRangeFeatureSet(Object value1, Object value2)
114
                        throws FeatureIndexException;
115

    
116
        /**
117
         * Returns a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
118
         * 
119
         * @param count
120
         *                         maximum number of values that their resulting FeatureSet will return
121
         * 
122
         * @param value
123
         *                         the value around which the nearest <code>count</code> will be looked up.
124
         * 
125
         * @return
126
         *                 a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
127
         * 
128
         * @throws FeatureIndexException
129
         */
130
        public FeatureSet getNearestFeatureSet(int count, Object value)
131
                        throws FeatureIndexException;
132

    
133
        /**
134
         * Returns a FeatureSet with the set of up to <code>count</code> values whose distance to the given value
135
         * is not greater than <code>tolerance</code>
136
         * 
137
         * @param count
138
         *                         maximum number of values that their resulting FeatureSet will return
139
         * 
140
         * @param value
141
         *                         the value around which the nearest <code>count</code> will be looked up.
142
         * 
143
         * @param tolerance
144
         *                         maximum distance from the given value.
145
         * 
146
         * @return
147
         *                 a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
148
         * 
149
         * @throws FeatureIndexException
150
         */
151
        public FeatureSet getNearestFeatureSet(int count, Object value, 
152
                        Object tolerance) throws FeatureIndexException;
153

    
154
        
155
    /**
156
     * Returns if the index is valid and might be used to get Features.
157
     * 
158
     * @return if the index is valid
159
     */
160
    public boolean isValid();
161

    
162
    /**
163
     * Returns if the index is in the process of being filled with the Features
164
     * of a store.
165
     * 
166
     * @return if the index is filling with data
167
     */
168
    public boolean isFilling();
169
}