mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-12591 Remove CalendarData.java and all the remaining references to the CalendarData class.
X-SVN-Rev: 39094
This commit is contained in:
parent
74449b2e0c
commit
c1b7c99189
4 changed files with 0 additions and 122 deletions
|
@ -31,8 +31,6 @@ com/ibm/icu/impl/Assert#fail:(Ljava/lang/Exception;)V
|
|||
com/ibm/icu/impl/BMPSet#<init>:(Lcom/ibm/icu/impl/BMPSet;[II)V
|
||||
com/ibm/icu/impl/CacheValue$Strength#valueOf:(Ljava/lang/String;)Lcom/ibm/icu/impl/CacheValue$Strength;
|
||||
com/ibm/icu/impl/CacheValue$Strength#values:()[Lcom/ibm/icu/impl/CacheValue$Strength;
|
||||
com/ibm/icu/impl/CalendarData#get:(Ljava/lang/String;Ljava/lang/String;)Lcom/ibm/icu/impl/ICUResourceBundle;
|
||||
com/ibm/icu/impl/CalendarData#get:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/ibm/icu/impl/ICUResourceBundle;
|
||||
com/ibm/icu/impl/CalendarUtil#<init>:()V
|
||||
com/ibm/icu/impl/CharacterIteration#<init>:()V
|
||||
com/ibm/icu/impl/CharTrie#equals:(Ljava/lang/Object;)Z
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html#License
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2004-2016, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*/
|
||||
package com.ibm.icu.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.UResourceBundle;
|
||||
import com.ibm.icu.util.UResourceBundleIterator;
|
||||
|
||||
/**
|
||||
* This class abstracts access to calendar (Calendar and DateFormat) data.
|
||||
* @internal ICU 3.0
|
||||
*/
|
||||
public class CalendarData {
|
||||
/**
|
||||
* Construct a CalendarData from the given locale.
|
||||
* @param loc locale to use. The 'calendar' keyword will be ignored.
|
||||
* @param type calendar type. NULL indicates the gregorian calendar.
|
||||
* No default lookup is done.
|
||||
*/
|
||||
public CalendarData(ULocale loc, String type) {
|
||||
this((ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, loc), type);
|
||||
}
|
||||
|
||||
public CalendarData(ICUResourceBundle b, String type) {
|
||||
fBundle = b;
|
||||
if((type == null) || (type.equals("")) || (type.equals("gregorian"))) {
|
||||
fMainType = "gregorian";
|
||||
fFallbackType = null;
|
||||
} else {
|
||||
fMainType = type;
|
||||
fFallbackType = "gregorian";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data for calendar. Note, this object owns the resources, do NOT call ures_close()!
|
||||
*
|
||||
* @param key Resource key to data
|
||||
* @internal
|
||||
*/
|
||||
public ICUResourceBundle get(String key) {
|
||||
try {
|
||||
return fBundle.getWithFallback("calendar/" + fMainType + "/" + key);
|
||||
} catch(MissingResourceException m) {
|
||||
if(fFallbackType != null) {
|
||||
return fBundle.getWithFallback("calendar/" + fFallbackType + "/" + key);
|
||||
}
|
||||
throw m;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getDateTimePatterns(){
|
||||
ICUResourceBundle bundle = get("DateTimePatterns");
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
UResourceBundleIterator iter = bundle.getIterator();
|
||||
while (iter.hasNext()) {
|
||||
UResourceBundle patResource = iter.next();
|
||||
int resourceType = patResource.getType();
|
||||
switch (resourceType) {
|
||||
case UResourceBundle.STRING:
|
||||
list.add(patResource.getString());
|
||||
break;
|
||||
case UResourceBundle.ARRAY:
|
||||
String[] items = patResource.getStringArray();
|
||||
list.add(items[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default date-time pattern such as <code>{1}, {0}</code>.
|
||||
* {1} is always the date and {0} is always the time.
|
||||
*/
|
||||
public String getDateTimePattern() {
|
||||
// this is a hack to get offset 8 from the dateTimePatterns array.
|
||||
return _getDateTimePattern(-1);
|
||||
}
|
||||
|
||||
private String _getDateTimePattern(int offset) {
|
||||
String[] patterns = null;
|
||||
try {
|
||||
patterns = getDateTimePatterns();
|
||||
} catch (MissingResourceException ignored) {
|
||||
// ignore. patterns remains null.
|
||||
}
|
||||
if (patterns == null || patterns.length < 9) {
|
||||
// Return hard-coded default. patterns array not available or it has too few
|
||||
// elements.
|
||||
return "{1} {0}";
|
||||
}
|
||||
if (patterns.length < 13) {
|
||||
// Offset 8 contains default pattern if we don't have per style patterns.
|
||||
return patterns[8];
|
||||
}
|
||||
// DateTimePatterns start at index 9 in the array.
|
||||
return patterns[9 + offset];
|
||||
}
|
||||
|
||||
private ICUResourceBundle fBundle;
|
||||
private String fMainType;
|
||||
private String fFallbackType;
|
||||
}
|
|
@ -15,10 +15,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.ibm.icu.impl.CalendarData;
|
||||
import com.ibm.icu.impl.ICUCache;
|
||||
import com.ibm.icu.impl.ICUData;
|
||||
import com.ibm.icu.impl.ICUResourceBundle;
|
||||
|
@ -32,7 +29,6 @@ import com.ibm.icu.util.TimeZone;
|
|||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.ULocale.Category;
|
||||
import com.ibm.icu.util.UResourceBundle;
|
||||
import com.ibm.icu.util.UResourceTypeMismatchException;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Date;
|
|||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
import com.ibm.icu.impl.CalendarData;
|
||||
import com.ibm.icu.impl.CalendarUtil;
|
||||
import com.ibm.icu.impl.ICUCache;
|
||||
import com.ibm.icu.impl.ICUData;
|
||||
|
|
Loading…
Add table
Reference in a new issue