Revision 24017 branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/impl/IndexFeatureSet.java
IndexFeatureSet.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Government (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 | 22 |
|
23 | 23 |
/* |
24 | 24 |
* AUTHORS (In addition to CIT): |
25 | 25 |
* 2008 {{Company}} {{Task}} |
26 | 26 |
*/ |
27 |
|
|
28 | 27 |
|
28 |
|
|
29 | 29 |
package org.gvsig.fmap.data.feature.impl; |
30 | 30 |
|
31 | 31 |
import java.util.Iterator; |
... | ... | |
45 | 45 |
LongList featureReferences = null; |
46 | 46 |
FeatureStoreProvider store = null; |
47 | 47 |
FeatureIndexProviderServices index = null; |
48 |
|
|
48 |
|
|
49 | 49 |
public class IndexIterator implements Iterator { |
50 | 50 |
Iterator it = null; |
51 |
|
|
51 |
|
|
52 | 52 |
public IndexIterator(Iterator it) { |
53 |
this.it = it;
|
|
53 |
this.it = it; |
|
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
public boolean hasNext() { |
... | ... | |
61 | 61 |
Object refId = it.next(); |
62 | 62 |
Feature f = null; |
63 | 63 |
try { |
64 |
FeatureData data = store.createFeatureData(index.getFeatureType(), refId);
|
|
64 |
FeatureData data = store.getFeatureData(refId);
|
|
65 | 65 |
f = index.getFeatureStore().createFeature(data); |
66 | 66 |
} catch (DataException e) { |
67 | 67 |
throw new ReadRuntimeException(index.getFeatureStore().getName(), e); |
... | ... | |
73 | 73 |
throw new UnsupportedOperationException(); |
74 | 74 |
} |
75 | 75 |
} |
76 |
|
|
76 |
|
|
77 | 77 |
public class FastIndexIterator implements Iterator { |
78 | 78 |
Iterator it = null; |
79 | 79 |
FeatureData data = null; |
80 | 80 |
Feature feat = null; |
81 |
|
|
81 |
|
|
82 | 82 |
public FastIndexIterator(Iterator it) throws DataException { |
83 |
this.it = it;
|
|
83 |
this.it = it; |
|
84 | 84 |
data = store.createFeatureData(index.getFeatureType()); |
85 | 85 |
feat = index.getFeatureStore().createFeature(data); |
86 | 86 |
} |
... | ... | |
102 | 102 |
public void remove() { |
103 | 103 |
throw new UnsupportedOperationException(); |
104 | 104 |
} |
105 |
}
|
|
106 |
|
|
105 |
} |
|
106 |
|
|
107 | 107 |
public IndexFeatureSet(FeatureIndexProviderServices index, LongList featureReferences) { |
108 | 108 |
this.featureReferences = featureReferences; |
109 | 109 |
this.store = index.getFeatureStore().getProvider(); |
110 | 110 |
this.index = index; |
111 | 111 |
} |
112 |
|
|
112 |
|
|
113 | 113 |
public boolean canFilter() { |
114 | 114 |
return false; |
115 | 115 |
} |
... | ... | |
134 | 134 |
return featureReferences.getSize(); |
135 | 135 |
} |
136 | 136 |
|
137 |
public boolean isEmpty() throws DataException {
|
|
137 |
public boolean isEmpty() throws DataException { |
|
138 | 138 |
return featureReferences.isEmpty(); |
139 | 139 |
} |
140 | 140 |
|
141 |
public Iterator iterator() throws DataException {
|
|
141 |
public Iterator iterator() throws DataException { |
|
142 | 142 |
return new IndexIterator(this.featureReferences.iterator()); |
143 | 143 |
} |
144 | 144 |
|
Also available in: Unified diff