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