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 @ 40559

History | View | Annotate | Download (5.74 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/* gvSIG. Geographic Information System of the Valencian Government
25
*
26
* Copyright (C) 2007-2008 Infrastructures and Transports Department
27
* of the Valencian Government (CIT)
28
* 
29
* This program is free software; you can redistribute it and/or
30
* modify it under the terms of the GNU General Public License
31
* as published by the Free Software Foundation; either version 2
32
* of the License, or (at your option) any later version.
33
* 
34
* This program is distributed in the hope that it will be useful,
35
* but WITHOUT ANY WARRANTY; without even the implied warranty of
36
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37
* GNU General Public License for more details.
38
* 
39
* You should have received a copy of the GNU General Public License
40
* along with this program; if not, write to the Free Software
41
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
42
* MA  02110-1301, USA.
43
* 
44
*/
45

    
46
/*
47
* AUTHORS (In addition to CIT):
48
* 2008 {{Company}}   {{Task}}
49
*/
50
 
51

    
52
package org.gvsig.fmap.dal.feature;
53

    
54
import java.util.List;
55

    
56
import org.gvsig.fmap.dal.exception.DataException;
57
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
58

    
59

    
60
/**
61
 * This interface represents a local index on feature based data.
62
 * 
63
 * All indexes are stored in local files. Creating server 
64
 * side indexes is not supported.
65
 * 
66
 * 
67
 * @author jyarza
68
 *
69
 */
70
public interface FeatureIndex {
71
        
72
        /** Index name */
73
        public String getName();
74
        
75
        /** Attribute names */
76
        public List getAttributeNames();
77
        
78
        /** Data type */
79
        public int getDataType();
80
        
81
        /**
82
         * Inserts a Feature in the index.
83
         * The Feature must contain a column that matches this index's column (name and data type)
84
         * @param feat
85
         */
86
    public void insert(Feature feat) throws DataException;
87

    
88
        /**
89
         * Inserts a FeatureSet into this index
90
         * FeatureType is not checked so it will accept any FeatureType
91
         * as long as exists a column with a valid name
92
         */        
93
        public void insert(FeatureSet data) throws DataException;
94
        
95
        /**
96
         * Deletes a Feature in the index.
97
         * The Feature must contain a column that matches this index's column (name and data type)
98
         * @param feat
99
         */
100
    public void delete(Feature feat) throws DataException;
101

    
102
        /**
103
         * Deletes a FeatureSet from this index
104
         * FeatureType is not checked so it will accept any FeatureType
105
         * as long as exists a column with a valid name
106
         */        
107
        public void delete(FeatureSet data) throws FeatureIndexException;        
108
        
109
        /**
110
         * Returns a FeatureSet with the set of values that match the given value. 
111
         * 
112
         * @param value 
113
         *                         is the value to match.
114
         * @return
115
         *                 a FeatureSet containing the values in the index that match the given value.
116
         * 
117
         * @throws FeatureIndexException
118
         */
119
        public FeatureSet getMatchFeatureSet(Object value)
120
                        throws FeatureIndexException;
121

    
122
        /**
123
         * Returns a FeatureSet with the set of values that belong to the range defined by value1 and value2.
124
         * 
125
         * @param value1
126
         *                         range lower limit.
127
         * 
128
         * @param value2
129
         *                         range higher limit.
130
         * 
131
         * @return
132
         *                 a FeatureSet with the set of values that belong to the range defined by value1 and value2.
133
         * 
134
         * @throws FeatureIndexException
135
         */
136
        public FeatureSet getRangeFeatureSet(Object value1, Object value2)
137
                        throws FeatureIndexException;
138

    
139
        /**
140
         * Returns a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
141
         * 
142
         * @param count
143
         *                         maximum number of values that their resulting FeatureSet will return
144
         * 
145
         * @param value
146
         *                         the value around which the nearest <code>count</code> will be looked up.
147
         * 
148
         * @return
149
         *                 a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
150
         * 
151
         * @throws FeatureIndexException
152
         */
153
        public FeatureSet getNearestFeatureSet(int count, Object value)
154
                        throws FeatureIndexException;
155

    
156
        /**
157
         * Returns a FeatureSet with the set of up to <code>count</code> values whose distance to the given value
158
         * is not greater than <code>tolerance</code>
159
         * 
160
         * @param count
161
         *                         maximum number of values that their resulting FeatureSet will return
162
         * 
163
         * @param value
164
         *                         the value around which the nearest <code>count</code> will be looked up.
165
         * 
166
         * @param tolerance
167
         *                         maximum distance from the given value.
168
         * 
169
         * @return
170
         *                 a FeatureSet with the set of up to <code>count</code> values that are nearest to the given value.
171
         * 
172
         * @throws FeatureIndexException
173
         */
174
        public FeatureSet getNearestFeatureSet(int count, Object value, 
175
                        Object tolerance) throws FeatureIndexException;
176

    
177
        
178
    /**
179
     * Returns if the index is valid and might be used to get Features.
180
     * 
181
     * @return if the index is valid
182
     */
183
    public boolean isValid();
184

    
185
    /**
186
     * Returns if the index is in the process of being filled with the Features
187
     * of a store.
188
     * 
189
     * @return if the index is filling with data
190
     */
191
    public boolean isFilling();
192
}