Revision 27525 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/IndexFeatureSet.java

View differences:

IndexFeatureSet.java
36 36
import org.gvsig.fmap.dal.DataStore;
37 37
import org.gvsig.fmap.dal.exception.DataException;
38 38
import org.gvsig.fmap.dal.exception.ReadRuntimeException;
39
import org.gvsig.fmap.dal.feature.DisposableIterator;
39 40
import org.gvsig.fmap.dal.feature.EditableFeature;
40 41
import org.gvsig.fmap.dal.feature.Feature;
41 42
import org.gvsig.fmap.dal.feature.FeatureReference;
......
60 61
	FeatureIndexProviderServices index = null;
61 62
	List featureTypes = null;
62 63

  
63
	public class IndexIterator implements Iterator {
64
	public class IndexIterator implements DisposableIterator {
64 65
		Iterator it = null;
65 66

  
66 67
		public IndexIterator(Iterator it) {
......
84 85
		public void remove() {
85 86
			throw new UnsupportedOperationException();
86 87
		}
88

  
89
		public void dispose() {
90
			this.it = null;
91
		}
87 92
	}
88 93

  
89
	public class FastIndexIterator implements Iterator {
94
	public class FastIndexIterator implements DisposableIterator {
90 95
		Iterator it = null;
91 96
		DefaultFeature feature = null;
92 97

  
......
119 124
		public void remove() {
120 125
			throw new UnsupportedOperationException();
121 126
		}
127

  
128
		public void dispose() {
129
			this.it = null;
130
			this.feature = null;
131

  
132
		}
122 133
	}
123 134

  
124 135
	public IndexFeatureSet(FeatureIndexProviderServices index, LongList featureReferences) {
......
140 151
		return false;
141 152
	}
142 153

  
143
	public Iterator fastIterator(long index) throws DataException {
154
	public DisposableIterator fastIterator(long index) throws DataException {
144 155
		if (store.isEditing()) {
145 156
			return this.iterator(index);
146 157
		}
147 158
		return new FastIndexIterator(this.featureReferences.iterator(index));
148 159
	}
149 160

  
150
	public Iterator fastIterator() throws DataException {
161
	public DisposableIterator fastIterator() throws DataException {
151 162
		if (store.isEditing()) {
152 163
			return this.iterator();
153 164
		}
......
162 173
		return featureReferences.isEmpty();
163 174
	}
164 175

  
165
	public Iterator iterator() throws DataException {
176
	public DisposableIterator iterator() throws DataException {
166 177
		return new IndexIterator(this.featureReferences.iterator());
167 178
	}
168 179

  
169
	public Iterator iterator(long index) throws DataException {
180
	public DisposableIterator iterator(long index) throws DataException {
170 181
		return new IndexIterator(this.featureReferences.iterator(index));
171 182
	}
172 183

  
......
206 217
	}
207 218

  
208 219
	public void accept(Visitor visitor) throws BaseException {
209
		Iterator iterator = iterator();
220
		DisposableIterator iterator = iterator();
210 221

  
211 222
		while (iterator.hasNext()) {
212 223
			Feature feature = (Feature) iterator.next();
213 224
			visitor.visit(feature);
214 225
		}
226
		iterator.dispose();
215 227
	}
216 228

  
217 229
}

Also available in: Unified diff