001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.filter.v1_0;
017:
018: import javax.xml.namespace.QName;
019: import org.opengis.filter.BinaryComparisonOperator;
020: import org.opengis.filter.BinaryLogicOperator;
021: import org.opengis.filter.Filter;
022: import org.opengis.filter.FilterFactory;
023: import org.opengis.filter.Not;
024: import org.opengis.filter.spatial.BinarySpatialOperator;
025: import org.geotools.filter.v1_1.OGC;
026: import org.geotools.xml.AbstractComplexBinding;
027: import org.geotools.xml.ElementInstance;
028: import org.geotools.xml.Node;
029:
030: /**
031: * Binding object for the element http://www.opengis.net/ogc:Not.
032: *
033: * <p>
034: * <pre>
035: * <code>
036: * <xsd:element name="Not" substitutionGroup="ogc:logicOps" type="ogc:UnaryLogicOpType"/>
037: *
038: * </code>
039: * </pre>
040: * </p>
041: *
042: * @generated
043: */
044: public class OGCNotBinding extends AbstractComplexBinding {
045: FilterFactory filterfactory;
046:
047: public OGCNotBinding(FilterFactory filterfactory) {
048: this .filterfactory = filterfactory;
049: }
050:
051: /**
052: * @generated
053: */
054: public QName getTarget() {
055: return OGC.Not;
056: }
057:
058: /**
059: * <!-- begin-user-doc -->
060: * <!-- end-user-doc -->
061: *
062: * @generated modifiable
063: */
064: public Class getType() {
065: return Not.class;
066: }
067:
068: /**
069: * <!-- begin-user-doc -->
070: * <!-- end-user-doc -->
071: *
072: * @generated modifiable
073: */
074: public Object parse(ElementInstance instance, Node node,
075: Object value) throws Exception {
076: Filter filter = (Filter) node.getChildValue(Filter.class);
077:
078: return filterfactory.not(filter);
079: }
080:
081: public Object getProperty(Object object, QName name)
082: throws Exception {
083: Not not = (Not) object;
084:
085: if (OGC.spatialOps.equals(name)
086: && not.getFilter() instanceof BinarySpatialOperator) {
087: return not.getFilter();
088: }
089:
090: if (OGC.logicOps.equals(name)
091: && not.getFilter() instanceof BinaryLogicOperator) {
092: return not.getFilter();
093: }
094:
095: if (OGC.comparisonOps.equals(name)
096: && not.getFilter() instanceof BinaryComparisonOperator) {
097: return not.getFilter();
098: }
099:
100: return null;
101: }
102: }
|