001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/model/filterencoding/capabilities/OperatorFactory100.java $
002: /*---------------- FILE HEADER ------------------------------------------
003:
004: This file is part of deegree.
005: Copyright (C) 2001-2008 by:
006: EXSE, Department of Geography, University of Bonn
007: http://www.giub.uni-bonn.de/deegree/
008: lat/lon GmbH
009: http://www.lat-lon.de
010:
011: This library is free software; you can redistribute it and/or
012: modify it under the terms of the GNU Lesser General Public
013: License as published by the Free Software Foundation; either
014: version 2.1 of the License, or (at your option) any later version.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: Contact:
026:
027: Andreas Poth
028: lat/lon GmbH
029: Aennchenstr. 19
030: 53115 Bonn
031: Germany
032: E-Mail: poth@lat-lon.de
033:
034: Prof. Dr. Klaus Greve
035: Department of Geography
036: University of Bonn
037: Meckenheimer Allee 166
038: 53115 Bonn
039: Germany
040: E-Mail: greve@giub.uni-bonn.de
041:
042: ---------------------------------------------------------------------------*/
043: package org.deegree.model.filterencoding.capabilities;
044:
045: import org.deegree.ogcwebservices.getcapabilities.UnknownOperatorNameException;
046:
047: /**
048: * @author mschneider
049: *
050: * TODO To change the template for this generated type comment go to Window -
051: * Preferences - Java - Code Style - Code Templates
052: */
053: public class OperatorFactory100 {
054:
055: // arithmetic operators as defined in filterCapabilities.xsd
056:
057: public final static String OPERATOR_LOGICAL_OPERATORS = "Logical_Operators";
058:
059: public final static String OPERATOR_SIMPLE_ARITHMETIC = "Simple_Arithmetic";
060:
061: public final static String OPERATOR_FUNCTIONS = "Functions";
062:
063: // comparison operators as defined in filterCapabilities.xsd
064:
065: public final static String OPERATOR_SIMPLE_COMPARISONS = "Simple_Comparisons";
066:
067: public final static String OPERATOR_LIKE = "Like";
068:
069: public final static String OPERATOR_BETWEEN = "Between";
070:
071: public final static String OPERATOR_NULL_CHECK = "NullCheck";
072:
073: // spatial operators as defined in filterCapabilities.xsd
074:
075: public final static String OPERATOR_BBOX = "BBOX";
076:
077: public final static String OPERATOR_EQUALS = "Equals";
078:
079: public final static String OPERATOR_DISJOINT = "Disjoint";
080:
081: public final static String OPERATOR_INTERSECT = "Intersect";
082:
083: public final static String OPERATOR_TOUCHES = "Touches";
084:
085: public final static String OPERATOR_CROSSES = "Crosses";
086:
087: public final static String OPERATOR_WITHIN = "Within";
088:
089: public final static String OPERATOR_CONTAINS = "Contains";
090:
091: public final static String OPERATOR_OVERLAPS = "Overlaps";
092:
093: public final static String OPERATOR_BEYOND = "Beyond";
094:
095: public final static String OPERATOR_DWITHIN = "DWithin";
096:
097: public static SpatialOperator createSpatialOperator(String name)
098: throws UnknownOperatorNameException {
099: if (name.equals(OPERATOR_BBOX) || name.equals(OPERATOR_EQUALS)
100: || name.equals(OPERATOR_DISJOINT)
101: || name.equals(OPERATOR_INTERSECT)
102: || name.equals(OPERATOR_TOUCHES)
103: || name.equals(OPERATOR_CROSSES)
104: || name.equals(OPERATOR_WITHIN)
105: || name.equals(OPERATOR_CONTAINS)
106: || name.equals(OPERATOR_OVERLAPS)
107: || name.equals(OPERATOR_BEYOND)
108: || name.equals(OPERATOR_DWITHIN)) {
109: return new SpatialOperator(name);
110: }
111: throw new UnknownOperatorNameException("'" + name
112: + "' is no known spatial operator.");
113: }
114:
115: public static Operator createComparisonOperator(String name)
116: throws UnknownOperatorNameException {
117: if (name.equals(OPERATOR_SIMPLE_COMPARISONS)
118: || name.equals(OPERATOR_LIKE)
119: || name.equals(OPERATOR_BETWEEN)
120: || name.equals(OPERATOR_NULL_CHECK)) {
121: return new Operator(name);
122: }
123: throw new UnknownOperatorNameException("'" + name
124: + "' is no known comparison operator.");
125: }
126:
127: public static Operator createArithmeticOperator(String name)
128: throws UnknownOperatorNameException {
129: if (name.equals(OPERATOR_SIMPLE_ARITHMETIC)
130: || name.equals(OPERATOR_FUNCTIONS)) {
131: return new Operator(name);
132: }
133: throw new UnknownOperatorNameException("'" + name
134: + "' is no known arithmetic operator.");
135: }
136:
137: public static Function createArithmeticFunction(String name,
138: int argumentCount) {
139: return new Function(name, argumentCount);
140: }
141: }
|