root / branches / Mobile_Compatible_Hito_1 / libFMap / src-data / org / gvsig / data / vectorial / AbstractFeatureCollection.java @ 21606
History | View | Annotate | Download (1.06 KB)
1 |
package org.gvsig.data.vectorial; |
---|---|
2 |
|
3 |
import java.util.Iterator; |
4 |
|
5 |
import org.gvsig.data.IObservable; |
6 |
import org.gvsig.data.vectorial.visitor.IFeaturesVisitor; |
7 |
import org.gvsig.exceptions.BaseException; |
8 |
|
9 |
public abstract class AbstractFeatureCollection implements IFeatureCollection{ |
10 |
|
11 |
protected boolean modified=false; |
12 |
public void update(IObservable obsevable, Object notification) { |
13 |
if (modified){
|
14 |
return;
|
15 |
} |
16 |
String type = ((IFeatureStoreNotification)notification).getType();
|
17 |
if (type.equalsIgnoreCase(IFeatureStoreNotification.AFTER_INSERT) ||
|
18 |
type.equalsIgnoreCase(IFeatureStoreNotification.AFTER_DELETE) || |
19 |
type.equalsIgnoreCase(IFeatureStoreNotification.AFTER_UPDATE)){ |
20 |
modified=true;
|
21 |
} |
22 |
} |
23 |
|
24 |
/*
|
25 |
* (non-Javadoc)
|
26 |
* @see org.gvsig.data.vectorial.visitor.IFeaturesVisitable#accept(org.gvsig.data.vectorial.visitor.IFeaturesVisitor)
|
27 |
*/
|
28 |
public void accept(IFeaturesVisitor visitor) throws BaseException { |
29 |
Iterator iterator=iterator();
|
30 |
while (iterator.hasNext()) {
|
31 |
IFeature feature = (IFeature) iterator.next(); |
32 |
visitor.visit(feature); |
33 |
} |
34 |
} |
35 |
|
36 |
|
37 |
} |