From 559a173afcd047c4e8f6a16d8c30583750fee03b Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Fri, 14 Nov 2003 23:45:01 +0000 Subject: [PATCH] ICU-2202 added getLocale API placeholders X-SVN-Rev: 13735 --- icu4j/src/com/ibm/icu/text/BreakIterator.java | 14 +++++- icu4j/src/com/ibm/icu/text/Collator.java | 13 ++++- icu4j/src/com/ibm/icu/text/DateFormat.java | 14 +++++- icu4j/src/com/ibm/icu/text/NumberFormat.java | 18 +++++-- icu4j/src/com/ibm/icu/text/UFormat.java | 22 ++++++++ icu4j/src/com/ibm/icu/util/Calendar.java | 9 ++++ icu4j/src/com/ibm/icu/util/ULocale.java | 50 +++++++++++++++++++ 7 files changed, 130 insertions(+), 10 deletions(-) create mode 100644 icu4j/src/com/ibm/icu/text/UFormat.java create mode 100644 icu4j/src/com/ibm/icu/util/ULocale.java diff --git a/icu4j/src/com/ibm/icu/text/BreakIterator.java b/icu4j/src/com/ibm/icu/text/BreakIterator.java index e1a2dfa26f5..c29ec0146b1 100755 --- a/icu4j/src/com/ibm/icu/text/BreakIterator.java +++ b/icu4j/src/com/ibm/icu/text/BreakIterator.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/BreakIterator.java,v $ - * $Date: 2003/06/04 20:24:14 $ - * $Revision: 1.23 $ + * $Date: 2003/11/14 23:45:01 $ + * $Revision: 1.24 $ * ***************************************************************************************** */ @@ -16,6 +16,7 @@ import java.lang.ref.SoftReference; import java.text.CharacterIterator; import java.text.StringCharacterIterator; import java.util.Locale; +import com.ibm.icu.util.ULocale; /** @@ -409,6 +410,15 @@ public abstract class BreakIterator implements Cloneable * @stable ICU 2.0 */ public abstract void setText(CharacterIterator newText); + + /** Get the locale for this break iterator object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @return the locale + * @draft ICU 2.8 + */ + public ULocale getLocale(ULocale.ULocaleDataType type) { + return new ULocale(""); + } /** @draft ICU 2.4 */ public static final int KIND_CHARACTER = 0; diff --git a/icu4j/src/com/ibm/icu/text/Collator.java b/icu4j/src/com/ibm/icu/text/Collator.java index 90064638e4e..9612185fe43 100755 --- a/icu4j/src/com/ibm/icu/text/Collator.java +++ b/icu4j/src/com/ibm/icu/text/Collator.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/Collator.java,v $ -* $Date: 2003/09/22 06:24:18 $ -* $Revision: 1.34 $ +* $Date: 2003/11/14 23:45:01 $ +* $Revision: 1.35 $ * ******************************************************************************* */ @@ -18,6 +18,7 @@ import java.util.Set; import com.ibm.icu.impl.ICULocaleData; import com.ibm.icu.impl.LocaleUtility; +import com.ibm.icu.util.ULocale; /** *

Collator performs locale-sensitive string comparison. A concrete @@ -726,6 +727,14 @@ public abstract class Collator implements Comparator, Cloneable */ public abstract void setVariableTop(int varTop); + /** Get the locale for this collator object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @return the locale + * @draft ICU 2.8 + */ + public ULocale getLocale(ULocale.ULocaleDataType type) { + return new ULocale(""); + } // protected constructor ------------------------------------------------- /** diff --git a/icu4j/src/com/ibm/icu/text/DateFormat.java b/icu4j/src/com/ibm/icu/text/DateFormat.java index a93c8395ada..1fb5be34854 100755 --- a/icu4j/src/com/ibm/icu/text/DateFormat.java +++ b/icu4j/src/com/ibm/icu/text/DateFormat.java @@ -8,9 +8,10 @@ package com.ibm.icu.text; import com.ibm.icu.impl.ICULocaleData; import com.ibm.icu.util.Calendar; import com.ibm.icu.util.TimeZone; +import com.ibm.icu.util.ULocale; +import com.ibm.icu.text.UFormat; import java.text.FieldPosition; -import java.text.Format; import java.text.ParseException; import java.text.ParsePosition; import java.util.Date; @@ -104,7 +105,7 @@ import java.util.MissingResourceException; * @author Mark Davis, Chen-Lieh Huang, Alan Liu * @stable ICU 2.0 */ -public abstract class DateFormat extends Format { +public abstract class DateFormat extends UFormat { /** * The calendar that DateFormat uses to produce the time field @@ -729,6 +730,15 @@ public abstract class DateFormat extends Format { return calendar.isLenient(); } + /** Get the locale for this date format object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @return the locale + * @draft ICU 2.8 + */ + public ULocale getLocale(ULocale.ULocaleDataType type) { + return new ULocale(""); + } + /** * Overrides hashCode * @stable ICU 2.0 diff --git a/icu4j/src/com/ibm/icu/text/NumberFormat.java b/icu4j/src/com/ibm/icu/text/NumberFormat.java index 25c4d93fc69..4db2f6b2cc0 100755 --- a/icu4j/src/com/ibm/icu/text/NumberFormat.java +++ b/icu4j/src/com/ibm/icu/text/NumberFormat.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NumberFormat.java,v $ - * $Date: 2003/09/18 21:03:14 $ - * $Revision: 1.30 $ + * $Date: 2003/11/14 23:45:01 $ + * $Revision: 1.31 $ * ***************************************************************************************** */ @@ -18,7 +18,6 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.math.BigInteger; import java.text.FieldPosition; -import java.text.Format; import java.text.ParseException; import java.text.ParsePosition; import java.util.Collections; @@ -29,6 +28,8 @@ import java.util.Set; import com.ibm.icu.impl.ICULocaleData; import com.ibm.icu.impl.LocaleUtility; import com.ibm.icu.util.Currency; +import com.ibm.icu.util.ULocale; +import com.ibm.icu.text.UFormat; /** * NumberFormat is the abstract base class for all number @@ -155,7 +156,7 @@ import com.ibm.icu.util.Currency; * @author Alan Liu * @stable ICU 2.0 */ -public abstract class NumberFormat extends Format { +public abstract class NumberFormat extends UFormat { // Constants used by factory methods to specify a style of format. private static final int NUMBERSTYLE = 0; @@ -916,6 +917,15 @@ public abstract class NumberFormat extends Format { return currency; } + /** Get the locale for this date format object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @return the locale + * @draft ICU 2.8 + */ + public ULocale getLocale(ULocale.ULocaleDataType type) { + return new ULocale(""); + } + // =======================privates=============================== // Hook for service diff --git a/icu4j/src/com/ibm/icu/text/UFormat.java b/icu4j/src/com/ibm/icu/text/UFormat.java new file mode 100644 index 00000000000..b2f78bc25b4 --- /dev/null +++ b/icu4j/src/com/ibm/icu/text/UFormat.java @@ -0,0 +1,22 @@ +/* + * Created on Nov 11, 2003 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +package com.ibm.icu.text; + +import java.text.Format; +import com.ibm.icu.util.ULocale; + +/** + * @author weiv + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +public abstract class UFormat extends Format { + + public abstract ULocale getLocale(ULocale.ULocaleDataType type); + +} diff --git a/icu4j/src/com/ibm/icu/util/Calendar.java b/icu4j/src/com/ibm/icu/util/Calendar.java index 7d7d9960ea3..cc51ee1b3c4 100755 --- a/icu4j/src/com/ibm/icu/util/Calendar.java +++ b/icu4j/src/com/ibm/icu/util/Calendar.java @@ -3597,6 +3597,15 @@ public abstract class Calendar implements Serializable, Cloneable { // End of weekend support //------------------------------------------------------------------------- + /** Get the locale for this calendar object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @return the locale + * @draft ICU 2.8 + */ + public ULocale getLocale(ULocale.ULocaleDataType type) { + return new ULocale(""); + } + /** * Overrides Cloneable * @stable ICU 2.0 diff --git a/icu4j/src/com/ibm/icu/util/ULocale.java b/icu4j/src/com/ibm/icu/util/ULocale.java new file mode 100644 index 00000000000..a168358177a --- /dev/null +++ b/icu4j/src/com/ibm/icu/util/ULocale.java @@ -0,0 +1,50 @@ +/* + * Created on Nov 11, 2003 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +package com.ibm.icu.util; + +import java.util.Locale; + +/** + * @author weiv + * + * To change the template for this generated type comment go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +public class ULocale { + public static final class ULocaleDataType{ + /** + * Actual locale where data is coming from + * @draft ICU 2.8 + */ + public static final ULocaleDataType ACTUAL_LOCALE = new ULocaleDataType(0); + + /** + * Valid locale for an object + * @draft ICU 2.8 + */ + public static final ULocaleDataType VALID_LOCALE = new ULocaleDataType(1); + + private int localeType; + private ULocaleDataType(int id){ + localeType = id; + } + private boolean equals(int id){ + return localeType == id; + } + } + + private Locale locale; + public Locale toLocale() { + return locale; + } + public ULocale(Locale loc) { + locale = loc; + } + public ULocale(String locName) { + locale = new Locale(locName); + } +}