01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-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: * Created on 23 October 2002, 17:19
17: */
18: package org.geotools.filter;
19:
20: /**
21: * Abstract filter implementation provides or and and methods for child filters
22: * to use.
23: *
24: * @author Ian Turton, CCG
25: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/filter/AbstractFilterImpl.java $
26: * @version $Id: AbstractFilterImpl.java 26598 2007-08-19 20:50:52Z jdeolive $
27: */
28: public abstract class AbstractFilterImpl extends
29: org.geotools.filter.AbstractFilter {
30:
31: protected AbstractFilterImpl(FilterFactory factory) {
32: super (factory);
33: }
34:
35: /**
36: * Default implementation for OR - should be sufficient for most filters.
37: *
38: * @param filter Parent of the filter: must implement GMLHandlerGeometry.
39: *
40: * @return ORed filter.
41: */
42: public Filter or(org.opengis.filter.Filter filter) {
43: try {
44: return (Filter) factory.or(this , filter);
45: } catch (IllegalFilterException ife) {
46: return (Filter) filter;
47: }
48: }
49:
50: /**
51: * Default implementation for AND - should be sufficient for most filters.
52: *
53: * @param filter Parent of the filter: must implement GMLHandlerGeometry.
54: *
55: * @return ANDed filter.
56: */
57: public Filter and(org.opengis.filter.Filter filter) {
58: try {
59: return (Filter) factory.and(this , filter);
60: } catch (IllegalFilterException ife) {
61: return (Filter) filter;
62: }
63: }
64:
65: /**
66: * Default implementation for NOT - should be sufficient for most filters.
67: *
68: * @return NOTed filter.
69: */
70: public Filter not() {
71: try {
72: return (Filter) factory.not(this );
73: } catch (IllegalFilterException ife) {
74: return this;
75: }
76: }
77: }
|