From 5e2912446e21bdb315d90958e5f22a2cebb00456 Mon Sep 17 00:00:00 2001 From: John Fitzpatrick Date: Mon, 28 Feb 2000 01:10:41 +0000 Subject: [PATCH] Removed ChineseDateFormat stuff because the Chinese calendar doesn't work. X-SVN-Rev: 853 --- .../com/ibm/icu/text/ChineseDateFormat.java | 114 ------------------ icu4j/src/com/ibm/text/ChineseDateFormat.java | 114 ------------------ .../src/com/ibm/text/ChineseDateSymbols.java | 87 ------------- icu4j/src/com/ibm/text/GNUmakefile | 6 +- icu4j/src/com/ibm/text/makefile | 6 +- 5 files changed, 4 insertions(+), 323 deletions(-) delete mode 100755 icu4j/src/com/ibm/icu/text/ChineseDateFormat.java delete mode 100755 icu4j/src/com/ibm/text/ChineseDateFormat.java delete mode 100755 icu4j/src/com/ibm/text/ChineseDateSymbols.java diff --git a/icu4j/src/com/ibm/icu/text/ChineseDateFormat.java b/icu4j/src/com/ibm/icu/text/ChineseDateFormat.java deleted file mode 100755 index 72852120b9c..00000000000 --- a/icu4j/src/com/ibm/icu/text/ChineseDateFormat.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * $RCSfile: ChineseDateFormat.java,v $ $Revision: 1.1 $ $Date: 2000/02/10 06:25:49 $ - */ - -package com.ibm.text; - -import com.ibm.util.ChineseCalendar; - -import java.io.ObjectInputStream; -import java.io.IOException; - -import java.lang.ClassNotFoundException; -import java.lang.StringIndexOutOfBoundsException; - -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.MessageFormat; -import java.text.NumberFormat; -import java.text.FieldPosition; -import java.text.ParsePosition; - -import java.util.TimeZone; -import java.util.Calendar; -import java.util.Date; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.SimpleTimeZone; -import java.util.GregorianCalendar; -import java.util.Hashtable; - - -public class ChineseDateFormat extends SimpleDateFormat { - - public ChineseDateFormat(ChineseCalendar cal, int dateStyle, int timeStyle, - Locale loc) - { - super(patternHelper(dateStyle, timeStyle, loc), - new ChineseDateSymbols(loc)); - setCalendar(cal); - } - - private static String patternHelper(int dateStyle, int timeStyle, Locale loc) - { - // PERF: bundle is loaded twice; symbols loaded it too - ResourceBundle bundle = ResourceBundle.getBundle( - "com.ibm.util.resources.ChineseCalendarSymbols"); - - String[] patterns = bundle.getStringArray("DateTimePatterns"); - - String pattern = null; - if ((timeStyle >= 0) && (dateStyle >= 0)) { - Object[] dateTimeArgs = { patterns[timeStyle], - patterns[dateStyle + 4] }; - pattern = MessageFormat.format(patterns[8], dateTimeArgs); - } - else if (timeStyle >= 0) { - pattern = patterns[timeStyle]; - } - else if (dateStyle >= 0) { - pattern = patterns[dateStyle + 4]; - } - else { - throw new IllegalArgumentException("No date or time style specified"); - } - return pattern; - } - - // Private member function that does the real date/time formatting. - protected String subFormat(char ch, int count, int beginOffset, - FieldPosition pos, DateFormatSymbols formatData) - throws IllegalArgumentException - { - ChineseDateSymbols symbols = (ChineseDateSymbols)formatData; - - int patternCharIndex = -1; - int maxIntCount = Integer.MAX_VALUE; - String result = null; - - if ((patternCharIndex = patternChars.indexOf(ch)) == -1) { - return super.subFormat(ch, count, beginOffset, pos, formatData); - } - - int field = PATTERN_INDEX_TO_CALENDAR_FIELD[patternCharIndex]; - int value = calendar.get(field); - - switch (patternCharIndex) { - case '0': // ERA - result = zeroPaddingNumber(value, count, maxIntCount); - break; - case '1': // LEAP_MONTH - result = zeroPaddingNumber(value, count, maxIntCount); - break; - case '2': // SOLAR_TERM - result = zeroPaddingNumber(value, count, maxIntCount); - break; - } - return result; - } - - - /** - * Cache to hold the DateTimePatterns of a Locale. - */ - private static Hashtable cachedLocaleData = new Hashtable(3); - - static final String patternChars = "GLT"; - - // Map index into pattern character string to Calendar field number - private static final int[] PATTERN_INDEX_TO_CALENDAR_FIELD = - { - ChineseCalendar.LEAP_MONTH, ChineseCalendar.SOLAR_TERM, - }; - -}; diff --git a/icu4j/src/com/ibm/text/ChineseDateFormat.java b/icu4j/src/com/ibm/text/ChineseDateFormat.java deleted file mode 100755 index 72852120b9c..00000000000 --- a/icu4j/src/com/ibm/text/ChineseDateFormat.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * $RCSfile: ChineseDateFormat.java,v $ $Revision: 1.1 $ $Date: 2000/02/10 06:25:49 $ - */ - -package com.ibm.text; - -import com.ibm.util.ChineseCalendar; - -import java.io.ObjectInputStream; -import java.io.IOException; - -import java.lang.ClassNotFoundException; -import java.lang.StringIndexOutOfBoundsException; - -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.MessageFormat; -import java.text.NumberFormat; -import java.text.FieldPosition; -import java.text.ParsePosition; - -import java.util.TimeZone; -import java.util.Calendar; -import java.util.Date; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.SimpleTimeZone; -import java.util.GregorianCalendar; -import java.util.Hashtable; - - -public class ChineseDateFormat extends SimpleDateFormat { - - public ChineseDateFormat(ChineseCalendar cal, int dateStyle, int timeStyle, - Locale loc) - { - super(patternHelper(dateStyle, timeStyle, loc), - new ChineseDateSymbols(loc)); - setCalendar(cal); - } - - private static String patternHelper(int dateStyle, int timeStyle, Locale loc) - { - // PERF: bundle is loaded twice; symbols loaded it too - ResourceBundle bundle = ResourceBundle.getBundle( - "com.ibm.util.resources.ChineseCalendarSymbols"); - - String[] patterns = bundle.getStringArray("DateTimePatterns"); - - String pattern = null; - if ((timeStyle >= 0) && (dateStyle >= 0)) { - Object[] dateTimeArgs = { patterns[timeStyle], - patterns[dateStyle + 4] }; - pattern = MessageFormat.format(patterns[8], dateTimeArgs); - } - else if (timeStyle >= 0) { - pattern = patterns[timeStyle]; - } - else if (dateStyle >= 0) { - pattern = patterns[dateStyle + 4]; - } - else { - throw new IllegalArgumentException("No date or time style specified"); - } - return pattern; - } - - // Private member function that does the real date/time formatting. - protected String subFormat(char ch, int count, int beginOffset, - FieldPosition pos, DateFormatSymbols formatData) - throws IllegalArgumentException - { - ChineseDateSymbols symbols = (ChineseDateSymbols)formatData; - - int patternCharIndex = -1; - int maxIntCount = Integer.MAX_VALUE; - String result = null; - - if ((patternCharIndex = patternChars.indexOf(ch)) == -1) { - return super.subFormat(ch, count, beginOffset, pos, formatData); - } - - int field = PATTERN_INDEX_TO_CALENDAR_FIELD[patternCharIndex]; - int value = calendar.get(field); - - switch (patternCharIndex) { - case '0': // ERA - result = zeroPaddingNumber(value, count, maxIntCount); - break; - case '1': // LEAP_MONTH - result = zeroPaddingNumber(value, count, maxIntCount); - break; - case '2': // SOLAR_TERM - result = zeroPaddingNumber(value, count, maxIntCount); - break; - } - return result; - } - - - /** - * Cache to hold the DateTimePatterns of a Locale. - */ - private static Hashtable cachedLocaleData = new Hashtable(3); - - static final String patternChars = "GLT"; - - // Map index into pattern character string to Calendar field number - private static final int[] PATTERN_INDEX_TO_CALENDAR_FIELD = - { - ChineseCalendar.LEAP_MONTH, ChineseCalendar.SOLAR_TERM, - }; - -}; diff --git a/icu4j/src/com/ibm/text/ChineseDateSymbols.java b/icu4j/src/com/ibm/text/ChineseDateSymbols.java deleted file mode 100755 index afd1c4c9940..00000000000 --- a/icu4j/src/com/ibm/text/ChineseDateSymbols.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $RCSfile: ChineseDateSymbols.java,v $ $Revision: 1.1 $ $Date: 2000/02/10 06:25:49 $ - */ - -package com.ibm.text; - - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -class ChineseDateSymbols extends DateFormatSymbols { - - public ChineseDateSymbols() { - this(Locale.getDefault()); - } - - public ChineseDateSymbols(Locale loc) { - super(loc); - - ResourceBundle bundle = ResourceBundle.getBundle("com.ibm.util.resources.ChineseCalendarSymbols", loc); - - try { - String[] temp = bundle.getStringArray("DayNames"); - setWeekdays(temp); - setShortWeekdays(temp); - - temp = bundle.getStringArray("DayAbbreviations"); - setShortWeekdays( temp ); - } - catch (MissingResourceException e) { - } - - try { - String[] temp = bundle.getStringArray("MonthNames"); - setMonths( temp ); - setShortMonths( temp ); - - temp = bundle.getStringArray("MonthAbbreviations"); - setShortMonths( temp ); - } - catch (MissingResourceException e) { - } - - setEras( bundle.getStringArray("Eras") ); - - stemNames = bundle.getStringArray("StemNames"); - branchNames = bundle.getStringArray("BranchNames"); - termNames = bundle.getStringArray("TermNames"); - monthTypes = bundle.getStringArray("MonthTypes"); - - } - - public String[] getStemNames() { - return duplicate(stemNames); - } - - public String[] getBranchNames() { - return duplicate(branchNames); - } - - public String[] getTermNames() { - return duplicate(termNames); - } - - public String[] getMonthTypes() { - return duplicate(monthTypes); - } - - /** - * Clones an array of Strings. - * @param srcArray the source array to be cloned. - * @param count the number of elements in the given source array. - * @return a cloned array. - */ - private final String[] duplicate(String[] srcArray) - { - String[] dstArray = new String[srcArray.length]; - System.arraycopy(srcArray, 0, dstArray, 0, srcArray.length); - return dstArray; - } - - private String[] stemNames; - private String[] branchNames; - private String[] termNames; - private String[] monthTypes; -}; diff --git a/icu4j/src/com/ibm/text/GNUmakefile b/icu4j/src/com/ibm/text/GNUmakefile index 1a2f316dcef..a2e7abfe2e8 100755 --- a/icu4j/src/com/ibm/text/GNUmakefile +++ b/icu4j/src/com/ibm/text/GNUmakefile @@ -1,5 +1,5 @@ # -# @(#)$RCSfile: GNUmakefile,v $ $Revision: 1.1 $ $Date: 2000/02/16 23:39:56 $ +# @(#)$RCSfile: GNUmakefile,v $ $Revision: 1.2 $ $Date: 2000/02/28 01:10:40 $ # TOPDIR= ../../../.. @@ -9,9 +9,7 @@ include $(TOPDIR)/src/build/defs.gmk SUBDIRS= resources components -FILES_java= $(TARGDIR)/ChineseDateFormat.java \ - $(TARGDIR)/ChineseDateSymbols.java \ - $(TARGDIR)/DateFormatSymbols.java \ +FILES_java= $(TARGDIR)/DateFormatSymbols.java \ $(TARGDIR)/StringSearch.java \ $(TARGDIR)/SearchIterator.java \ $(TARGDIR)/SimpleDateFormat.java \ diff --git a/icu4j/src/com/ibm/text/makefile b/icu4j/src/com/ibm/text/makefile index b44024352dd..c95c6044400 100755 --- a/icu4j/src/com/ibm/text/makefile +++ b/icu4j/src/com/ibm/text/makefile @@ -1,5 +1,5 @@ # -# @(#)$RCSfile: makefile,v $ $Revision: 1.1 $ $Date: 2000/02/16 23:39:57 $ +# @(#)$RCSfile: makefile,v $ $Revision: 1.2 $ $Date: 2000/02/28 01:10:41 $ # TOPDIR= ../../../.. @@ -9,9 +9,7 @@ PACKAGE= com.ibm.text SUBDIRS= resources components -FILES_java= $(TARGDIR)/ChineseDateFormat.java \ - $(TARGDIR)/ChineseDateSymbols.java \ - $(TARGDIR)/DateFormatSymbols.java \ +FILES_java= $(TARGDIR)/DateFormatSymbols.java \ $(TARGDIR)/StringSearch.java \ $(TARGDIR)/SearchIterator.java \ $(TARGDIR)/SimpleDateFormat.java \