001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.util;
016    
017    import java.util.Arrays;
018    
019    /**
020     * @author     Brian Wing Shun Chan
021     * @deprecated As of 7.0.0, replaced by {@link
022     *             com.liferay.shopping.util.StateUtil)}
023     */
024    @Deprecated
025    public class StateUtil {
026    
027            public static final String[] STATE_IDS = new String[] {
028                    "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI",
029                    "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN",
030                    "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH",
031                    "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA",
032                    "WV", "WI", "WY"
033            };
034    
035            public static final String[] STATE_IDS_ORDERED = new String[] {
036                    "AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI",
037                    "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN",
038                    "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH",
039                    "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VA", "VT", "WA",
040                    "WI", "WV", "WY"
041            };
042    
043            public static final State[] STATES = new State[] {
044                    new State("AL", "Alabama"), new State("AK", "Alaska"),
045                    new State("AZ", "Arizona"), new State("AR", "Arkansas"),
046                    new State("CA", "California"), new State("CO", "Colorado"),
047                    new State("CT", "Connecticut"), new State("DE", "Delaware"),
048                    new State("DC", "District of Columbia"), new State("FL", "Florida"),
049                    new State("GA", "Georgia"), new State("HI", "Hawaii"),
050                    new State("ID", "Idaho"), new State("IL", "Illinois"),
051                    new State("IN", "Indiana"), new State("IA", "Iowa"),
052                    new State("KS", "Kansas"), new State("KY", "Kentucky"),
053                    new State("LA", "Louisiana"), new State("ME", "Maine"),
054                    new State("MD", "Maryland"), new State("MA", "Massachusetts"),
055                    new State("MI", "Michigan"), new State("MN", "Minnesota"),
056                    new State("MS", "Mississippi"), new State("MO", "Missouri"),
057                    new State("MT", "Montana"), new State("NE", "Nebraska"),
058                    new State("NV", "Nevada"), new State("NH", "New Hampshire"),
059                    new State("NJ", "New Jersey"), new State("NM", "New Mexico"),
060                    new State("NY", "New York"), new State("NC", "North Carolina"),
061                    new State("ND", "North Dakota"), new State("OH", "Ohio"),
062                    new State("OK", "Oklahoma"), new State("OR", "Oregon"),
063                    new State("PA", "Pennsylvania"), new State("RI", "Rhode Island"),
064                    new State("SC", "South Carolina"), new State("SD", "South Dakota"),
065                    new State("TN", "Tennessee"), new State("TX", "Texas"),
066                    new State("UT", "Utah"), new State("VT", "Vermont"),
067                    new State("VA", "Virginia"), new State("WA", "Washington"),
068                    new State("WV", "West Virginia"), new State("WI", "Wisconsin"),
069                    new State("WY", "Wyoming")
070            };
071    
072            public static boolean isState(String state) {
073                    if (Arrays.binarySearch(STATES, state) >= 0) {
074                            return true;
075                    }
076                    else {
077                            return false;
078                    }
079            }
080    
081            public static boolean isStateId(String stateId) {
082                    if (Arrays.binarySearch(STATE_IDS_ORDERED, stateId) >= 0) {
083                            return true;
084                    }
085                    else {
086                            return false;
087                    }
088            }
089    
090    }