001/*
002 * Copyright 2008 Marc Wick, geonames.org
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 */
017package org.geonames;
018
019/**
020 * search criteria for web services returning postal codes
021 * 
022 * @author marc@geonames
023 * 
024 */
025public class PostalCodeSearchCriteria {
026
027        private String postalCode;
028
029        private String placeName;
030
031        private String adminCode1;
032
033        private String countryCode;
034
035        private String countryBias;
036
037        private Double latitude;
038
039        private Double longitude;
040
041        private double radius;
042
043        private Style style;
044
045        private int maxRows;
046
047        private int startRow;
048
049        private boolean isOROperator = false;
050
051        private Boolean isReduced;
052
053        private BoundingBox boundingBox;
054
055        /**
056         * @return Returns the style.
057         */
058        public Style getStyle() {
059                return style;
060        }
061
062        /**
063         * @param style
064         *            The style to set.
065         */
066        public void setStyle(Style style) {
067                this.style = style;
068        }
069
070        /**
071         * @return Returns the ISO 3166-1-alpha-2 countryCode.
072         */
073        public String getCountryCode() {
074                return countryCode;
075        }
076
077        /**
078         * @param countryCode
079         *            The ISO 3166-1-alpha-2 countryCode to set.
080         */
081        public void setCountryCode(String countryCode)
082                        throws InvalidParameterException {
083                if (countryCode != null && countryCode.length() != 2) {
084                        throw new InvalidParameterException("invalid country code "
085                                        + countryCode);
086                }
087                this.countryCode = countryCode;
088        }
089
090        /**
091         * @return Returns the latitude.
092         */
093        public Double getLatitude() {
094                return latitude;
095        }
096
097        /**
098         * @param latitude
099         *            The latitude to set.
100         */
101        public void setLatitude(double latitude) throws InvalidParameterException {
102                if (latitude > 90.0 || latitude < -90.0) {
103                        throw new InvalidParameterException("invalid latitude " + latitude);
104                }
105                this.latitude = new Double(latitude);
106        }
107
108        /**
109         * @return Returns the longitude.
110         */
111        public Double getLongitude() {
112                return longitude;
113        }
114
115        /**
116         * @param longitude
117         *            The longitude to set.
118         */
119        public void setLongitude(double longitude) throws InvalidParameterException {
120                if (longitude > 180.0 || longitude < -180.0) {
121                        throw new InvalidParameterException("invalid longitude "
122                                        + longitude);
123                }
124                this.longitude = new Double(longitude);
125        }
126
127        /**
128         * @return Returns the placeName.
129         */
130        public String getPlaceName() {
131                return placeName;
132        }
133
134        /**
135         * @param placeName
136         *            The placeName to set.
137         */
138        public void setPlaceName(String placeName) {
139                this.placeName = placeName;
140        }
141
142        /**
143         * @return Returns the postalCode.
144         */
145        public String getPostalCode() {
146                return postalCode;
147        }
148
149        /**
150         * @param postalCode
151         *            The postalCode to set.
152         */
153        public void setPostalCode(String postalCode) {
154                this.postalCode = postalCode;
155        }
156
157        /**
158         * @return the maxRows
159         */
160        public int getMaxRows() {
161                return maxRows;
162        }
163
164        /**
165         * @param maxRows
166         *            the maxRows to set
167         */
168        public void setMaxRows(int maxRows) {
169                this.maxRows = maxRows;
170        }
171
172        /**
173         * @param isOROperator
174         *            the isOROperator to set
175         */
176        public void setOROperator(boolean isOROperator) {
177                this.isOROperator = isOROperator;
178        }
179
180        /**
181         * @return the isOROperator
182         */
183        public boolean isOROperator() {
184                return isOROperator;
185        }
186
187        /**
188         * @return the adminCode1
189         */
190        public String getAdminCode1() {
191                return adminCode1;
192        }
193
194        /**
195         * @param adminCode1
196         *            the adminCode1 to set
197         */
198        public void setAdminCode1(String adminCode1) {
199                this.adminCode1 = adminCode1;
200        }
201
202        /**
203         * the radius in km to be used for reverse geocoding.
204         * 
205         * @param radius
206         *            the radius to set
207         */
208        public void setRadius(double radius) {
209                this.radius = radius;
210        }
211
212        /**
213         * @return the radius
214         */
215        public double getRadius() {
216                return radius;
217        }
218
219        /**
220         * @return the countryBias
221         */
222        public String getCountryBias() {
223                return countryBias;
224        }
225
226        /**
227         * @param countryBias
228         *            the countryBias to set
229         */
230        public void setCountryBias(String countryBias) {
231                this.countryBias = countryBias;
232        }
233
234        /**
235         * @return the startRow
236         */
237        public int getStartRow() {
238                return startRow;
239        }
240
241        /**
242         * @param startRow
243         *            the startRow to set
244         */
245        public void setStartRow(int startRow) {
246                this.startRow = startRow;
247        }
248
249        /**
250         * @return the isReduced
251         */
252        public Boolean isReduced() {
253                return isReduced;
254        }
255
256        /**
257         * @param isReduced
258         *            the isReduced to set
259         */
260        public void setIsReduced(Boolean isReduced) {
261                this.isReduced = isReduced;
262        }
263
264        /**
265         * @return the boundingBox
266         */
267        public BoundingBox getBoundingBox() {
268                return boundingBox;
269        }
270
271        /**
272         * @param boundingBox
273         *            the boundingBox to set
274         */
275        public void setBoundingBox(BoundingBox boundingBox) {
276                this.boundingBox = boundingBox;
277        }
278
279}