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 / FeatureSelection.java @ 46672

History | View | Annotate | Download (9.51 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
 * AUTHORS (In addition to CIT):
26
 * 2008 {DiSiD Technologies}  {Implement data selection}
27
 */
28
package org.gvsig.fmap.dal.feature;
29

    
30
import java.util.Collections;
31
import java.util.Iterator;
32
import java.util.List;
33
import javax.json.JsonArray;
34
import javax.json.JsonArrayBuilder;
35
import org.gvsig.fmap.dal.DataStore;
36
import org.gvsig.fmap.dal.exception.DataException;
37
import org.gvsig.tools.dispose.DisposableIterator;
38
import org.gvsig.tools.dynobject.DynObjectSet;
39
import org.gvsig.tools.exception.BaseException;
40
import org.gvsig.tools.lang.Cloneable;
41
import org.gvsig.tools.observer.Observable;
42
import org.gvsig.tools.observer.Observer;
43
import org.gvsig.tools.persistence.PersistentState;
44
import org.gvsig.tools.persistence.exception.PersistenceException;
45
import org.gvsig.tools.visitor.Visitor;
46

    
47
/**
48
 * Manages a selection of Features.
49
 * 
50
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
51
 */
52
public interface FeatureSelection extends FeatureReferenceSelection,
53
                FeatureSet, Cloneable {
54

    
55
    public static final FeatureSelection EMTPY_FEATURE_SELECTION = new FeatureSelection() {
56
        @Override
57
        public boolean select(Feature feature) {
58
            return false;
59
        }
60

    
61
        @Override
62
        public boolean deselect(Feature feature) {
63
            return false;
64
        }
65

    
66
        @Override
67
        public boolean select(FeatureSet features) throws DataException {
68
            return false;
69
        }
70

    
71
        @Override
72
        public boolean deselect(FeatureSet features) throws DataException {
73
            return false;
74
        }
75

    
76
        @Override
77
        public boolean isSelected(Feature feature) {
78
            return false;
79
        }
80

    
81
        @Override
82
        public boolean isAvailable() {
83
            return true;
84
        }
85

    
86
        @Override
87
        public boolean select(FeatureReference reference) {
88
            return false;
89
        }
90

    
91
        @Override
92
        public boolean deselect(FeatureReference reference) {
93
            return false;
94
        }
95

    
96
        @Override
97
        public void selectAll() throws DataException {
98
        }
99

    
100
        @Override
101
        public void deselectAll() throws DataException {
102
        }
103

    
104
        @Override
105
        public boolean isSelected(FeatureReference reference) {
106
            return false;
107
        }
108

    
109
        @Override
110
        public void reverse() {
111
        }
112

    
113
        @Override
114
        public long getSelectedCount() {
115
            return 0;
116
        }
117

    
118
        @Override
119
        public Iterator<FeatureReference> referenceIterator() {
120
            return Collections.EMPTY_LIST.iterator();
121
        }
122

    
123
        @Override
124
        public Iterable<FeatureReference> referenceIterable() {
125
            return Collections.EMPTY_LIST;
126
        }
127

    
128
        @Override
129
        public boolean isFromStore(DataStore store) {
130
            return false;
131
        }
132

    
133
        @Override
134
        public void accept(Visitor visitor) throws BaseException {
135
        }
136

    
137
        @Override
138
        public void dispose() {
139
        }
140

    
141
        @Override
142
        public void update(Observable observable, Object notification) {
143
        }
144

    
145
        @Override
146
        public void addObserver(Observer o) {
147
        }
148

    
149
        @Override
150
        public void deleteObserver(Observer o) {
151
        }
152

    
153
        @Override
154
        public void deleteObservers() {
155
        }
156

    
157
        @Override
158
        public void disableNotifications() {
159
        }
160

    
161
        @Override
162
        public void enableNotifications() {
163
        }
164

    
165
        @Override
166
        public void beginComplexNotification() {
167
        }
168

    
169
        @Override
170
        public void endComplexNotification() {
171
        }
172

    
173
        @Override
174
        public void saveToState(PersistentState state) throws PersistenceException {
175
        }
176

    
177
        @Override
178
        public void loadFromState(PersistentState state) throws PersistenceException {
179
        }
180

    
181
        @Override
182
        public FeatureType getDefaultFeatureType() {
183
            return null;
184
        }
185

    
186
        @Override
187
        public List getFeatureTypes() {
188
            return null;
189
        }
190

    
191
        @Override
192
        public long getSize() throws DataException {
193
            return 0;
194
        }
195

    
196
        @Override
197
        public DisposableIterator iterator(long index) throws DataException {
198
            return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
199
        }
200

    
201
        @Override
202
        public DisposableIterator iterator(long index, long elements) throws DataException {
203
            return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
204
        }
205

    
206
        @Override
207
        public DisposableFeatureSetIterable iterable() {
208
            return DisposableFeatureSetIterable.EMPTY_DISPOSABLE_FEATURE_SET_ITERABLE;
209
        }
210

    
211
        @Override
212
        public DisposableFeatureSetIterable iterable(boolean disposeFeatureSet) {
213
            return DisposableFeatureSetIterable.EMPTY_DISPOSABLE_FEATURE_SET_ITERABLE;
214
        }
215

    
216
        @Override
217
        public DisposableIterator fastIterator() throws DataException {
218
            return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
219
        }
220

    
221
        @Override
222
        public DisposableIterator fastIterator(long index) throws DataException {
223
            return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
224
        }
225

    
226
        @Override
227
        public DisposableIterator fastIterator(long index, long elemets) throws DataException {
228
            return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
229
        }
230

    
231
        @Override
232
        public Feature first() {
233
            return null;
234
        }
235

    
236
        @Override
237
        public void update(EditableFeature feature) throws DataException {
238
        }
239

    
240
        @Override
241
        public void commitChanges() throws DataException {
242
        }
243

    
244
        @Override
245
        public void delete(Feature feature) throws DataException {
246
        }
247

    
248
        @Override
249
        public void insert(EditableFeature feature) throws DataException {
250
        }
251

    
252
        @Override
253
        public DynObjectSet getDynObjectSet() {
254
            return null;
255
        }
256

    
257
        @Override
258
        public DynObjectSet getDynObjectSet(boolean fast) {
259
            return null;
260
        }
261

    
262
        @Override
263
        public void accept(Visitor visitor, long firstValueIndex) throws BaseException {
264
        }
265

    
266
        @Override
267
        public void accept(Visitor visitor, long firstValueIndex, long elements) throws BaseException {
268
        }
269

    
270
        @Override
271
        public FeatureStore getFeatureStore() {
272
            return null;
273
        }
274

    
275
        @Override
276
        public JsonArray toJSON() {
277
            return null;
278
        }
279

    
280
        @Override
281
        public JsonArray toJson() {
282
            return null;
283
        }
284

    
285
        @Override
286
        public JsonArrayBuilder toJsonBuilder() {
287
            return null;
288
        }
289

    
290
        @Override
291
        public long size64() {
292
            return 0;
293
        }
294

    
295
        @Override
296
        public int size() {
297
            return 0;
298
        }
299

    
300
        @Override
301
        public boolean isEmpty() {
302
            return false;
303
        }
304

    
305
        @Override
306
        public DisposableIterator<Feature> iterator() {
307
            return DisposableIterator.EMPTY_DISPOSABLE_ITERATOR;
308
        }
309

    
310
        @Override
311
        public Object clone() throws CloneNotSupportedException {
312
            return this;
313
        }
314
        
315
        
316
    };
317
    
318
    /**
319
     * Adds a feature to the selection.
320
     * 
321
     * @param feature
322
     *            the selected feature
323
     * @return true if the feature was not selected before selecting it
324
     */
325
    boolean select(Feature feature);
326

    
327
    /**
328
     * Removes a feature from the selection.
329
     * 
330
     * @param feature
331
     *            the deselected feature
332
     * @return true if the feature was selected before deselecting it
333
     */
334
    boolean deselect(Feature feature);
335

    
336
    /**
337
     * Adds a DataSet of features to the selection.
338
     * 
339
     * @param features
340
     *            the selected features
341
     * @return true if any of the feature was not selected before selecting it
342
     * @throws DataException
343
     *             if there is an error reading the FeatureSet values
344
     */
345
    boolean select(FeatureSet features) throws DataException;
346

    
347
    /**
348
     * Removes a DataSet of features from the selection.
349
     * 
350
     * @param features
351
     *            the deselected features
352
     * @return true if any of the features was selected before deselecting it
353
     * @throws DataException
354
     *             if there is an error reading the FeatureSet values
355
     */
356
    boolean deselect(FeatureSet features) throws DataException;
357

    
358
    /**
359
     * Returns if a feature is selected.
360
     * 
361
     * @param feature
362
     *            to check
363
     * @return if it is selected
364
     */
365
    boolean isSelected(Feature feature);
366
    
367
    @Override
368
    boolean isAvailable();
369
}