ICU-2202 ULocale changes
X-SVN-Rev: 13821
This commit is contained in:
parent
9257d678bd
commit
f409a92b99
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/Collator.java,v $
|
||||
* $Date: 2003/11/18 17:53:53 $
|
||||
* $Revision: 1.37 $
|
||||
* $Date: 2003/11/21 22:52:05 $
|
||||
* $Revision: 1.38 $
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -679,6 +679,7 @@ public abstract class Collator implements Comparator, Cloneable
|
||||
* @see #compare(String, String)
|
||||
* @see #getCollationKey
|
||||
* @see RawCollationKey
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public abstract RawCollationKey getRawCollationKey(String source,
|
||||
RawCollationKey key);
|
||||
@ -734,11 +735,12 @@ public abstract class Collator implements Comparator, Cloneable
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public ULocale getLocale(ULocale.ULocaleDataType type) {
|
||||
return new ULocale("");
|
||||
return ULocale.ROOT;
|
||||
}
|
||||
|
||||
/** Get the version of this collator object.
|
||||
* @return the version object associated with this collator
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public VersionInfo getVersion() {
|
||||
return VersionInfo.getInstance(0);
|
||||
@ -746,6 +748,7 @@ public abstract class Collator implements Comparator, Cloneable
|
||||
|
||||
/** Get the UCA version of this collator object.
|
||||
* @return the version object associated with this collator
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public VersionInfo getUCAVersion() {
|
||||
return VersionInfo.getInstance(0);
|
||||
|
@ -736,7 +736,7 @@ public abstract class DateFormat extends UFormat {
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public ULocale getLocale(ULocale.ULocaleDataType type) {
|
||||
return new ULocale("");
|
||||
return ULocale.ROOT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DateFormatSymbols.java,v $
|
||||
* $Date: 2003/09/04 23:07:34 $
|
||||
* $Revision: 1.20 $
|
||||
* $Date: 2003/11/21 22:52:05 $
|
||||
* $Revision: 1.21 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
@ -609,7 +609,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
* Variant of DateFormatSymbols(Calendar, Locale) that takes the Calendar class
|
||||
* instead of a Calandar instance.
|
||||
* @see #DateFormatSymbols(Calendar, Locale)
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public DateFormatSymbols(Class calendarClass, Locale locale) {
|
||||
this(locale); // old-style construction
|
||||
@ -729,7 +729,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
||||
* Variant of getDateFormatBundle(java.lang.Class, java.util.Locale) that takes
|
||||
* a Calendar instance instead of a Calendar class.
|
||||
* @see #getDateFormatBundle(java.lang.Class, java.util.Locale)
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
static public ResourceBundle getDateFormatBundle(Calendar cal, Locale locale)
|
||||
throws MissingResourceException {
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DecimalFormat.java,v $
|
||||
* $Date: 2003/11/21 08:11:49 $
|
||||
* $Revision: 1.38 $
|
||||
* $Date: 2003/11/21 22:52:05 $
|
||||
* $Revision: 1.39 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
@ -3423,7 +3423,7 @@ public class DecimalFormat extends NumberFormat {
|
||||
* currency format through the application of a new pattern.
|
||||
* @param theCurrency new currency object to use. Must not be
|
||||
* null.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public void setCurrency(Currency theCurrency) {
|
||||
// If we are a currency format, then modify our affixes to
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/DecimalFormatSymbols.java,v $
|
||||
* $Date: 2003/11/21 08:11:49 $
|
||||
* $Revision: 1.12 $
|
||||
* $Date: 2003/11/21 22:52:05 $
|
||||
* $Revision: 1.13 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
@ -760,7 +760,7 @@ final public class DecimalFormatSymbols implements Cloneable, Serializable {
|
||||
private ULocale validLocale;
|
||||
|
||||
ULocale getLocale(ULocale.ULocaleDataType type) {
|
||||
return (ULocale)validLocale.clone();
|
||||
return validLocale;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NumberFormat.java,v $
|
||||
* $Date: 2003/11/21 08:11:49 $
|
||||
* $Revision: 1.32 $
|
||||
* $Date: 2003/11/21 22:52:05 $
|
||||
* $Revision: 1.33 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
@ -924,7 +924,7 @@ public abstract class NumberFormat extends UFormat {
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public ULocale getLocale(ULocale.ULocaleDataType type) {
|
||||
return new ULocale(Locale.getDefault());
|
||||
return ULocale.getDefault();
|
||||
}
|
||||
|
||||
// =======================privates===============================
|
||||
@ -962,9 +962,8 @@ public abstract class NumberFormat extends UFormat {
|
||||
* @param forLocale the locale of the data.
|
||||
* @param choice the pattern format.
|
||||
* @return the pattern
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
// [NEW]
|
||||
protected static String getPattern(Locale forLocale, int choice) {
|
||||
|
||||
/* The following code takes care of a few cases where the
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/RuleBasedNumberFormat.java,v $
|
||||
* $Date: 2003/11/21 08:11:49 $
|
||||
* $Revision: 1.17 $
|
||||
* $Date: 2003/11/21 22:52:05 $
|
||||
* $Revision: 1.18 $
|
||||
*
|
||||
*****************************************************************************************
|
||||
*/
|
||||
@ -475,7 +475,7 @@ import java.util.ResourceBundle;
|
||||
* using these features.</p>
|
||||
*
|
||||
* @author Richard Gillam
|
||||
* $RCSfile: RuleBasedNumberFormat.java,v $ $Revision: 1.17 $ $Date: 2003/11/21 08:11:49 $
|
||||
* $RCSfile: RuleBasedNumberFormat.java,v $ $Revision: 1.18 $ $Date: 2003/11/21 22:52:05 $
|
||||
* @see NumberFormat
|
||||
* @see DecimalFormat
|
||||
* @stable ICU 2.0
|
||||
@ -1345,7 +1345,7 @@ public final class RuleBasedNumberFormat extends NumberFormat {
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public ULocale getLocale(ULocale.ULocaleDataType type) {
|
||||
return (ULocale)validLocale.clone();
|
||||
return validLocale;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3036,7 +3036,7 @@ public abstract class Calendar implements Serializable, Cloneable {
|
||||
* <code>field</code> parameter specifies the units of the return
|
||||
* value. For example, if <code>fieldDifference(when,
|
||||
* Calendar.MONTH)</code> returns 3, then this calendar is set to
|
||||
* 3 months before <code>when</code>, and possibly some addition
|
||||
* 3 months before <code>when</code>, and possibly some additional
|
||||
* time less than one month.
|
||||
*
|
||||
* <p>As a side effect of this call, this calendar is advanced
|
||||
@ -3609,7 +3609,7 @@ public abstract class Calendar implements Serializable, Cloneable {
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public ULocale getLocale(ULocale.ULocaleDataType type) {
|
||||
return (ULocale)validLocale.clone();
|
||||
return validLocale;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,8 +5,8 @@
|
||||
*******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/Currency.java,v $
|
||||
* $Date: 2003/06/03 18:49:35 $
|
||||
* $Revision: 1.16 $
|
||||
* $Date: 2003/11/21 22:52:04 $
|
||||
* $Revision: 1.17 $
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
@ -38,7 +38,7 @@ import com.ibm.icu.impl.LocaleUtility;
|
||||
* <tt>java.util.Currency</tt> but it has a completely independent
|
||||
* implementation, and adds features not present in the JDK.
|
||||
* @author Alan Liu
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public class Currency implements Serializable {
|
||||
|
||||
@ -93,7 +93,7 @@ public class Currency implements Serializable {
|
||||
/**
|
||||
* Returns a currency object for the default currency in the given
|
||||
* locale.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public static Currency getInstance(Locale locale) {
|
||||
if (shim == null) {
|
||||
@ -128,7 +128,7 @@ public class Currency implements Serializable {
|
||||
|
||||
/**
|
||||
* Returns a currency object given an ISO 4217 3-letter code.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public static Currency getInstance(String theISOCode) {
|
||||
return new Currency(theISOCode);
|
||||
@ -161,7 +161,7 @@ public class Currency implements Serializable {
|
||||
/**
|
||||
* Return an array of the locales for which a currency
|
||||
* is defined.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public static Locale[] getAvailableLocales() {
|
||||
if (shim == null) {
|
||||
@ -175,7 +175,7 @@ public class Currency implements Serializable {
|
||||
|
||||
/**
|
||||
* Return a hashcode for this currency.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public int hashCode() {
|
||||
return isoCode.hashCode();
|
||||
@ -184,7 +184,7 @@ public class Currency implements Serializable {
|
||||
/**
|
||||
* Return true if rhs is a Currency instance,
|
||||
* is non-null, and has the same currency code.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public boolean equals(Object rhs) {
|
||||
try {
|
||||
@ -197,7 +197,7 @@ public class Currency implements Serializable {
|
||||
|
||||
/**
|
||||
* Return true if c is non-null and has the same currency code.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public boolean equals(Currency c) {
|
||||
if (c == null) return false;
|
||||
@ -208,7 +208,7 @@ public class Currency implements Serializable {
|
||||
|
||||
/**
|
||||
* Returns the ISO 4217 3-letter code for this currency object.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public String getCurrencyCode() {
|
||||
return isoCode;
|
||||
@ -311,7 +311,7 @@ public class Currency implements Serializable {
|
||||
* be displayed for this currency.
|
||||
* @return a non-negative number of fraction digits to be
|
||||
* displayed
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public int getDefaultFractionDigits() {
|
||||
return (findData())[0].intValue();
|
||||
@ -321,7 +321,7 @@ public class Currency implements Serializable {
|
||||
* Returns the rounding increment for this currency, or 0.0 if no
|
||||
* rounding is done by this currency.
|
||||
* @return the non-negative rounding increment, or 0.0 if none
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public double getRoundingIncrement() {
|
||||
Integer[] data = findData();
|
||||
@ -348,7 +348,7 @@ public class Currency implements Serializable {
|
||||
|
||||
/**
|
||||
* Returns the ISO 4217 code for this currency.
|
||||
* @draft ICU 2.2
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
public String toString() {
|
||||
return isoCode;
|
||||
|
@ -5,8 +5,8 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/util/ULocale.java,v $
|
||||
* $Date: 2003/11/21 08:11:49 $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 2003/11/21 22:52:04 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
@ -14,6 +14,10 @@
|
||||
package com.ibm.icu.util;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.io.Serializable;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A class for replacing the java.util.Locale. This class provides all the
|
||||
@ -22,14 +26,17 @@ import java.util.Locale;
|
||||
* @author weiv
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public class ULocale implements Cloneable {
|
||||
public final class ULocale implements Serializable {
|
||||
private transient Locale locale;
|
||||
private String locName;
|
||||
|
||||
/**
|
||||
* Actual locale where data is coming from
|
||||
* Actual locale will make sense only after the alternate
|
||||
* ICU data handling framework is implemented in ICU 3.0
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public static final ULocaleDataType ACTUAL_LOCALE = new ULocaleDataType(0);
|
||||
public static final ULocaleDataType ACTUAL_LOCALE = new ULocaleDataType(0);
|
||||
|
||||
/**
|
||||
* Valid locale for an object
|
||||
@ -41,59 +48,59 @@ public class ULocale implements Cloneable {
|
||||
* Type safe enum for representing the type of locale
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public static final class ULocaleDataType{
|
||||
public static final class ULocaleDataType{
|
||||
|
||||
private int localeType;
|
||||
private int localeType;
|
||||
|
||||
private ULocaleDataType(int id){
|
||||
localeType = id;
|
||||
}
|
||||
private boolean equals(int id){
|
||||
return localeType == id;
|
||||
}
|
||||
}
|
||||
|
||||
private ULocaleDataType(int id){
|
||||
localeType = id;
|
||||
}
|
||||
private boolean equals(int id){
|
||||
return localeType == id;
|
||||
}
|
||||
}
|
||||
|
||||
private Locale locale;
|
||||
|
||||
/**
|
||||
* Convert this ULocale object to java.util.Locale object
|
||||
* @return Locale object that represents the information in this object
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public Locale toLocale() {
|
||||
return locale;
|
||||
}
|
||||
public Locale toLocale() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a ULocale object from java.util.Locale object.
|
||||
* @param loc The locale object to be converted
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public ULocale(Locale loc) {
|
||||
locale = loc;
|
||||
}
|
||||
public ULocale(Locale loc) {
|
||||
this.locName = loc.toString();
|
||||
this.locale = loc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consturct a ULocale object from a string representing the locale
|
||||
* @param locName String representation of the locale, e.g: en_US, sy-Cyrl-YU
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
*/
|
||||
public ULocale(String locName) {
|
||||
locale = new Locale(locName, "");
|
||||
}
|
||||
/**
|
||||
* Clone method. Clones this ULocale object
|
||||
* @return cloned ULocale object.
|
||||
* @draft ICU 2.8
|
||||
*/
|
||||
public Object clone() {
|
||||
try {
|
||||
ULocale copy = (ULocale) super.clone();
|
||||
copy.locale = (Locale) locale.clone();
|
||||
return copy;
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
throw new InternalError(e.toString());
|
||||
}
|
||||
}
|
||||
this.locName = locName;
|
||||
this.locale = new Locale(locName, "");
|
||||
}
|
||||
|
||||
public static ULocale getDefault() {
|
||||
return new ULocale(Locale.getDefault());
|
||||
}
|
||||
|
||||
public static final ULocale ROOT = new ULocale("");
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
|
||||
out.writeObject(locName);
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||
locName = (String)in.readObject();
|
||||
locale = new Locale(locName, "");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user