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 */
017 package org.geonames;
018
019 /**
020 * search criteria for web services returning postal codes
021 *
022 * @author marc@geonames
023 *
024 */
025 public 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 /**
054 * @return Returns the style.
055 */
056 public Style getStyle() {
057 return style;
058 }
059
060 /**
061 * @param style
062 * The style to set.
063 */
064 public void setStyle(Style style) {
065 this.style = style;
066 }
067
068 /**
069 * @return Returns the ISO 3166-1-alpha-2 countryCode.
070 */
071 public String getCountryCode() {
072 return countryCode;
073 }
074
075 /**
076 * @param countryCode
077 * The ISO 3166-1-alpha-2 countryCode to set.
078 */
079 public void setCountryCode(String countryCode)
080 throws InvalidParameterException {
081 if (countryCode != null && countryCode.length() != 2) {
082 throw new InvalidParameterException("invalid country code "
083 + countryCode);
084 }
085 this.countryCode = countryCode;
086 }
087
088 /**
089 * @return Returns the latitude.
090 */
091 public Double getLatitude() {
092 return latitude;
093 }
094
095 /**
096 * @param latitude
097 * The latitude to set.
098 */
099 public void setLatitude(double latitude) throws InvalidParameterException {
100 if (latitude > 90.0 || latitude < -90.0) {
101 throw new InvalidParameterException("invalid latitude " + latitude);
102 }
103 this.latitude = new Double(latitude);
104 }
105
106 /**
107 * @return Returns the longitude.
108 */
109 public Double getLongitude() {
110 return longitude;
111 }
112
113 /**
114 * @param longitude
115 * The longitude to set.
116 */
117 public void setLongitude(double longitude) throws InvalidParameterException {
118 if (longitude > 180.0 || longitude < -180.0) {
119 throw new InvalidParameterException("invalid longitude "
120 + longitude);
121 }
122 this.longitude = new Double(longitude);
123 }
124
125 /**
126 * @return Returns the placeName.
127 */
128 public String getPlaceName() {
129 return placeName;
130 }
131
132 /**
133 * @param placeName
134 * The placeName to set.
135 */
136 public void setPlaceName(String placeName) {
137 this.placeName = placeName;
138 }
139
140 /**
141 * @return Returns the postalCode.
142 */
143 public String getPostalCode() {
144 return postalCode;
145 }
146
147 /**
148 * @param postalCode
149 * The postalCode to set.
150 */
151 public void setPostalCode(String postalCode) {
152 this.postalCode = postalCode;
153 }
154
155 /**
156 * @return the maxRows
157 */
158 public int getMaxRows() {
159 return maxRows;
160 }
161
162 /**
163 * @param maxRows
164 * the maxRows to set
165 */
166 public void setMaxRows(int maxRows) {
167 this.maxRows = maxRows;
168 }
169
170 /**
171 * @param isOROperator
172 * the isOROperator to set
173 */
174 public void setOROperator(boolean isOROperator) {
175 this.isOROperator = isOROperator;
176 }
177
178 /**
179 * @return the isOROperator
180 */
181 public boolean isOROperator() {
182 return isOROperator;
183 }
184
185 /**
186 * @return the adminCode1
187 */
188 public String getAdminCode1() {
189 return adminCode1;
190 }
191
192 /**
193 * @param adminCode1
194 * the adminCode1 to set
195 */
196 public void setAdminCode1(String adminCode1) {
197 this.adminCode1 = adminCode1;
198 }
199
200 /**
201 * the radius in km to be used for reverse geocoding.
202 *
203 * @param radius
204 * the radius to set
205 */
206 public void setRadius(double radius) {
207 this.radius = radius;
208 }
209
210 /**
211 * @return the radius
212 */
213 public double getRadius() {
214 return radius;
215 }
216
217 /**
218 * @return the countryBias
219 */
220 public String getCountryBias() {
221 return countryBias;
222 }
223
224 /**
225 * @param countryBias
226 * the countryBias to set
227 */
228 public void setCountryBias(String countryBias) {
229 this.countryBias = countryBias;
230 }
231
232 /**
233 * @return the startRow
234 */
235 public int getStartRow() {
236 return startRow;
237 }
238
239 /**
240 * @param startRow
241 * the startRow to set
242 */
243 public void setStartRow(int startRow) {
244 this.startRow = startRow;
245 }
246
247 /**
248 * @return the isReduced
249 */
250 public Boolean isReduced() {
251 return isReduced;
252 }
253
254 /**
255 * @param isReduced
256 * the isReduced to set
257 */
258 public void setIsReduced(Boolean isReduced) {
259 this.isReduced = isReduced;
260 }
261
262 }