Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / FeatureSet.java @ 33205

History | View | Annotate | Download (8.07 KB)

1
package org.gvsig.fmap.dal.feature;
2

    
3
import java.util.List;
4

    
5
import org.gvsig.fmap.dal.DataSet;
6
import org.gvsig.fmap.dal.exception.DataException;
7
import org.gvsig.tools.dispose.DisposableIterator;
8
import org.gvsig.tools.dynobject.DynObjectSet;
9

    
10
/**
11
 * A FeatureSet represents a set of {@link Feature}(s). These sets of features
12
 * are typically obtained directly from a {@link FeatureStore}, or through a
13
 * {@link FeatureQuery}.
14
 * 
15
 * A FeatureSet may contain subsets of {@link Feature}(s) of different
16
 * {@link FeatureType}(s). It allows iterating and editing the features.
17
 * 
18
 * FIXME: Actualizar javadoc
19
 * 
20
 * Si el store en el que esta basado el featureset es modificado, se realiza un
21
 * update, insert, delete o se modifican los featuretype de este, el FeatureSet
22
 * quedara invalidado, y cualquier acceso a el provocara que se lance una
23
 * excepcion de tiempo de ejecucion ConcurrentModificationException.
24
 * 
25
 * Habria que indicar que invocar al metodo accept del interface visitor
26
 * provocara la excepcion ConcurrentModificationException si el store a sido
27
 * modificado desde otro punto.
28
 * 
29
 * Indicar que los metodos insert/delete/update ademas de actuar sobre el set,
30
 * actuan sobre el store en el que este esta basado, pero que no invalidan el
31
 * set sobre el que se ejecutan. No se si esto deberia hacerse mencion en esos
32
 * metodos o en la doc general del featureset.
33
 * 
34
 */
35
public interface FeatureSet extends DataSet, DynObjectSet {
36

    
37
        /**
38
         * Returns the default {@link FeatureType} of this FeatureSet.
39
         * 
40
         * @return default {@link FeatureType} in this FeatureSet.
41
         */
42
        public FeatureType getDefaultFeatureType();
43

    
44
        /**
45
         * Returns a list of the {@link FeatureType}(s) in this FeatureSet.
46
         * 
47
         * @return list of the {@link FeatureType}(s) in this FeatureSet.
48
         */
49
        public List getFeatureTypes();
50

    
51
        /**
52
         * Returns the number of {@link Feature}(s) contained in this FeatureSet.
53
         * 
54
         * The value returned by this method won't be accurate when
55
         * the FeatureStore is being edited and this set's features
56
         * are modified, added or deleted.
57
         *  
58
         * @return number of {@link Feature}(s) contained in this FeatureSet.
59
         * 
60
         * @throws DataException
61
         */
62
    public long getSize() throws DataException;
63

    
64
        /**
65
         * Returns an iterator over the elements in this collection, in the order
66
         * (if any) defined when the collection was obtained.
67
         * 
68
         * The iterator starts at the specified position in this collection. The
69
         * specified index indicates the first element that would be returned by an
70
         * initial call to the <tt>next</tt> method. An initial call to the
71
         * <tt>previous</tt> method would return the element with the specified
72
         * index minus one.
73
         * 
74
         * <p>
75
         * <em>
76
         * <strong>NOTE:</strong> if you use this method to get the iterator, you
77
         * must get sure the iterator is disposed (@see
78
         * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
79
         * while getting the data. It is recommended to use the <code>accept</code>
80
         * methods instead, which handle everything for you. 
81
         * Take into account the accept methods may use a fast iterator to 
82
         * get the features.
83
         * </em>
84
         * </p>
85
         * 
86
         * @see #accept(org.gvsig.tools.visitor.Visitor)
87
         * @see #accept(org.gvsig.tools.visitor.Visitor, long)
88
         * 
89
         * @param index
90
         *            index of first element to be returned from the iterator (by a
91
         *            call to the <tt>next</tt> method).
92
         * @return an iterator of the elements in this collection (in proper
93
         *         sequence), starting at the specified position in the collection.
94
         * @throws DataException
95
         *             if the index is out of range (index &lt; 0 || index &gt;
96
         *             size()).
97
         */
98
        DisposableIterator iterator(long index) throws DataException;
99

    
100
        /**
101
         * Returns an iterator over the elements in this collection, in the order
102
         * (if any) defined when the collection was obtained.
103
         * 
104
         * <p>
105
         * <em>
106
         * <strong>NOTE:</strong> if you use this method to get the iterator, you
107
         * must get sure the iterator is disposed (@see
108
         * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
109
         * while getting the data. It is recommended to use the <code>accept</code>
110
         * methods instead, which handle everything for you. 
111
         * Take into account the accept methods may use a fast iterator to 
112
         * get the features.
113
         * </em>
114
         * </p>
115
         * 
116
         * @see #accept(org.gvsig.tools.visitor.Visitor)
117
         * @see #accept(org.gvsig.tools.visitor.Visitor, long)
118
         * 
119
         * @return an iterator of the elements in this collection (in proper
120
         *         sequence).
121
         * 
122
         * @throws DataException
123
         */
124
        DisposableIterator iterator() throws DataException;
125

    
126
        /**
127
         * Returns a fast iterator over this set.
128
         * 
129
         * <p>
130
         * <em>
131
         * <strong>NOTE:</strong> if you use this method to get the iterator, you
132
         * must get sure the iterator is disposed (@see
133
         * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
134
         * while getting the data. It is recommended to use the <code>accept</code>
135
         * methods instead, which handle everything for you. 
136
         * Take into account the accept methods may use a fast iterator to 
137
         * get the features.
138
         * </em>
139
         * </p>
140
         * 
141
         * @see #accept(org.gvsig.tools.visitor.Visitor)
142
         * @see #accept(org.gvsig.tools.visitor.Visitor, long)
143
         * 
144
         * @return an iterator over this set.
145
         * 
146
         * @throws DataException
147
         */
148
        public DisposableIterator fastIterator() throws DataException;
149

    
150
        /**
151
         * Returns a fast iterator over this set, starting from the given index.
152
         * 
153
         * <p>
154
         * <em>
155
         * <strong>NOTE:</strong> if you use this method to get the iterator, you
156
         * must get sure the iterator is disposed (@see
157
         * {@link DisposableIterator#dispose()}) in any case, even if an error occurs
158
         * while getting the data. It is recommended to use the <code>accept</code>
159
         * methods instead, which handle everything for you. 
160
         * Take into account the accept methods may use a fast iterator to 
161
         * get the features.
162
         * </em>
163
         * </p>
164
         * 
165
         * @see #accept(org.gvsig.tools.visitor.Visitor)
166
         * @see #accept(org.gvsig.tools.visitor.Visitor, long)
167
         * 
168
         * @param index
169
         *            position in which the iterator is initially located.
170
         * 
171
         * @return an iterator initially located at the position indicated by the
172
         *         given index
173
         * 
174
         * @throws DataException
175
         */
176
        public DisposableIterator fastIterator(long index) throws DataException;
177

    
178
        /**
179
         * Indicates whether this FeatureSet contains zero features.
180
         * 
181
         * The value returned by this method won't be accurate when
182
         * the FeatureStore is being edited and this set's features
183
         * are modified, added or deleted.
184
         *  
185
         * @return true if this FeatureSet is empty, false otherwise.
186
         * 
187
         * @throws DataException
188
         */
189
        boolean isEmpty() throws DataException;
190

    
191
        /**
192
         * Updates a {@link Feature} with the given {@link EditableFeature}.<br>
193
         * 
194
         * Any {@link DisposableIterator} from this store that was still in use can will not
195
         * reflect this change.
196
         * 
197
         * @param feature
198
         *            an instance of {@link EditableFeature} with which to update
199
         *            the associated {@link Feature}.
200
         * 
201
         * @throws DataException
202
         */
203
        public void update(EditableFeature feature) throws DataException;
204

    
205
        /**
206
         * Deletes a {@link Feature} from this FeatureSet.<br>
207
         * 
208
         * Any {@link DisposableIterator} from this store that was still in use will be
209
         * <i>unsafe</i>. Use {@link DisposableIterator#remove()} instead.
210
         * 
211
         * @param feature
212
         *            the {@link Feature} to delete.
213
         * 
214
         * @throws DataException
215
         */
216
        public void delete(Feature feature) throws DataException;
217

    
218
        /**
219
         * Inserts a new feature in this set. It needs to be an instance of
220
         * {@link EditableFeature} as it has not been stored yet.<br>
221
         * 
222
         * Any {@link DisposableIterator} from this store that was still in use can will not
223
         * reflect this change.
224
         * 
225
         * @param feature
226
         *            the {@link EditableFeature} to insert.
227
         * 
228
         * @throws DataException
229
         */
230
        public void insert(EditableFeature feature) throws DataException;
231

    
232
}