01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.filter;
17:
18: import org.opengis.filter.FilterVisitor;
19: import org.opengis.filter.expression.Expression;
20:
21: public class IsNullImpl extends CompareFilterImpl implements NullFilter {
22:
23: public IsNullImpl(FilterFactory factory,
24: org.opengis.filter.expression.Expression expression) {
25: super (factory, expression, null);
26:
27: filterType = FilterType.NULL;
28: }
29:
30: public boolean evaluate(Object feature) {
31: Expression expr = getExpression();
32: Object value = eval(expr, feature);
33: return value == null;
34: }
35:
36: public Object accept(FilterVisitor visitor, Object extraData) {
37: return visitor.visit(this , extraData);
38: }
39:
40: public void nullCheckValue(org.geotools.filter.Expression nullCheck)
41: throws IllegalFilterException {
42: setExpression(nullCheck);
43: }
44:
45: public org.geotools.filter.Expression getNullCheckValue() {
46: return (org.geotools.filter.Expression) getExpression();
47: }
48:
49: public Expression getExpression() {
50: return getExpression1();
51: }
52:
53: public void setExpression(Expression expression) {
54: setExpression(expression);
55: }
56: }
|