Revision 19456 trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/filter/FeatureFilterParser.java
FeatureFilterParser.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.util.Map.Entry; |
4 | 4 |
|
5 |
import javax.swing.text.html.parser.Entity;
|
|
6 |
|
|
5 |
import org.gvsig.data.exception.ParseException;
|
|
6 |
import org.gvsig.data.exception.ReadException; |
|
7 | 7 |
import org.gvsig.data.vectorial.IFeature; |
8 | 8 |
import org.gvsig.data.vectorial.IFeatureType; |
9 | 9 |
import org.medfoster.sqljep.BaseJEP; |
10 |
import org.medfoster.sqljep.ParseException; |
|
11 | 10 |
|
12 |
import com.sun.org.apache.bcel.internal.generic.NEW; |
|
13 | 11 |
|
14 | 12 |
public class FeatureFilterParser extends BaseJEP { |
15 | 13 |
private IFeatureType featureType; |
16 | 14 |
private IFeature feature; |
17 | 15 |
private boolean parsed = false; |
16 |
private String expresion; |
|
18 | 17 |
|
19 | 18 |
public FeatureFilterParser(String expression,IFeatureType featureType) { |
20 | 19 |
super(expression); |
20 |
this.expresion=expression; |
|
21 | 21 |
this.featureType = featureType; |
22 | 22 |
} |
23 | 23 |
|
... | ... | |
25 | 25 |
return featureType.indexOf(fieldName); |
26 | 26 |
} |
27 | 27 |
|
28 |
public Comparable getColumnObject(int fieldPos) throws ParseException {
|
|
28 |
public Comparable getColumnObject(int fieldPos){ |
|
29 | 29 |
return (Comparable)this.feature.get(fieldPos); |
30 | 30 |
} |
31 | 31 |
|
32 |
public Entry getVariable(String arg0) throws ParseException {
|
|
32 |
public Entry getVariable(String arg0){ |
|
33 | 33 |
return new FeatureEntry(arg0); |
34 | 34 |
} |
35 | 35 |
|
36 | 36 |
|
37 |
public boolean match(IFeature feature) throws ParseException { |
|
38 |
this.feature = feature; |
|
39 |
if (!parsed){ |
|
40 |
this.parseExpression(); |
|
41 |
parsed=true; |
|
37 |
public boolean match(IFeature feature) throws ReadException{ |
|
38 |
try{ |
|
39 |
this.feature = feature; |
|
40 |
if (!parsed){ |
|
41 |
this.parseExpression(); |
|
42 |
parsed=true; |
|
43 |
} |
|
44 |
Comparable value = super.getValue(); |
|
45 |
return value.compareTo(Boolean.TRUE) == 0; |
|
46 |
} catch (org.medfoster.sqljep.ParseException e) { |
|
47 |
throw new ParseException("FeatureFilterParser",this.expresion,e); |
|
42 | 48 |
} |
43 |
Comparable value = super.getValue(); |
|
44 |
return value.compareTo(Boolean.TRUE) == 0; |
|
45 | 49 |
} |
46 | 50 |
|
47 | 51 |
private class FeatureEntry implements Entry{ |
Also available in: Unified diff