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

History | View | Annotate | Download (4.8 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

    
25
package org.gvsig.fmap.dal.feature;
26

    
27
import java.util.List;
28

    
29
import org.gvsig.fmap.dal.exception.DataException;
30
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
31

    
32

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

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

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

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

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

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

    
150
        
151
    /**
152
     * Returns if the index is valid and might be used to get Features.
153
     * 
154
     * @return if the index is valid
155
     */
156
    public boolean isValid();
157

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