dateformatzonedata.java
来自「This is a resource based on j2me embedde」· Java 代码 · 共 957 行 · 第 1/3 页
JAVA
957 行
/* * * @(#)DateFormatZoneData.java 1.29 06/10/11 * * Portions Copyright 2000-2008 Sun Microsystems, Inc. All Rights * Reserved. Use is subject to license terms. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. *//* * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved * * The original version of this source code and documentation * is copyrighted and owned by Taligent, Inc., a wholly-owned * subsidiary of IBM. These materials are provided under terms * of a License Agreement between Taligent and Sun. This technology * is protected by multiple US and International patents. * * This notice and attribution to Taligent may not be removed. * Taligent is a registered trademark of Taligent, Inc. * */package sun.text.resources;import java.util.ResourceBundle;import java.util.Enumeration;import java.util.Hashtable;import java.util.Vector;/** * Supplement package private date-time formatting zone data for DateFormat. * DateFormatData used in DateFormat will be initialized by loading the data * from LocaleElements and DateFormatZoneData resources. The zone data are * represented with the following form: * {ID, new String[] {ID, long zone string, short zone string, long daylight * string, short daylight string, representative city of zone}}, where ID is * NOT localized, but is used to look up the localized timezone data * internally. Localizers can localize any zone strings except * for the ID of the timezone. * Also, localizer should not touch "localPatternChars" entry. * * The <CODE>DateFormatZoneData</CODE> bundles of all locales must extend * this base class. This class implements similar to * <CODE>ListResourceBundle</CODE>, except that it preserves the order of * the keys that it obtained from <CODE>getContents</CODE> and return through * <CODE>getKeys</CODE>. As in <CODE>ListResourceBundle</CODE>, * <CODE>getKeys</CODE> appends keys from the parent bundle's * <CODE>getKeys</CODE> to this bundle's keys unless they duplicate * one of this bundle's keys. * * @see ListResourceBundle * @see Format * @see DateFormatData * @see LocaleElements * @see SimpleDateFormat * @see TimeZone * @version 1.29, 10/11/06 * @author Chen-Lieh Huang */// ROOT DateFormatZoneData//public class DateFormatZoneData extends ResourceBundle{ private static final String LOCALPATTERNCHARS = "localPatternChars"; /** * Override ResourceBundle. Same semantics. */ public Object handleGetObject(String key) { if (lookup == null) { loadLookup(); } if (LOCALPATTERNCHARS.equals(key)) { return lookup.get(key); } String[] contents = (String [])lookup.get(key); if (contents == null) { return null; } int clen = contents.length; String[] tmpobj = new String[clen+1]; tmpobj[0] = key; for (int i = 0; i < clen; i++) { tmpobj[i+1] = contents[i]; } return tmpobj; } /** * Implementation of ResourceBundle.getKeys. Unlike the implementation in * <CODE>ListResourceBundle</CODE>, this implementation preserves * the order of keys obtained from <CODE>getContents</CODE>. */ public Enumeration getKeys() { if (lookup == null) { loadLookup(); } Enumeration result = null; if (parent != null) { final Enumeration myKeys = keys.elements(); final Enumeration parentKeys = parent.getKeys(); result = new Enumeration() { public boolean hasMoreElements() { if (temp == null) { nextElement(); } return (temp != null); } public Object nextElement() { Object returnVal = temp; if (myKeys.hasMoreElements()) { temp = myKeys.nextElement(); } else { temp = null; while ((temp == null) && (parentKeys.hasMoreElements())) { temp = parentKeys.nextElement(); if (lookup.containsKey(temp)) temp = null; } } return returnVal; } Object temp = null; }; } else { result = keys.elements(); } return result; } /** * Create hashtable and key vector while loading resources. */ private synchronized void loadLookup() { if (lookup != null) { return; } Object[][] contents = getContents(); Hashtable temp = new Hashtable(contents.length); Vector tempVec = new Vector(contents.length); for (int i = 0; i < contents.length; ++i) { temp.put(contents[i][0],contents[i][1]); tempVec.add(contents[i][0]); } keys = tempVec; lookup = temp; } Hashtable lookup = null; Vector keys = null; /** * Overrides ListResourceBundle */ public Object[][] getContents() { String ACT[] = new String[] {"Acre Time", "ACT", "Acre Summer Time", "ACST"}; String ADELAIDE[] = new String[] {"Central Standard Time (South Australia)", "CST", "Central Summer Time (South Australia)", "CST"}; String AGT[] = new String[] {"Argentine Time", "ART", "Argentine Summer Time", "ARST"}; String AKST[] = new String[] {"Alaska Standard Time", "AKST", "Alaska Daylight Time", "AKDT"}; String AMT[] = new String[] {"Amazon Time", "AMT", "Amazon Summer Time", "AMST"}; String ARAST[] = new String[] {"Arabia Standard Time", "AST", "Arabia Daylight Time", "ADT"}; String ARMT[] = new String[] {"Armenia Time", "AMT", "Armenia Summer Time", "AMST"}; String AST[] = new String[] {"Atlantic Standard Time", "AST", "Atlantic Daylight Time", "ADT"}; String BDT[] = new String[] {"Bangladesh Time", "BDT", "Bangladesh Summer Time", "BDST"}; String BRISBANE[] = new String[] {"Eastern Standard Time (Queensland)", "EST", "Eastern Summer Time (Queensland)", "EST"}; String BROKEN_HILL[] = new String[] {"Central Standard Time (South Australia/New South Wales)", "CST", "Central Summer Time (South Australia/New South Wales)", "CST"}; String BRT[] = new String[] {"Brasilia Time", "BRT", "Brasilia Summer Time", "BRST"}; String BTT[] = new String[] {"Bhutan Time", "BTT", "Bhutan Summer Time", "BTST"}; String CAT[] = new String[] {"Central African Time", "CAT", "Central African Summer Time", "CAST"}; String CET[] = new String[] {"Central European Time", "CET", "Central European Summer Time", "CEST"}; String CHAST[] = new String[] {"Chatham Standard Time", "CHAST", "Chatham Daylight Time", "CHADT"}; String CIT[] = new String[] {"Central Indonesia Time", "CIT", "Central Indonesia Summer Time", "CIST"}; String CLT[] = new String[] {"Chile Time", "CLT", "Chile Summer Time", "CLST"}; String CST[] = new String[] {"Central Standard Time", "CST", "Central Daylight Time", "CDT"}; String CTT[] = new String[] {"China Standard Time", "CST", "China Daylight Time", "CDT"}; String DARWIN[] = new String[] {"Central Standard Time (Northern Territory)", "CST", "Central Summer Time (Northern Territory)", "CST"}; String DUBLIN[] = new String[] {"Greenwich Mean Time", "GMT", "Irish Summer Time", "IST"}; String EAT[] = new String[] {"Eastern African Time", "EAT", "Eastern African Summer Time", "EAST"}; String EASTER[] = new String[] {"Easter Is. Time", "EAST", "Easter Is. Summer Time", "EASST"}; String EET[] = new String[] {"Eastern European Time", "EET", "Eastern European Summer Time", "EEST"}; String EGT[] = new String[] {"Eastern Greenland Time", "EGT", "Eastern Greenland Summer Time", "EGST"}; String EST[] = new String[] {"Eastern Standard Time", "EST", "Eastern Daylight Time", "EDT"}; String EST_NSW[] = new String[] {"Eastern Standard Time (New South Wales)", "EST", "Eastern Summer Time (New South Wales)", "EST"}; String GAMBIER[] = new String[] {"Gambier Time", "GAMT", "Gambier Summer Time", "GAMST"}; String GMT[] = new String[] {"Greenwich Mean Time", "GMT", "Greenwich Mean Time", "GMT"}; String GMTBST[] = new String[] {"Greenwich Mean Time", "GMT", "British Summer Time", "BST"}; String GST[] = new String[] {"Gulf Standard Time", "GST", "Gulf Daylight Time", "GDT"}; String HAST[] = new String[] {"Hawaii-Aleutian Standard Time", "HAST", "Hawaii-Aleutian Daylight Time", "HADT"}; String HKT[] = new String[] {"Hong Kong Time", "HKT", "Hong Kong Summer Time", "HKST"}; String HST[] = new String[] {"Hawaii Standard Time", "HST", "Hawaii Daylight Time", "HDT"}; String ICT[] = new String[] {"Indochina Time", "ICT", "Indochina Summer Time", "ICST"}; String IRT[] = new String[] {"Iran Standard Time", "IRST", "Iran Daylight Time", "IRDT"}; String ISRAEL[] = new String[] {"Israel Standard Time", "IST", "Israel Daylight Time", "IDT"}; String IST[] = new String[] {"India Standard Time", "IST", "India Daylight Time", "IDT"}; String JST[] = new String[] {"Japan Standard Time", "JST", "Japan Daylight Time", "JDT"}; String KST[] = new String[] {"Korea Standard Time", "KST", "Korea Daylight Time", "KDT"}; String LORD_HOWE[] = new String[] {"Load Howe Standard Time", "LHST", "Load Howe Summer Time", "LHST"}; String MHT[] = new String[] {"Marshall Islands Time", "MHT", "Marshall Islands Summer Time", "MHST"}; String MSK[] = new String[] {"Moscow Standard Time", "MSK", "Moscow Daylight Time", "MSD"}; String MST[] = new String[] {"Mountain Standard Time", "MST", "Mountain Daylight Time", "MDT"}; String MYT[] = new String[] {"Malaysia Time", "MYT", "Malaysia Summer Time", "MYST"}; String NORONHA[] = new String[] {"Fernando de Noronha Time", "FNT", "Fernando de Noronha Summer Time", "FNST"}; String NST[] = new String[] {"Newfoundland Standard Time", "NST", "Newfoundland Daylight Time", "NDT"}; String NZST[] = new String[] {"New Zealand Standard Time", "NZST", "New Zealand Daylight Time", "NZDT"}; String PITCAIRN[] = new String[] {"Pitcairn Standard Time", "PST", "Pitcairn Daylight Time", "PDT"}; String PKT[] = new String[] {"Pakistan Time", "PKT", "Pakistan Summer Time", "PKST"}; String PST[] = new String[] {"Pacific Standard Time", "PST", "Pacific Daylight Time", "PDT"}; String SAST[] = new String[] {"South Africa Standard Time", "SAST", "South Africa Summer Time", "SAST"}; String SBT[] = new String[] {"Solomon Is. Time", "SBT", "Solomon Is. Summer Time", "SBST"}; String SGT[] = new String[] {"Singapore Time", "SGT", "Singapore Summer Time", "SGST"}; String TASMANIA[] = new String[] {"Eastern Standard Time (Tasmania)", "EST", "Eastern Summer Time (Tasmania)", "EST"}; String TMT[] = new String[] {"Turkmenistan Time", "TMT", "Turkmenistan Summer Time", "TMST"}; String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT", "Ulaanbaatar Summer Time", "ULAST"}; String WAT[] = new String[] {"Western African Time", "WAT", "Western African Summer Time", "WAST"}; String WET[] = new String[] {"Western European Time", "WET", "Western European Summer Time", "WEST"}; String WIT[] = new String[] {"West Indonesia Time", "WIT", "West Indonesia Summer Time", "WIST"}; String WST_AUS[] = new String[] {"Western Standard Time (Australia)", "WST", "Western Summer Time (Australia)", "WST"}; String SAMOA[] = new String[] {"Samoa Standard Time", "SST", "Samoa Daylight Time", "SDT"}; String WST_SAMOA[] = new String[] {"West Samoa Time", "WST", "West Samoa Summer Time", "WSST"}; String ChST[] = new String[] {"Chamorro Standard Time", "ChST", "Chamorro Daylight Time", "ChDT"}; String VICTORIA[] = new String[] {"Eastern Standard Time (Victoria)", "EST", "Eastern Summer Time (Victoria)", "EST"}; String UTC[] = new String[] {"Coordinated Universal Time", "UTC", "Coordinated Universal Time", "UTC"}; String UZT[] = new String[] {"Uzbekistan Time", "UZT", "Uzbekistan Summer Time", "UZST"}; return new Object[][] { {"PST", PST},
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?