Revision 43358 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/AbstractFeatureSet.java
AbstractFeatureSet.java | ||
---|---|---|
36 | 36 |
import org.gvsig.tools.visitor.VisitCanceledException; |
37 | 37 |
import org.gvsig.tools.visitor.Visitor; |
38 | 38 |
import org.gvsig.tools.visitor.impl.AbstractIndexedVisitable; |
39 |
import org.slf4j.Logger; |
|
40 |
import org.slf4j.LoggerFactory; |
|
39 | 41 |
|
40 | 42 |
|
41 | 43 |
public abstract class AbstractFeatureSet |
42 | 44 |
extends AbstractIndexedVisitable |
43 | 45 |
implements FeatureSet { |
44 | 46 |
|
47 |
protected static final Logger LOG = LoggerFactory.getLogger(AbstractFeatureSet.class); |
|
48 |
|
|
45 | 49 |
public abstract FeatureStore getFeatureStore(); |
46 | 50 |
|
47 |
|
|
48 | 51 |
@Override |
52 |
public final void accept(Visitor visitor, long firstValueIndex, long elements) throws BaseException { |
|
53 |
try { |
|
54 |
doAccept(visitor, firstValueIndex, elements); |
|
55 |
} catch (VisitCanceledException ex) { |
|
56 |
// The visit has been cancelled by the visitor, so we finish here. |
|
57 |
LOG.debug( |
|
58 |
"The visit, beggining on position {}, has been cancelled " |
|
59 |
+ "by the visitor: {}", new Long(firstValueIndex), |
|
60 |
visitor); |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
|
49 | 65 |
protected void doAccept(Visitor visitor, long firstValueIndex) |
50 | 66 |
throws VisitCanceledException, BaseException { |
51 |
DisposableIterator iterator = fastIterator(firstValueIndex); |
|
52 |
if( iterator != null ) { |
|
53 |
try { |
|
54 |
while (iterator.hasNext()) { |
|
55 |
Feature feature = (Feature) iterator.next(); |
|
56 |
visitor.visit(feature); |
|
57 |
} |
|
58 |
} finally { |
|
59 |
DisposeUtils.disposeQuietly(iterator); |
|
67 |
doAccept(visitor, firstValueIndex, 0); |
|
68 |
} |
|
69 |
|
|
70 |
protected void doAccept(Visitor visitor, long firstValueIndex, long elements) |
|
71 |
throws VisitCanceledException, BaseException { |
|
72 |
DisposableIterator iterator = fastIterator(firstValueIndex, elements); |
|
73 |
|
|
74 |
try { |
|
75 |
while (iterator.hasNext()) { |
|
76 |
Feature feature = (Feature) iterator.next(); |
|
77 |
visitor.visit(feature); |
|
60 | 78 |
} |
79 |
} finally { |
|
80 |
iterator.dispose(); |
|
61 | 81 |
} |
62 | 82 |
} |
63 |
|
|
83 |
|
|
64 | 84 |
@Override |
65 | 85 |
public Feature first() { |
66 | 86 |
DisposableIterator it = null; |
Also available in: Unified diff