Revision 20467
trunk/libraries/libDataSourceBaseDrivers/src/org/gvsig/data/datastores/vectorial/file/dbf/DBFFeatureCollectionBitSet.java | ||
---|---|---|
4 | 4 |
import java.util.BitSet; |
5 | 5 |
import java.util.Collection; |
6 | 6 |
import java.util.Iterator; |
7 |
import java.util.NoSuchElementException; |
|
7 | 8 |
|
8 | 9 |
import org.gvsig.data.ComplexObservable; |
9 | 10 |
import org.gvsig.data.exception.ReadException; |
... | ... | |
140 | 141 |
|
141 | 142 |
private class DBFBitSetIterator implements Iterator{ |
142 | 143 |
private BitSet bs; |
143 |
private int i=0;
|
|
144 |
private int current=-1;
|
|
144 | 145 |
public DBFBitSetIterator(BitSet bitSet){ |
145 | 146 |
this.bs=bitSet; |
146 | 147 |
} |
147 | 148 |
public boolean hasNext() { |
148 |
i=bs.nextSetBit(i); |
|
149 |
return (i >= 0); |
|
149 |
return (bs.nextSetBit(current+1) >= 0); |
|
150 | 150 |
} |
151 | 151 |
|
152 |
|
|
152 | 153 |
public Object next() { |
153 | 154 |
DBFFeature feature=null; |
155 |
if (!this.hasNext()){ |
|
156 |
throw new NoSuchElementException(); |
|
157 |
} |
|
158 |
|
|
159 |
current = bs.nextSetBit(current+1); |
|
160 |
|
|
154 | 161 |
try { |
155 |
feature = new DBFFeature(featureType,store,i);
|
|
162 |
feature = new DBFFeature(featureType,store,current);
|
|
156 | 163 |
} catch (ReadException e) { |
157 | 164 |
throw new RuntimeException(e); |
158 | 165 |
} |
Also available in: Unified diff