1/* 2 * PostalCodeConstants.java 3 * Copyright (C) 2006 Amin Ahmad 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19package org.ahmadsoft.postal; 20 21/** 22 * A collection of constants used by the Postal Code Service 23 * library. Groups of constants use the commonly used 24 * <code>GroupName_MemberName</code> syntax. 25 * 26 * @author Amin Ahmad 27 */ 28public class PostalCodeConstants { 29 30 /** 31 * Indicates a <code>PostalCodeEntry</code> that holds the 32 * actual city and state for a given postal code. 33 */ 34 public static final short CITY_ACTUAL = 1; 35 /** 36 * Indicates a <code>PostalCodeEntry</code> that holds an 37 * city and state combination defined as acceptable for 38 * a given postal code by the US Postal Service. 39 */ 40 public static final short CITY_ACCEPTABLE = 2; 41 /** 42 * Indicates a <code>PostalCodeEntry</code> that holds an 43 * city and state combination defined as unacceptable for 44 * a given postal code by the US Postal Service. 45 */ 46 public static final short CITY_UNACCEPTABLE = 3; 47 /** 48 * Indicates a <code>PostalCodeEntry</code> that holds an 49 * unknown city and state combination for the given postal 50 * code. 51 */ 52 public static final short CITY_UNKNOWN = 4; 53 54 /** 55 * Returns a string representation of a given postal 56 * code constant. This method is suitable for debugging 57 * purposes, but should not be used to convert codes 58 * for an end user. 59 * 60 * @param constant the constant to represent as a string. 61 * @return a string representation of the specified constant. 62 */ 63 public static String toString(int constant) { 64 switch (constant) { 65 case CITY_ACCEPTABLE: 66 return "acceptable"; 67 case CITY_ACTUAL: 68 return "actual"; 69 case CITY_UNACCEPTABLE: 70 return "unacceptable"; 71 case CITY_UNKNOWN: 72 return "unknown"; 73 default: 74 return null; 75 } 76 } 77} 78