001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026: package javax.microedition.location;
027:
028: /**
029: * This class is defined by the JSR-179 specification
030: * <em>Location API for J2ME for J2ME™.</em>
031: */
032: // JAVADOC COMMENT ELIDED
033: public class AddressInfo {
034: // JAVADOC COMMENT ELIDED
035: public final static int EXTENSION = 1;
036:
037: // JAVADOC COMMENT ELIDED
038: public final static int STREET = 2;
039:
040: // JAVADOC COMMENT ELIDED
041: public final static int POSTAL_CODE = 3;
042:
043: // JAVADOC COMMENT ELIDED
044: public final static int CITY = 4;
045:
046: // JAVADOC COMMENT ELIDED
047: public final static int COUNTY = 5;
048:
049: // JAVADOC COMMENT ELIDED
050: public final static int STATE = 6;
051:
052: // JAVADOC COMMENT ELIDED
053: public final static int COUNTRY = 7;
054:
055: // JAVADOC COMMENT ELIDED
056: public final static int COUNTRY_CODE = 8;
057:
058: // JAVADOC COMMENT ELIDED
059: public final static int DISTRICT = 9;
060:
061: // JAVADOC COMMENT ELIDED
062: public final static int BUILDING_NAME = 10;
063:
064: // JAVADOC COMMENT ELIDED
065: public final static int BUILDING_FLOOR = 11;
066:
067: // JAVADOC COMMENT ELIDED
068: public final static int BUILDING_ROOM = 12;
069:
070: // JAVADOC COMMENT ELIDED
071: public final static int BUILDING_ZONE = 13;
072:
073: // JAVADOC COMMENT ELIDED
074: public final static int CROSSING1 = 14;
075:
076: // JAVADOC COMMENT ELIDED
077: public final static int CROSSING2 = 15;
078:
079: // JAVADOC COMMENT ELIDED
080: public final static int URL = 16;
081:
082: // JAVADOC COMMENT ELIDED
083: public final static int PHONE_NUMBER = 17;
084:
085: // JAVADOC COMMENT ELIDED
086: final static int DATA_SIZE = 17;
087:
088: // JAVADOC COMMENT ELIDED
089: private String[] data = new String[DATA_SIZE];
090:
091: // JAVADOC COMMENT ELIDED
092: public AddressInfo() {
093: }
094:
095: // JAVADOC COMMENT ELIDED
096: AddressInfo(String[] data) {
097: this .data = data;
098: }
099:
100: // JAVADOC COMMENT ELIDED
101: String[] getData() {
102: return data;
103: }
104:
105: // JAVADOC COMMENT ELIDED
106: public String getField(int field) {
107: checkField(field);
108: return data[field - 1];
109: }
110:
111: // JAVADOC COMMENT ELIDED
112: private void checkField(int field) {
113: if (field < 1 || field > data.length) {
114: throw new IllegalArgumentException(
115: "Unsuported field attribute value: " + field);
116: }
117: }
118:
119: // JAVADOC COMMENT ELIDED
120: public void setField(int field, String value) {
121: checkField(field);
122: data[field - 1] = value;
123: }
124: }
|