ICU-3301 move data from J to C format

X-SVN-Rev: 15474
This commit is contained in:
Steven R. Loomis 2004-05-21 21:30:03 +00:00
parent 6d44d8587d
commit 481973c60b
7 changed files with 78 additions and 18 deletions

View File

@ -201,6 +201,15 @@ public class BuddhistCalendar extends GregorianCalendar {
return super.handleGetLimit(field, limitType);
}
/**
* Return the current Calendar type.
* @return type of calendar (gregorian, etc.)
* @internal ICU 3.0
*/
public String getType() {
return "buddhist";
}
/*
private static CalendarFactory factory;
public static CalendarFactory factory() {

View File

@ -10,6 +10,7 @@ import com.ibm.icu.impl.ICUResourceBundle;
import com.ibm.icu.impl.ICUService.Factory;
import com.ibm.icu.impl.ICULocaleService;
import com.ibm.icu.impl.ICULocaleService.LocaleKeyFactory;
import com.ibm.icu.impl.CalendarData;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.DateFormatSymbols;
import com.ibm.icu.text.SimpleDateFormat;
@ -2858,12 +2859,9 @@ public abstract class Calendar implements Serializable, Cloneable {
// If not, just use the default DateFormat
DateFormat result = null;
ResourceBundle bundle = DateFormatSymbols.getDateFormatBundle(cal, loc);
if (bundle != null) {
try {
String[] patterns = bundle.getStringArray("DateTimePatterns");
CalendarData calData = new CalendarData(new ULocale(loc), cal.getType());
String[] patterns = calData.get("DateTimePatterns").getStringArray();
String pattern = null;
if ((timeStyle >= 0) && (dateStyle >= 0)) {
@ -2887,9 +2885,6 @@ public abstract class Calendar implements Serializable, Cloneable {
DateFormatSymbols symbols = new DateFormatSymbols(cal, loc);
((SimpleDateFormat) result).setDateFormatSymbols(symbols); // aliu
}
} else {
result = SimpleDateFormat.getDateTimeInstance(dateStyle, timeStyle, loc);
}
result.setCalendar(cal);
return result;
}
@ -3691,15 +3686,15 @@ public abstract class Calendar implements Serializable, Cloneable {
WeekData data = (WeekData) cachedLocaleData.get(locale);
if (data == null) { /* cache miss */
ICUResourceBundle dateRes = (ICUResourceBundle)UResourceBundle.getBundleInstance(UResourceBundle.ICU_BASE_NAME,locale);
int[] dateTimeElements = dateRes.get("DateTimeElements").getIntVector();
String[] weekend = UResourceBundle.getBundleInstance("CalendarData", locale).getStringArray("Weekend");
CalendarData calData = new CalendarData(new ULocale(locale), getType());
int[] dateTimeElements = calData.get("DateTimeElements").getIntVector();
int[] weekend = calData.get("weekend").getIntVector();
data = new WeekData(dateTimeElements[0],dateTimeElements[1],
Integer.parseInt(weekend[0]),
Integer.parseInt(weekend[1]),
Integer.parseInt(weekend[2]),
Integer.parseInt(weekend[3]),
dateRes.getULocale());
weekend[0],
weekend[1],
weekend[2],
weekend[3],
calData.getULocale());
/* cache update */
cachedLocaleData.put(locale, data);
}
@ -4890,6 +4885,16 @@ public abstract class Calendar implements Serializable, Cloneable {
return time;
}
/**
* Return the current Calendar type.
* Note, in 3.0 this function will return 'gregorian' in Calendar to emulate legacy behavior
* @return type of calendar (gregorian, etc)
* @internal ICU 3.0
*/
public String getType() {
return "gregorian";
}
// -------- BEGIN ULocale boilerplate --------
/**

View File

@ -798,6 +798,14 @@ public class ChineseCalendar extends Calendar {
return julianDay - 1;
}
/**
* Return the current Calendar type.
* @return type of calendar (gregorian, etc.)
* @internal ICU 3.0
*/
public String getType() {
return "chinese";
}
/*
private static CalendarFactory factory;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 1996-2003, International Business Machines
* Copyright (C) 1996-2004, International Business Machines
* Corporation and others. All Rights Reserved.
*/
package com.ibm.icu.util;
@ -844,6 +844,15 @@ public class GregorianCalendar extends Calendar {
return julianDay;
}
/**
* Return the current Calendar type.
* @return type of calendar (gregorian, etc.)
* @internal ICU 3.0
*/
public String getType() {
return "gregorian";
}
/*
private static CalendarFactory factory;
public static CalendarFactory factory() {

View File

@ -802,6 +802,17 @@ public class HebrewCalendar extends Calendar {
return (int) (day + 347997);
}
/**
* Return the current Calendar type.
* @return type of calendar (gregorian, etc.)
* @internal ICU 3.0
*/
public String getType() {
return "hebrew";
}
/*
private static CalendarFactory factory;
public static CalendarFactory factory() {

View File

@ -605,6 +605,15 @@ public class IslamicCalendar extends Calendar {
internalSet(DAY_OF_YEAR, dayOfYear);
}
/**
* Return the current Calendar type.
* @return type of calendar (gregorian, etc.)
* @internal ICU 3.0
*/
public String getType() {
return "islamic";
}
/*
private static CalendarFactory factory;
public static CalendarFactory factory() {

View File

@ -561,6 +561,15 @@ public class JapaneseCalendar extends GregorianCalendar {
}
}
/**
* Return the current Calendar type.
* @return type of calendar (gregorian, etc.)
* @internal ICU 3.0
*/
public String getType() {
return "japanese";
}
/*
private static CalendarFactory factory;
public static CalendarFactory factory() {