Revision 27525 branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/memory/AbstractMemoryStoreProvider.java
AbstractMemoryStoreProvider.java | ||
---|---|---|
6 | 6 |
import org.gvsig.fmap.dal.DataStoreParameters; |
7 | 7 |
import org.gvsig.fmap.dal.exception.DataException; |
8 | 8 |
import org.gvsig.fmap.dal.exception.InitializeException; |
9 |
import org.gvsig.fmap.dal.feature.DisposableIterator; |
|
9 | 10 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
10 | 11 |
import org.gvsig.fmap.dal.feature.FeatureType; |
11 | 12 |
import org.gvsig.fmap.dal.feature.exception.PerformEditingException; |
... | ... | |
43 | 44 |
this.data.add(data); |
44 | 45 |
} |
45 | 46 |
|
46 |
public Iterator dataIterator() throws DataException { |
|
47 |
public DisposableIterator dataIterator() throws DataException {
|
|
47 | 48 |
this.open(); |
48 |
return this.data.iterator();
|
|
49 |
return new DelegatedDisposableIterator(this.data.iterator());
|
|
49 | 50 |
} |
50 | 51 |
|
51 |
public Iterator dataIterator(long index) throws DataException { |
|
52 |
public DisposableIterator dataIterator(long index) throws DataException {
|
|
52 | 53 |
this.open(); |
53 |
return this.data.listIterator((int) index); |
|
54 |
return new DelegatedDisposableIterator(this.data |
|
55 |
.listIterator((int) index)); |
|
54 | 56 |
} |
55 | 57 |
|
56 | 58 |
public long getDataSize() throws DataException { |
... | ... | |
90 | 92 |
|
91 | 93 |
protected abstract void initializeFeatureTypes() throws InitializeException; |
92 | 94 |
|
95 |
private class DelegatedDisposableIterator implements DisposableIterator { |
|
96 |
private Iterator delegated; |
|
97 |
|
|
98 |
public DelegatedDisposableIterator(Iterator it) { |
|
99 |
this.delegated = it; |
|
100 |
|
|
101 |
} |
|
102 |
|
|
103 |
public void dispose() { |
|
104 |
this.delegated = null; |
|
105 |
} |
|
106 |
|
|
107 |
public boolean hasNext() { |
|
108 |
return delegated.hasNext(); |
|
109 |
} |
|
110 |
|
|
111 |
public Object next() { |
|
112 |
return delegated.next(); |
|
113 |
} |
|
114 |
|
|
115 |
public void remove() { |
|
116 |
throw new UnsupportedOperationException(); |
|
117 |
} |
|
118 |
|
|
119 |
} |
|
93 | 120 |
} |
Also available in: Unified diff