001: // $HeadURL:
002: // /cvsroot/deegree/src/org/deegree/ogcwebservices/getcapabilities/Contents.java,v
003: // 1.1 2004/06/23 11:55:40 mschneider Exp $
004: /*---------------- FILE HEADER ------------------------------------------
005:
006: This file is part of deegree.
007: Copyright (C) 2001-2008 by:
008: EXSE, Department of Geography, University of Bonn
009: http://www.giub.uni-bonn.de/deegree/
010: lat/lon GmbH
011: http://www.lat-lon.de
012:
013: This library is free software; you can redistribute it and/or
014: modify it under the terms of the GNU Lesser General Public
015: License as published by the Free Software Foundation; either
016: version 2.1 of the License, or (at your option) any later version.
017:
018: This library is distributed in the hope that it will be useful,
019: but WITHOUT ANY WARRANTY; without even the implied warranty of
020: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
021: Lesser General Public License for more details.
022:
023: You should have received a copy of the GNU Lesser General Public
024: License along with this library; if not, write to the Free Software
025: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
026:
027: Contact:
028:
029: Andreas Poth
030: lat/lon GmbH
031: Aennchenstr. 19
032: 53115 Bonn
033: Germany
034: E-Mail: poth@lat-lon.de
035:
036: Prof. Dr. Klaus Greve
037: Department of Geography
038: University of Bonn
039: Meckenheimer Allee 166
040: 53115 Bonn
041: Germany
042: E-Mail: greve@giub.uni-bonn.de
043:
044:
045: ---------------------------------------------------------------------------*/
046: package org.deegree.model.filterencoding.capabilities;
047:
048: import java.util.HashMap;
049: import java.util.Map;
050:
051: /**
052: * ScalarCapabilitiesBean
053: *
054: * @author <a href="mailto:tfr@users.sourceforge.net">Torsten Friebe </a>
055: * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a>
056: *
057: * @author last edited by: $Author: apoth $
058: *
059: * @version 2.0, $Revision: 9343 $, $Date: 2007-12-27 05:30:32 -0800 (Thu, 27 Dec 2007) $
060: *
061: * @since 2.0
062: */
063: public class ScalarCapabilities {
064:
065: private boolean supportsLogicalOperators;
066:
067: /**
068: * keys are Strings (operator names), values are Operator-instances
069: */
070: private Map<String, Operator> comparisonOperators;
071:
072: /**
073: * keys are Strings (operator names), values are Operator-instances
074: */
075: private Map<String, Operator> arithmeticOperators;
076:
077: /**
078: * Creates a new <code>ScalarCapabilities</code> instance.
079: *
080: * @param supportsLogicalOperators
081: * @param comparisonOperators
082: * may be null
083: * @param arithmeticOperators
084: * may be null
085: */
086: public ScalarCapabilities(boolean supportsLogicalOperators,
087: Operator[] comparisonOperators,
088: Operator[] arithmeticOperators) {
089: this .supportsLogicalOperators = supportsLogicalOperators;
090: setComparisonOperators(comparisonOperators);
091: setArithmeticOperators(arithmeticOperators);
092: }
093:
094: /**
095: *
096: * @return
097: */
098: public boolean hasLogicalOperatorsSupport() {
099: return supportsLogicalOperators;
100: }
101:
102: /**
103: *
104: * @param supportsLogicalOperators
105: */
106: public void setLogicalOperatorsSupport(
107: boolean supportsLogicalOperators) {
108: this .supportsLogicalOperators = supportsLogicalOperators;
109: }
110:
111: /**
112: *
113: * @param comparisonOperators
114: */
115: public void setComparisonOperators(Operator[] comparisonOperators) {
116: this .comparisonOperators = new HashMap<String, Operator>();
117: for (int i = 0; i < comparisonOperators.length; i++) {
118: this .comparisonOperators.put(comparisonOperators[i]
119: .getName(), comparisonOperators[i]);
120: }
121: }
122:
123: /**
124: *
125: * @return Comparison Operators
126: */
127: public Operator[] getComparisonOperators() {
128: return comparisonOperators.values().toArray(
129: new Operator[comparisonOperators.values().size()]);
130: }
131:
132: /**
133: *
134: * @param arithmeticOperators
135: */
136: public void setArithmeticOperators(Operator[] arithmeticOperators) {
137: this .arithmeticOperators = new HashMap<String, Operator>();
138: for (int i = 0; i < arithmeticOperators.length; i++) {
139: this .arithmeticOperators.put(arithmeticOperators[i]
140: .getName(), arithmeticOperators[i]);
141: }
142: }
143:
144: /**
145: *
146: * @return Arithmetic Operators
147: */
148: public Operator[] getArithmeticOperators() {
149: return arithmeticOperators.values().toArray(
150: new Operator[arithmeticOperators.values().size()]);
151: }
152:
153: /**
154: * Returns if the given operator is supported.
155: *
156: * @param operatorName
157: * @return
158: */
159: public boolean hasComparisonOperator(String operatorName) {
160: return comparisonOperators.get(operatorName) != null ? true
161: : false;
162: }
163:
164: /**
165: * Returns if the given operator is supported.
166: *
167: * @param operatorName
168: * @return
169: */
170: public boolean hasArithmeticOperator(String operatorName) {
171: return arithmeticOperators.get(operatorName) != null ? true
172: : false;
173: }
174: }
|