svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.impl / src / main / java / org / gvsig / fmap / dal / feature / impl / featureset / FastDefaultIterator.java @ 40435
History | View | Annotate | Download (1.5 KB)
1 | 40435 | jjdelcerro | package org.gvsig.fmap.dal.feature.impl.featureset; |
---|---|---|---|
2 | |||
3 | import org.gvsig.fmap.dal.exception.DataException; |
||
4 | import org.gvsig.fmap.dal.feature.impl.DefaultFeature; |
||
5 | import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
||
6 | import org.gvsig.tools.exception.BaseException; |
||
7 | |||
8 | public class FastDefaultIterator extends DefaultIterator { |
||
9 | |||
10 | DefaultFeature myFeature; |
||
11 | |||
12 | public FastDefaultIterator(DefaultFeatureSet featureSet, long index) |
||
13 | throws DataException {
|
||
14 | super(featureSet);
|
||
15 | this.initializeFeature();
|
||
16 | if (index > 0) { |
||
17 | if (featureSet.provider.canIterateFromIndex()) {
|
||
18 | try {
|
||
19 | this.iterator = featureSet.provider.fastIterator(index);
|
||
20 | } catch (UnsupportedOperationException e) { |
||
21 | this.iterator = featureSet.provider.fastIterator();
|
||
22 | skypto(index); |
||
23 | } |
||
24 | } else {
|
||
25 | this.iterator = featureSet.provider.fastIterator();
|
||
26 | skypto(index); |
||
27 | } |
||
28 | } else {
|
||
29 | this.iterator = featureSet.provider.fastIterator();
|
||
30 | } |
||
31 | |||
32 | } |
||
33 | |||
34 | protected DefaultFeature createFeature(FeatureProvider fData)
|
||
35 | throws DataException {
|
||
36 | fData.setNew(false);
|
||
37 | this.myFeature.setData(fData);
|
||
38 | |||
39 | if (this.fset.transform.isEmpty()) { |
||
40 | return myFeature;
|
||
41 | } else {
|
||
42 | return (DefaultFeature) this.fset.transform.applyTransform( |
||
43 | myFeature, fset |
||
44 | .getDefaultFeatureType()); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | protected void initializeFeature() { |
||
49 | myFeature = new DefaultFeature(fset.store);
|
||
50 | } |
||
51 | |||
52 | public void remove() { |
||
53 | super.remove();
|
||
54 | this.initializeFeature();
|
||
55 | } |
||
56 | |||
57 | protected void doDispose() throws BaseException { |
||
58 | super.doDispose();
|
||
59 | myFeature = null;
|
||
60 | } |
||
61 | |||
62 | } |