Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_daldb / src / org / gvsig / fmap / data / feature / db / DBDataFeatureCollection.java @ 24491

History | View | Annotate | Download (1.93 KB)

1
package org.gvsig.fmap.data.feature.db;
2

    
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.Iterator;
6

    
7
import org.gvsig.fmap.dal.feature.Feature;
8
import org.gvsig.fmap.dal.feature.impl.AbstractFeatureCollection;
9

    
10
public abstract class DBDataFeatureCollection extends
11
                AbstractFeatureCollection {
12

    
13
        protected boolean isStringEmpty(String s) {
14
                return s == null || s == "";
15
        }
16

    
17
        public boolean add(Object o) {
18
                throw new UnsupportedOperationException();
19
        }
20

    
21
        public boolean remove(Object o) {
22
                throw new UnsupportedOperationException();
23
        }
24

    
25
        public boolean addAll(Collection c) {
26
                throw new UnsupportedOperationException();
27
        }
28

    
29
        public boolean removeAll(Collection c) {
30
                throw new UnsupportedOperationException();
31
        }
32

    
33
        public boolean retainAll(Collection c) {
34
                throw new UnsupportedOperationException();
35
        }
36

    
37
        public void clear() {
38
                throw new UnsupportedOperationException();
39
        }
40

    
41
        public boolean contains(Object o) {
42
                checkModified();
43
                //FIXME: Arreglar (lanzar select directamente)
44
                Iterator iterator= this.iterator();
45
                while(iterator.hasNext()){
46
                        Feature feature=(Feature)iterator.next();
47
                        if (feature.getReference().equals(((Feature)o).getReference())){
48
                                return true;
49
                        }
50
                }
51
                return false;
52
        }
53

    
54
        public Object[] toArray() {
55
                checkModified();
56
                ArrayList features= new ArrayList();
57
                Iterator iterator= this.iterator();
58
                while(iterator.hasNext()){
59
                        Feature feature=(Feature)iterator.next();
60
                        features.add(feature);
61
                }
62
                return features.toArray();
63
        }
64

    
65
        public Object[] toArray(Object[] a) {
66
                checkModified();
67
                ArrayList features= new ArrayList();
68
                Iterator iterator= this.iterator();
69
                while(iterator.hasNext()){
70
                        Feature feature=(Feature)iterator.next();
71
                        features.add(feature);
72
                }
73
                return features.toArray(a);
74
        }
75

    
76
        public boolean containsAll(Collection c) {
77
                checkModified();
78
                Iterator iter = c.iterator();
79
                while (iter.hasNext()){
80
                        if (!this.contains(iter.next())){
81
                                return false;
82
                        }
83
                }
84
                return true;
85

    
86
        }
87

    
88
}