]> granicus.if.org Git - icu/commitdiff
ICU-7946 Merging com.ibm.icu.base and com.ibm.icu.base.tests plug-in implementation...
authorYoshito Umaoka <y.umaoka@gmail.com>
Fri, 28 Jan 2011 05:19:22 +0000 (05:19 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Fri, 28 Jan 2011 05:19:22 +0000 (05:19 +0000)
X-SVN-Rev: 29378

65 files changed:
.gitattributes
eclipse-build/build.properties
eclipse-build/build.xml
eclipse-build/features.template/com.ibm.icu.base/.project [new file with mode: 0644]
eclipse-build/features.template/com.ibm.icu.base/build.properties [new file with mode: 0644]
eclipse-build/features.template/com.ibm.icu.base/feature.xml [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/.classpath [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/.project [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/META-INF/MANIFEST.MF [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/build.properties [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/plugin.properties [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/BreakIteratorTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CalendarTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollationKeyTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollatorTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatSymbolsTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatSymbolsTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ICUTestCase.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/MessageFormatTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/NumberFormatTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/SimpleDateFormatTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/TimeZoneTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ULocaleTest.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/.classpath [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/.project [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.ui.prefs [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/META-INF/MANIFEST.MF [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/build.properties [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/plugin.properties [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/ICUCache.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDParser.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDs.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleUtility.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/SimpleCache.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/locale/AsciiUtil.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/BigDecimal.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/MathContext.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Bidi.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiClassifier.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiRun.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BreakIterator.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CollationKey.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Collator.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CurrencyPluralInfo.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormat.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormatSymbols.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormat.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormatSymbols.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/MessageFormat.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/NumberFormat.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/RawCollationKey.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/SimpleDateFormat.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UFormat.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UnicodeSet.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Calendar.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Currency.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/CurrencyAmount.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/TimeZone.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/ULocale.java [new file with mode: 0644]
eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/VersionInfo.java [new file with mode: 0644]

index 74bee93cbe5b7c46fe86d3d00ed3c423ccef309f..65b22c7b13390033f0960a791f021e253021bc2b 100644 (file)
@@ -52,6 +52,68 @@ README text !eol
 demos/manifest.stub -text
 eclipse-build/eclipse_mod_classes.txt -text
 eclipse-build/eclipse_mod_test_classes.txt -text
+eclipse-build/features.template/com.ibm.icu.base/.project -text
+eclipse-build/features.template/com.ibm.icu.base/build.properties -text
+eclipse-build/features.template/com.ibm.icu.base/feature.xml -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/.classpath -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/.project -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.core.prefs -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.ui.prefs -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/META-INF/MANIFEST.MF -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/build.properties -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/plugin.properties -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/BreakIteratorTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CalendarTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollationKeyTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollatorTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatSymbolsTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatSymbolsTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ICUTestCase.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/MessageFormatTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/NumberFormatTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/SimpleDateFormatTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/TimeZoneTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ULocaleTest.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/.classpath -text
+eclipse-build/plugins.template/com.ibm.icu.base/.project -text
+eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.core.prefs -text
+eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.ui.prefs -text
+eclipse-build/plugins.template/com.ibm.icu.base/META-INF/MANIFEST.MF -text
+eclipse-build/plugins.template/com.ibm.icu.base/build.properties -text
+eclipse-build/plugins.template/com.ibm.icu.base/plugin.properties -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/ICUCache.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDParser.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDs.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleUtility.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/SimpleCache.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/locale/AsciiUtil.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/BigDecimal.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/MathContext.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Bidi.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiClassifier.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiRun.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BreakIterator.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CollationKey.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Collator.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CurrencyPluralInfo.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormat.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormatSymbols.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormat.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormatSymbols.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/MessageFormat.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/NumberFormat.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/RawCollationKey.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/SimpleDateFormat.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UFormat.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UnicodeSet.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Calendar.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Currency.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/CurrencyAmount.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/TimeZone.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/ULocale.java -text
+eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/VersionInfo.java -text
 eclipse-build/plugins.template/com.ibm.icu.tests/META-INF/MANIFEST.MF -text
 eclipse-build/plugins.template/com.ibm.icu.tests/plugin.properties -text
 eclipse-build/plugins.template/com.ibm.icu/META-INF/MANIFEST.MF -text
index 031f9134c6c620bf732282e3148a7e90c5b98b0d..15f2f7c111e3b08b8d3df7e52019278c0780eb2d 100644 (file)
@@ -5,4 +5,4 @@
 icu4j.plugin.impl.version.string=4.4.2
 copyright.eclipse=Licensed Materials - Property of IBM \n (C) Copyright IBM Corp. 2000, 2011. All Rights Reserved. \n IBM is a registered trademark of IBM Corp.
 icu4j.data.version.number=44
-icu4j.eclipse.build.version.string=4.4.2.v20110115
+icu4j.eclipse.build.version.string=4.4.2.v20110128
index 86d82e97fd074e55967d62dd0d709e73a6a0a723..282243fd8266a46c1807062721f20badacaf50ee 100644 (file)
@@ -27,7 +27,7 @@
   </target>
 
   <target name="build"
-          depends="initEnv,icuProjectFiles,icuTestsProjectFiles"
+          depends="initEnv,icuProjectFiles,icuTestsProjectFiles,icuBaseProjectFiles,icuBaseTestsProjectFiles"
           description="Build icu4j plug-ins">
 
     <!-- copy OSGi jar file to baseLocation -->
       <param name="icu.plugin.id" value="com.ibm.icu"/>
     </antcall>
 
+    <antcall target="runEclipsePDEBuild">
+      <param name="icu.plugin.id" value="com.ibm.icu.base"/>
+    </antcall>
+
   </target>
 
   <target name="build-tools" description="Build build-tool classes">
 
     <delete failonerror="no">
       <fileset dir="${eclipse.projects.dir}/plugins/com.ibm.icu.tests" />
-      <fileset dir="${eclipse.projects.dir}/features/com.ibm.icu.tests" />
     </delete>
 
     <!-- icu test source -->
 
   </target>
 
+  <target name="icuBaseProjectFiles"
+        depends="initPluginVersion"
+        description="Copy com.ibm.icu.base plug-in project files">
+
+    <delete failonerror="no">
+      <fileset dir="${eclipse.projects.dir}/plugins/com.ibm.icu.base" />
+      <fileset dir="${eclipse.projects.dir}/features/com.ibm.icu.base" />
+    </delete>
+
+    <!-- plugin project -->
+    <copy todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base">
+      <fileset dir="plugins.template/com.ibm.icu.base"/>
+      <filterset>
+        <filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
+        <filter token="COPYRIGHT" value="${copyright.eclipse}" />
+        <filter token="IMPL_VERSION" value="${icu4j.impl.version}" />
+        <filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
+      </filterset>
+    </copy>
+
+    <!-- license -->
+    <copy file="${shared.dir}/licenses/license.html"
+          todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base/about_files" />
+
+    <!-- about -->
+    <copy file="misc/about_icu.html"
+          tofile="${eclipse.projects.dir}/plugins/com.ibm.icu.base/about.html" />
+
+    <!-- FEATURE FILES -->
+    <copy todir="${eclipse.projects.dir}/features/com.ibm.icu.base">
+      <fileset dir="features.template/com.ibm.icu.base"/>
+      <filterset>
+        <filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
+        <filter token="COPYRIGHT" value="${copyright.eclipse}" />
+        <filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
+      </filterset>
+    </copy>
+
+  </target>
+
+  <target name="icuBaseTestsProjectFiles"
+        depends="initPluginVersion"
+        description="Copy com.ibm.icu.base.tests plug-in project files">
+
+    <delete failonerror="no">
+      <fileset dir="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests" />
+    </delete>
+
+    <!-- plugin project -->
+    <copy todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests">
+      <fileset dir="plugins.template/com.ibm.icu.base.tests"/>
+      <filterset>
+        <filter token="BUILD_VERSION" value="${icu4j.eclipse.build.version.string}" />
+        <filter token="COPYRIGHT" value="${copyright.eclipse}" />
+        <filter token="IMPL_VERSION" value="${icu4j.impl.version}" />
+        <filter token="DATA_VERSION_NUMBER" value="${icu4j.data.version.number}" />
+      </filterset>
+    </copy>
+
+    <!-- license -->
+    <copy file="${shared.dir}/licenses/license.html"
+          todir="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests/about_files" />
+
+    <!-- about -->
+    <copy file="misc/about_icu.html"
+          tofile="${eclipse.projects.dir}/plugins/com.ibm.icu.base.tests/about.html" />
+
+  </target>
+
 </project>
\ No newline at end of file
diff --git a/eclipse-build/features.template/com.ibm.icu.base/.project b/eclipse-build/features.template/com.ibm.icu.base/.project
new file mode 100644 (file)
index 0000000..db8f930
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>com.ibm.icu.base-feature</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.FeatureBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.pde.FeatureNature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/eclipse-build/features.template/com.ibm.icu.base/build.properties b/eclipse-build/features.template/com.ibm.icu.base/build.properties
new file mode 100644 (file)
index 0000000..9d55f55
--- /dev/null
@@ -0,0 +1,20 @@
+###############################################################################\r
+# Copyright (c) 2011 IBM Corporation and others.\r
+# All rights reserved. This program and the accompanying materials\r
+# are made available under the terms of the Eclipse Public License v1.0\r
+# which accompanies this distribution, and is available at\r
+# http://www.eclipse.org/legal/epl-v10.html\r
+# \r
+# Contributors:\r
+#     IBM Corporation - initial API and implementation\r
+###############################################################################\r
+bin.includes =\\r
+epl-v10.html,\\r
+eclipse_update_120.jpg,\\r
+feature.xml,\\r
+feature.properties,\\r
+license.html\r
+outputUpdateJars = true\r
+\r
+generate.plugin@com.ibm.icu.base.source=com.ibm.icu.base\r
+\r
diff --git a/eclipse-build/features.template/com.ibm.icu.base/feature.xml b/eclipse-build/features.template/com.ibm.icu.base/feature.xml
new file mode 100644 (file)
index 0000000..367bcd2
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<feature\r
+      id="com.ibm.icu.base"\r
+      label="com.ibm.icu.base"\r
+      version="@BUILD_VERSION@">\r
+\r
+   <description url="http://www.example.com/description">\r
+      [Enter Feature Description here.]\r
+   </description>\r
+\r
+   <copyright url="http://www.example.com/copyright">\r
+      [Enter Copyright Description here.]\r
+   </copyright>\r
+\r
+   <license url="http://www.example.com/license">\r
+      [Enter License Description here.]\r
+   </license>\r
+\r
+   <plugin\r
+         id="com.ibm.icu.base"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="@BUILD_VERSION@"\r
+         unpack="false"/>\r
+\r
+   <plugin\r
+         id="com.ibm.icu.base.source"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="@BUILD_VERSION@"\r
+         unpack="false"/>\r
+\r
+</feature>\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/.classpath b/eclipse-build/plugins.template/com.ibm.icu.base.tests/.classpath
new file mode 100644 (file)
index 0000000..45f024e
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/.project b/eclipse-build/plugins.template/com.ibm.icu.base.tests/.project
new file mode 100644 (file)
index 0000000..3beefc7
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>com.ibm.icu.base.tests</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.ManifestBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.SchemaBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.pde.PluginNature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.core.prefs b/eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..9e89b12
--- /dev/null
@@ -0,0 +1,78 @@
+#Thu Jan 13 17:45:06 EST 2011\r
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled\r
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning\r
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore\r
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning\r
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning\r
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore\r
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore\r
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning\r
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning\r
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled\r
+org.eclipse.jdt.core.compiler.problem.deprecation=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled\r
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore\r
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled\r
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning\r
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled\r
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled\r
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning\r
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore\r
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore\r
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore\r
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled\r
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore\r
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore\r
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning\r
+org.eclipse.jdt.core.compiler.problem.nullReference=warning\r
+org.eclipse.jdt.core.compiler.source=1.5\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore\r
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled\r
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore\r
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning\r
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning\r
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning\r
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore\r
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning\r
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning\r
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore\r
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore\r
+org.eclipse.jdt.core.compiler.problem.deadCode=ignore\r
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled\r
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled\r
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore\r
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning\r
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore\r
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning\r
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore\r
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore\r
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled\r
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning\r
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.ui.prefs b/eclipse-build/plugins.template/com.ibm.icu.base.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..d57be9d
--- /dev/null
@@ -0,0 +1,3 @@
+#Thu Dec 14 11:51:01 EST 2006\r
+eclipse.preferences.version=1\r
+internal.default.compliance=default\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/META-INF/MANIFEST.MF b/eclipse-build/plugins.template/com.ibm.icu.base.tests/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..fccd740
--- /dev/null
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0\r
+Bundle-ManifestVersion: 2\r
+Bundle-Name: %pluginName\r
+Bundle-SymbolicName: com.ibm.icu.base.tests\r
+Bundle-Version: @BUILD_VERSION@\r
+Bundle-Vendor: %providerName\r
+Fragment-Host: com.ibm.icu.base\r
+Bundle-Copyright: @COPYRIGHT@\r
+Require-Bundle: org.junit\r
+Bundle-RequiredExecutionEnvironment: J2SE-1.5\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/build.properties b/eclipse-build/plugins.template/com.ibm.icu.base.tests/build.properties
new file mode 100644 (file)
index 0000000..b6bb464
--- /dev/null
@@ -0,0 +1,17 @@
+###############################################################################\r
+# Copyright (c) 2000, 2011 IBM Corporation and others.\r
+# All rights reserved. This program and the accompanying materials\r
+# are made available under the terms of the Eclipse Public License v1.0\r
+# which accompanies this distribution, and is available at\r
+# http://www.eclipse.org/legal/epl-v10.html\r
+# \r
+# Contributors:\r
+#     IBM Corporation - initial API and implementation\r
+###############################################################################\r
+source.. = src/\r
+output.. = bin/\r
+bin.includes = .,\\r
+               about.html,\\r
+               about_files/,\\r
+               plugin.properties,\\r
+               META-INF/\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/plugin.properties b/eclipse-build/plugins.template/com.ibm.icu.base.tests/plugin.properties
new file mode 100644 (file)
index 0000000..a991df0
--- /dev/null
@@ -0,0 +1,12 @@
+###############################################################################\r
+# Copyright (c) 2011 IBM Corporation and others.\r
+# All rights reserved. This program and the accompanying materials \r
+# are made available under the terms of the Eclipse Public License v1.0\r
+# which accompanies this distribution, and is available at\r
+# http://www.eclipse.org/legal/epl-v10.html\r
+# \r
+# Contributors:\r
+#     IBM Corporation - initial API and implementation\r
+###############################################################################\r
+pluginName = International Components for Unicode for Java (ICU4J) Replacement plug-in Tests\r
+providerName = IBM Corporation
\ No newline at end of file
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/BreakIteratorTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/BreakIteratorTest.java
new file mode 100644 (file)
index 0000000..6b26f3b
--- /dev/null
@@ -0,0 +1,359 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.text.CharacterIterator;\r
+import java.text.StringCharacterIterator;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.BreakIterator;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class BreakIteratorTest extends ICUTestCase {\r
+    // ICU behaves a bit differently with this text, but the tested values aren't\r
+    // affected.  If Java changes behavior they might need to change.\r
+    private static final String text = "Mr. and Mrs. Mumblety-Peg paid $35.97 for a new 12\" cockatoo. " +\r
+        "When they got home they both cooed \"Isn't it lovely?\" and sighed softly. " +\r
+        "\"Let's name it u\u0308\u5098!\" they said with glee.";\r
+    private static int pos = text.indexOf("sn't");\r
+    private static BreakIterator cbr;\r
+    private static BreakIterator wbr;\r
+    private static BreakIterator lbr;\r
+    private static BreakIterator sbr;\r
+        \r
+    static {\r
+        cbr = BreakIterator.getCharacterInstance();\r
+        cbr.setText(text);\r
+        wbr = BreakIterator.getWordInstance();\r
+        wbr.setText(text);\r
+        lbr = BreakIterator.getLineInstance();\r
+        lbr.setText(text);\r
+        sbr = BreakIterator.getSentenceInstance();\r
+        sbr.setText(text);\r
+                \r
+        // diagnostic\r
+        //              dump(cbr);\r
+        //              dump(wbr);\r
+        //              dump(lbr);\r
+        //              dump(sbr);\r
+    }\r
+        \r
+    //      private static void dump(BreakIterator bi) {\r
+    //              for (int ix = bi.first(), lim = text.length(); ix != lim;) {\r
+    //                      int nx = bi.next();\r
+    //                      if (nx < 0) nx = lim;\r
+    //                      System.out.println(Integer.toString(ix) + ": " + text.substring(ix, nx));\r
+    //                      ix = nx;\r
+    //              }\r
+    //      }\r
+        \r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        BreakIterator br = BreakIterator.getWordInstance();\r
+        br.setText(text);\r
+        BreakIterator brne = BreakIterator.getWordInstance();\r
+        brne.setText(text + "X");\r
+        wbr.first();\r
+        testEHCS(br, wbr, brne);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.BreakIterator(BreakIterator)'\r
+     */\r
+    public void testBreakIterator() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.first()'\r
+     */\r
+    public void testFirst() {\r
+        assertEquals(0, cbr.first());\r
+        assertEquals(0, wbr.first());\r
+        assertEquals(0, lbr.first());\r
+        assertEquals(0, sbr.first());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.last()'\r
+     */\r
+    public void testLast() {\r
+        assertEquals(text.length(), cbr.last());\r
+        assertEquals(text.length(), wbr.last());\r
+        assertEquals(text.length(), lbr.last());\r
+        assertEquals(text.length(), sbr.last());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.next(int)'\r
+     */\r
+    public void testNextInt() {\r
+        cbr.first();\r
+        wbr.first();\r
+        lbr.first();\r
+        sbr.first();\r
+        assertEquals(2, cbr.next(2));\r
+        assertEquals(3, wbr.next(2));\r
+        assertEquals(8, lbr.next(2));\r
+        assertEquals(62, sbr.next(2));\r
+                \r
+        cbr.last();\r
+        wbr.last();\r
+        lbr.last();\r
+        sbr.last();\r
+        assertEquals(174, cbr.next(-2));\r
+        assertEquals(171, wbr.next(-2));\r
+        assertEquals(166, lbr.next(-2));\r
+        assertEquals(135, sbr.next(-2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.next()'\r
+     */\r
+    public void testNext() {\r
+        cbr.first();\r
+        wbr.first();\r
+        lbr.first();\r
+        sbr.first();\r
+        assertEquals(1, cbr.next());\r
+        assertEquals(2, wbr.next());\r
+        assertEquals(4, lbr.next());\r
+        assertEquals(13, sbr.next());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.previous()'\r
+     */\r
+    public void testPrevious() {\r
+        cbr.last();\r
+        wbr.last();\r
+        lbr.last();\r
+        sbr.last();\r
+        assertEquals(175, cbr.previous());\r
+        assertEquals(175, wbr.previous());\r
+        assertEquals(171, lbr.previous());\r
+        assertEquals(156, sbr.previous());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.following(int)'\r
+     */\r
+    public void testFollowing() {\r
+        assertEquals(100, cbr.following(pos));\r
+        assertEquals(103, wbr.following(pos));\r
+        assertEquals(104, lbr.following(pos));\r
+        assertEquals(116, sbr.following(pos));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.preceding(int)'\r
+     */\r
+    public void testPreceding() {\r
+        assertEquals(98, cbr.preceding(pos));\r
+        assertEquals(98, wbr.preceding(pos));\r
+        assertEquals(97, lbr.preceding(pos));\r
+        assertEquals(62, sbr.preceding(pos));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.isBoundary(int)'\r
+     */\r
+    public void testIsBoundary() {\r
+        assertTrue(cbr.isBoundary(pos));\r
+        assertFalse(wbr.isBoundary(pos));\r
+        assertFalse(lbr.isBoundary(pos));\r
+        assertFalse(sbr.isBoundary(pos));\r
+\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.current()'\r
+     */\r
+    public void testCurrent() {\r
+        cbr.following(pos);\r
+        wbr.following(pos);\r
+        lbr.following(pos);\r
+        sbr.following(pos);\r
+        assertEquals(100, cbr.current());\r
+        assertEquals(103, wbr.current());\r
+        assertEquals(104, lbr.current());\r
+        assertEquals(116, sbr.current());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getText()'\r
+     */\r
+    public void testGetText() {\r
+        CharacterIterator ci = cbr.getText();\r
+        StringBuffer buf = new StringBuffer(ci.getEndIndex() - ci.getBeginIndex());\r
+        for (char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) {\r
+            buf.append(c);\r
+        }\r
+        String result = buf.toString();\r
+        assertEquals(text, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.setText(String)'\r
+     */\r
+    public void testSetTextString() {\r
+        // implicitly tested\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.setText(CharacterIterator)'\r
+     */\r
+    public void testSetTextCharacterIterator() {\r
+        CharacterIterator ci = new StringCharacterIterator(text, pos);\r
+        BreakIterator bi = BreakIterator.getWordInstance();\r
+        bi.setText(ci);\r
+        assertEquals(2, bi.next());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getWordInstance()'\r
+     */\r
+    public void testGetWordInstance() {\r
+        // implicitly tested\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getWordInstance(Locale)'\r
+     */\r
+    public void testGetWordInstanceLocale() {\r
+        assertNotNull(BreakIterator.getWordInstance(Locale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getWordInstance(ULocale)'\r
+     */\r
+    public void testGetWordInstanceULocale() {\r
+        assertNotNull(BreakIterator.getWordInstance(ULocale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getLineInstance()'\r
+     */\r
+    public void testGetLineInstance() {\r
+        // implicitly tested\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getLineInstance(Locale)'\r
+     */\r
+    public void testGetLineInstanceLocale() {\r
+        assertNotNull(BreakIterator.getLineInstance(Locale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getLineInstance(ULocale)'\r
+     */\r
+    public void testGetLineInstanceULocale() {\r
+        assertNotNull(BreakIterator.getLineInstance(ULocale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getCharacterInstance()'\r
+     */\r
+    public void testGetCharacterInstance() {\r
+        // implicitly tested\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getCharacterInstance(Locale)'\r
+     */\r
+    public void testGetCharacterInstanceLocale() {\r
+        assertNotNull(BreakIterator.getCharacterInstance(Locale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getCharacterInstance(ULocale)'\r
+     */\r
+    public void testGetCharacterInstanceULocale() {\r
+        assertNotNull(BreakIterator.getCharacterInstance(ULocale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getSentenceInstance()'\r
+     */\r
+    public void testGetSentenceInstance() {\r
+        // implicitly tested\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getSentenceInstance(Locale)'\r
+     */\r
+    public void testGetSentenceInstanceLocale() {\r
+        assertNotNull(BreakIterator.getSentenceInstance(Locale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getSentenceInstance(ULocale)'\r
+     */\r
+    public void testGetSentenceInstanceULocale() {\r
+        assertNotNull(BreakIterator.getSentenceInstance(ULocale.JAPAN));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getTitleInstance()'\r
+     */\r
+    public void testGetTitleInstance() {\r
+        // not implemented\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getTitleInstance(Locale)'\r
+     */\r
+    public void testGetTitleInstanceLocale() {\r
+        // not implemented\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getTitleInstance(ULocale)'\r
+     */\r
+    public void testGetTitleInstanceULocale() {\r
+        // not implemented\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getAvailableLocales()'\r
+     */\r
+    public void testGetAvailableLocales() {\r
+        assertNotNull(BreakIterator.getAvailableLocales());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.getAvailableULocales()'\r
+     */\r
+    public void testGetAvailableULocales() {\r
+        assertNotNull(BreakIterator.getAvailableULocales());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.toString()'\r
+     */\r
+    public void testToString() {\r
+        assertNotNull(cbr.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.clone()'\r
+     */\r
+    public void testClone() {\r
+        // see testHashCode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.BreakIterator.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // see testHashCode\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CalendarTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CalendarTest.java
new file mode 100644 (file)
index 0000000..69195a2
--- /dev/null
@@ -0,0 +1,565 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.util.Date;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DateFormat;\r
+import com.ibm.icu.util.Calendar;\r
+import com.ibm.icu.util.TimeZone;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class CalendarTest extends ICUTestCase {\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        Calendar cal1 = Calendar.getInstance();\r
+        Calendar cal2 = Calendar.getInstance();\r
+        Calendar cal3 = Calendar.getInstance();\r
+\r
+        long t = System.currentTimeMillis();\r
+        cal1.setTimeInMillis(t);\r
+        cal2.setTimeInMillis(t);\r
+        cal3.setTimeInMillis(t);\r
+\r
+        cal3.setMinimalDaysInFirstWeek(cal3.getMinimalDaysInFirstWeek()+1);\r
+        testEHCS(cal1, cal2, cal3);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.Calendar(Calendar)'\r
+     */\r
+    public void testCalendar() {\r
+        // tested implicitly everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getInstance()'\r
+     */\r
+    public void testGetInstance() {\r
+        // tested by testEHCS\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getInstance(TimeZone)'\r
+     */\r
+    public void testGetInstanceTimeZone() {\r
+        TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");\r
+        Calendar cal = Calendar.getInstance(tz);\r
+        assertNotNull(cal);\r
+        assertNotNull(cal.getTime());\r
+        assertEquals(tz, cal.getTimeZone());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getInstance(Locale)'\r
+     */\r
+    public void testGetInstanceLocale() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        assertNotNull(cal);\r
+        assertNotNull(cal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getInstance(ULocale)'\r
+     */\r
+    public void testGetInstanceULocale() {\r
+        Calendar cal = Calendar.getInstance(ULocale.US);\r
+        assertNotNull(cal);\r
+        assertNotNull(cal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getInstance(TimeZone, Locale)'\r
+     */\r
+    public void testGetInstanceTimeZoneLocale() {\r
+        TimeZone tz = TimeZone.getTimeZone("America/New_York");\r
+        Calendar cal = Calendar.getInstance(tz, Locale.US);\r
+        assertNotNull(cal);\r
+        assertNotNull(cal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getInstance(TimeZone, ULocale)'\r
+     */\r
+    public void testGetInstanceTimeZoneULocale() {\r
+        TimeZone tz = TimeZone.getTimeZone("America/New_York");\r
+        Calendar cal = Calendar.getInstance(tz, ULocale.US);\r
+        assertNotNull(cal);\r
+        assertNotNull(cal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getAvailableLocales()'\r
+     */\r
+    public void testGetAvailableLocales() {\r
+        assertNotNull(Calendar.getAvailableLocales());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getAvailableULocales()'\r
+     */\r
+    public void testGetAvailableULocales() {\r
+        assertNotNull(Calendar.getAvailableULocales());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getTime()'\r
+     */\r
+    public void testGetTime() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertNotNull(cal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.setTime(Date)'\r
+     */\r
+    public void testSetTime() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.clear();\r
+        cal.set(2006, 0, 20, 9, 30, 0);\r
+        Date date = cal.getTime();\r
+        cal = Calendar.getInstance();\r
+        cal.setTime(date);\r
+        assertEquals(date, cal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getTimeInMillis()'\r
+     */\r
+    public void testGetTimeInMillis() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertTrue(0 != cal.getTimeInMillis());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.setTimeInMillis(long)'\r
+     */\r
+    public void testSetTimeInMillis() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.clear();\r
+        cal.set(2006, 0, 20, 9, 30, 0);\r
+        long millis = cal.getTimeInMillis();\r
+        Date date = cal.getTime();\r
+        \r
+        cal = Calendar.getInstance();\r
+        cal.setTimeInMillis(millis);\r
+        \r
+        assertEquals(date, cal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.get(int)'\r
+     */\r
+    public void testGet() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.clear();\r
+        cal.set(2006, 0, 20, 9, 30, 0);\r
+        assertEquals(0, cal.get(Calendar.MONTH));\r
+        assertEquals(20, cal.get(Calendar.DAY_OF_MONTH));\r
+        assertEquals(30, cal.get(Calendar.MINUTE));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.set(int, int)'\r
+     */\r
+    public void testSetIntInt() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(Calendar.YEAR, 1977);\r
+        assertEquals(1977, cal.get(Calendar.YEAR));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.set(int, int, int)'\r
+     */\r
+    public void testSetIntIntInt() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(1997, 9, 15);\r
+        assertEquals(15, cal.get(Calendar.DATE));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.set(int, int, int, int, int)'\r
+     */\r
+    public void testSetIntIntIntIntInt() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(1997, 9, 15, 14, 25);\r
+        assertEquals(25, cal.get(Calendar.MINUTE));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.set(int, int, int, int, int, int)'\r
+     */\r
+    public void testSetIntIntIntIntIntInt() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(1997, 9, 15, 14, 25, 51);\r
+        assertEquals(51, cal.get(Calendar.SECOND));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.clear()'\r
+     */\r
+    public void testClear() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(1997, 9, 15, 14, 25, 51);\r
+        cal.clear();\r
+        assertEquals(0, cal.get(Calendar.MONTH));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.clear(int)'\r
+     */\r
+    public void testClearInt() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(1997, 9, 15, 14, 25, 51);\r
+        assertTrue(cal.isSet(Calendar.DAY_OF_MONTH));\r
+        cal.clear(Calendar.DAY_OF_MONTH);\r
+        assertFalse(cal.isSet(Calendar.DAY_OF_MONTH));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.isSet(int)'\r
+     */\r
+    public void testIsSet() {\r
+        // see testClearInt\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // tested by testHashCode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.isEquivalentTo(Calendar)'\r
+     */\r
+    public void testIsEquivalentTo() {\r
+        Calendar cal = Calendar.getInstance();\r
+        Calendar cal2 = Calendar.getInstance();\r
+        cal2.set(1994, 6, 21, 8, 7);\r
+        assertTrue(cal.isEquivalentTo(cal2));\r
+        cal.setTimeZone(TimeZone.getTimeZone("CST"));\r
+        cal2.setTimeZone(TimeZone.getTimeZone("PDT"));\r
+        assertFalse(cal.isEquivalentTo(cal2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.before(Object)'\r
+     */\r
+    public void testBefore() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(Calendar.YEAR, 1990);\r
+        assertTrue(cal.before(new Date()));\r
+        assertTrue(cal.before(Calendar.getInstance()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.after(Object)'\r
+     */\r
+    public void testAfter() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(Calendar.YEAR, 3058);\r
+        assertTrue(cal.after(new Date()));\r
+        assertTrue(cal.after(Calendar.getInstance()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getActualMaximum(int)'\r
+     */\r
+    public void testGetActualMaximum() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        assertEquals(11, cal.getActualMaximum(Calendar.MONTH));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getActualMinimum(int)'\r
+     */\r
+    public void testGetActualMinimum() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        assertEquals(0, cal.getActualMinimum(Calendar.MONTH));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.roll(int, boolean)'\r
+     */\r
+    public void testRollIntBoolean() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        cal.set(1997, 1, 27);\r
+        cal.roll(Calendar.DATE, true);\r
+        assertEquals(28, cal.get(Calendar.DATE));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.roll(int, int)'\r
+     */\r
+    public void testRollIntInt() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        cal.set(1997, 1, 27);\r
+        cal.roll(Calendar.DATE, 3);\r
+        assertEquals(2, cal.get(Calendar.DATE));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.add(int, int)'\r
+     */\r
+    public void testAdd() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        cal.set(1997, 1, 27);\r
+        cal.add(Calendar.DATE, 3);\r
+        assertEquals(2, cal.get(Calendar.DATE));\r
+        assertEquals(2, cal.get(Calendar.MONTH));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getDisplayName(Locale)'\r
+     */\r
+    public void testGetDisplayNameLocale() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertEquals("Gregorian Calendar", cal.getDisplayName(Locale.US));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getDisplayName(ULocale)'\r
+     */\r
+    public void testGetDisplayNameULocale() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertEquals("Gregorian Calendar", cal.getDisplayName(ULocale.US));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.compareTo(Calendar)'\r
+     */\r
+    public void testCompareToCalendar() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(Calendar.YEAR, 1990);\r
+        assertTrue(0 > cal.compareTo(Calendar.getInstance()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.compareTo(Object)'\r
+     */\r
+    public void testCompareToObject() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(Calendar.YEAR, 1990);\r
+        assertTrue(0 > cal.compareTo(Calendar.getInstance()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getDateTimeFormat(int, int, Locale)'\r
+     */\r
+    public void testGetDateTimeFormatIntIntLocale() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(1990, 8, 16, 20, 3);\r
+        DateFormat df = cal.getDateTimeFormat(DateFormat.LONG, DateFormat.SHORT, Locale.US);\r
+        assertEquals("September 16, 1990 8:03 PM", df.format(cal));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getDateTimeFormat(int, int, ULocale)'\r
+     */\r
+    public void testGetDateTimeFormatIntIntULocale() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(1990, 8, 16, 20, 3);\r
+        DateFormat df = cal.getDateTimeFormat(DateFormat.LONG, DateFormat.SHORT, ULocale.US);\r
+        assertEquals("September 16, 1990 8:03 PM", df.format(cal));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.fieldDifference(Date, int)'\r
+     */\r
+    public void testFieldDifference() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(Calendar.DAY_OF_MONTH, 0);\r
+        Date date = cal.getTime();\r
+        cal.add(Calendar.DAY_OF_MONTH, 5);\r
+        assertEquals(-5, cal.fieldDifference(date, Calendar.DAY_OF_MONTH));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getTimeZone()'\r
+     */\r
+    public void testGetTimeZone() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertNotNull(cal.getTimeZone());\r
+    }\r
+    \r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.setTimeZone(TimeZone)'\r
+     */\r
+    public void testSetTimeZone() {\r
+        Calendar cal = Calendar.getInstance();\r
+        TimeZone value1 = cal.getTimeZone();\r
+        String tzn = "PDT".equals(value1.getID()) ? "CST" : "PDT";\r
+        TimeZone value2 = TimeZone.getTimeZone(tzn);\r
+        cal.setTimeZone(value2);\r
+        TimeZone result = cal.getTimeZone();\r
+        assertNotEqual(value1, result);\r
+        assertEquals(value2, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.setLenient(boolean)'\r
+     */\r
+    public void testSetLenient() {\r
+        Calendar cal = Calendar.getInstance();\r
+        boolean lenient = cal.isLenient();\r
+        cal.setLenient(!lenient);\r
+        assertFalse(lenient == cal.isLenient());\r
+        \r
+        // not testing if it has the expected effect\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.isLenient()'\r
+     */\r
+    public void testIsLenient() {\r
+        // tested by testSetLenient\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.setFirstDayOfWeek(int)'\r
+     */\r
+    public void testSetFirstDayOfWeek() {\r
+        Calendar cal = Calendar.getInstance();\r
+        int firstDay = cal.getFirstDayOfWeek();\r
+        cal.setFirstDayOfWeek(firstDay+1);\r
+        assertEquals(firstDay+1, cal.getFirstDayOfWeek());\r
+\r
+        // don't test functionality\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getFirstDayOfWeek()'\r
+     */\r
+    public void testGetFirstDayOfWeek() {\r
+        // tested by testSetFirstDayOfWeek\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.setMinimalDaysInFirstWeek(int)'\r
+     */\r
+    public void testSetMinimalDaysInFirstWeek() {\r
+        Calendar cal = Calendar.getInstance();\r
+        int firstDay = cal.getMinimalDaysInFirstWeek();\r
+        cal.setMinimalDaysInFirstWeek(firstDay+1);\r
+        assertEquals(firstDay+1, cal.getMinimalDaysInFirstWeek());\r
+\r
+        // don't test functionality\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getMinimalDaysInFirstWeek()'\r
+     */\r
+    public void testGetMinimalDaysInFirstWeek() {\r
+        // tested by testSetMinimalDaysInFirstWeek\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getMinimum(int)'\r
+     */\r
+    public void testGetMinimum() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertEquals(1, cal.getMinimum(Calendar.DAY_OF_WEEK));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getMaximum(int)'\r
+     */\r
+    public void testGetMaximum() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertEquals(7, cal.getMaximum(Calendar.DAY_OF_WEEK));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getGreatestMinimum(int)'\r
+     */\r
+    public void testGetGreatestMinimum() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertEquals(1, cal.getGreatestMinimum(Calendar.DATE));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getLeastMaximum(int)'\r
+     */\r
+    public void testGetLeastMaximum() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertEquals(28, cal.getLeastMaximum(Calendar.DATE));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getDayOfWeekType(int)'\r
+     */\r
+    public void testGetDayOfWeekType() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        assertEquals(Calendar.WEEKDAY, cal.getDayOfWeekType(Calendar.FRIDAY));\r
+        assertEquals(Calendar.WEEKEND, cal.getDayOfWeekType(Calendar.SATURDAY));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getWeekendTransition(int)'\r
+     */\r
+    public void testGetWeekendTransition() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        try {\r
+            cal.getWeekendTransition(Calendar.WEEKEND_ONSET);\r
+            fail("expected IllegalArgumentException from getWeekendTransition");\r
+        }\r
+        catch (UnsupportedOperationException e) {\r
+            // ok\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.isWeekend(Date)'\r
+     */\r
+    public void testIsWeekendDate() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);\r
+        assertTrue(cal.isWeekend(cal.getTime()));\r
+        cal.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);\r
+        assertFalse(cal.isWeekend(cal.getTime()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.isWeekend()'\r
+     */\r
+    public void testIsWeekend() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);\r
+        assertTrue(cal.isWeekend());\r
+        cal.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);\r
+        assertFalse(cal.isWeekend());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.clone()'\r
+     */\r
+    public void testClone() {\r
+        // tested by testHashCode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.toString()'\r
+     */\r
+    public void testToString() {\r
+        Calendar cal = Calendar.getInstance();\r
+        assertNotNull(cal.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.Calendar.getType()'\r
+     */\r
+    public void testGetType() {\r
+        Calendar cal = Calendar.getInstance(Locale.US);\r
+        assertEquals("gregorian", cal.getType());\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollationKeyTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollationKeyTest.java
new file mode 100644 (file)
index 0000000..45725be
--- /dev/null
@@ -0,0 +1,102 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import com.ibm.icu.text.CollationKey;\r
+import com.ibm.icu.text.Collator;\r
+\r
+public class CollationKeyTest extends ICUTestCase {\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey("This");\r
+        CollationKey k2 = c.getCollationKey("this");\r
+        c.setStrength(Collator.TERTIARY);\r
+        CollationKey kn = c.getCollationKey("this");\r
+        testEHCS(k1, k2, kn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.CollationKey(CollationKey)'\r
+     */\r
+    public void testCollationKey() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.compareTo(CollationKey)'\r
+     */\r
+    public void testCompareToCollationKey() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey("This");\r
+        CollationKey k2 = c.getCollationKey("this");\r
+        c.setStrength(Collator.TERTIARY);\r
+        CollationKey k3 = c.getCollationKey("this");\r
+        assertTrue(0 == k1.compareTo(k2));\r
+        assertFalse(0 == k1.compareTo(k3));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.compareTo(Object)'\r
+     */\r
+    public void testCompareToObject() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey("This");\r
+        CollationKey k2 = c.getCollationKey("this");\r
+        assertTrue(0 == k1.compareTo(k2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey("This");\r
+        CollationKey k2 = c.getCollationKey("this");\r
+        assertTrue(k1.equals((Object)k2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.toString()'\r
+     */\r
+    public void testToString() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey("This");\r
+        assertNotNull(k1.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.getSourceString()'\r
+     */\r
+    public void testGetSourceString() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey("This");\r
+        assertEquals("This", k1.getSourceString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.CollationKey.toByteArray()'\r
+     */\r
+    public void testToByteArray() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey("This");\r
+        byte[] key = k1.toByteArray();\r
+        assertNotNull(key);\r
+        assertTrue(0 < key.length);\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollatorTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/CollatorTest.java
new file mode 100644 (file)
index 0000000..08349f1
--- /dev/null
@@ -0,0 +1,205 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.CollationKey;\r
+import com.ibm.icu.text.Collator;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class CollatorTest extends ICUTestCase {\r
+    private static final String s1 = "Fu\u0308nf"; // capital F + u + diaresis\r
+    private static final String s2 = "fu\u0308nf"; // u + diaresis\r
+    private static final String s3 = "f\u00fcnf"; // u-umlaut\r
+    private static final String s4 = "fu\u0308\u0316nf"; // u + diaresis above + grave below\r
+    private static final String s5 = "fu\u0316\u0308nf"; // u + grave below + diaresis above\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.SECONDARY);\r
+        Collator c2 = Collator.getInstance();\r
+        c2.setStrength(Collator.SECONDARY);\r
+        Collator cn = Collator.getInstance();\r
+        cn.setStrength(Collator.TERTIARY);\r
+        testEHCS(c, c2, cn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.Collator(Collator)'\r
+     */\r
+    public void testCollator() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.setStrength(int)'\r
+     */\r
+    public void testSetStrength() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        assertTrue(0 == c.compare(s1, s2));\r
+        c.setStrength(Collator.SECONDARY);\r
+        assertTrue(0 == c.compare(s1, s2));\r
+        c.setStrength(Collator.TERTIARY);\r
+        assertTrue(0 < c.compare(s1, s2));\r
+        assertTrue(0 == c.compare(s2, s3));\r
+        c.setStrength(Collator.QUATERNARY);\r
+        assertTrue(0 > c.compare(s2, s3));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.setDecomposition(int)'\r
+     */\r
+    public void testSetDecomposition() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.TERTIARY);\r
+        assertTrue(0 != c.compare(s4, s5));\r
+        c.setDecomposition(Collator.IDENTICAL);\r
+        assertTrue(0 == c.compare(s4, s5));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getInstance()'\r
+     */\r
+    public void testGetInstance() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getInstance(ULocale)'\r
+     */\r
+    public void testGetInstanceULocale() {\r
+        Collator c = Collator.getInstance(ULocale.GERMANY);\r
+        assertNotNull(c);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getInstance(Locale)'\r
+     */\r
+    public void testGetInstanceLocale() {\r
+        Collator c = Collator.getInstance(Locale.GERMANY);\r
+        assertNotNull(c);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getAvailableLocales()'\r
+     */\r
+    public void testGetAvailableLocales() {\r
+        assertNotNull(Collator.getAvailableLocales());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getAvailableULocales()'\r
+     */\r
+    public void testGetAvailableULocales() {\r
+        assertNotNull(Collator.getAvailableULocales());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getKeywords()'\r
+     */\r
+    public void testGetKeywords() {\r
+        assertEquals(0, Collator.getKeywords().length);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getKeywordValues(String)'\r
+     */\r
+    public void testGetKeywordValues() {\r
+        assertEquals(0, Collator.getKeywordValues("").length);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getStrength()'\r
+     */\r
+    public void testGetStrength() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        assertEquals(Collator.PRIMARY, c.getStrength());\r
+        c.setStrength(Collator.SECONDARY);\r
+        assertEquals(Collator.SECONDARY, c.getStrength());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getDecomposition()'\r
+     */\r
+    public void testGetDecomposition() {\r
+        Collator c = Collator.getInstance();\r
+        c.setDecomposition(Collator.CANONICAL_DECOMPOSITION);\r
+        assertEquals(Collator.CANONICAL_DECOMPOSITION, c.getDecomposition());\r
+        c.setDecomposition(Collator.NO_DECOMPOSITION);\r
+        assertEquals(Collator.NO_DECOMPOSITION, c.getDecomposition());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.compare(Object, Object)'\r
+     */\r
+    public void testCompareObjectObject() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        assertTrue(0 == c.compare((Object)s1, (Object)s2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.equals(String, String)'\r
+     */\r
+    public void testEqualsStringString() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        assertTrue(c.equals(s1, s2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.compare(String, String)'\r
+     */\r
+    public void testCompareStringString() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        assertTrue(0 == c.compare(s1, s2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.getCollationKey(String)'\r
+     */\r
+    public void testGetCollationKey() {\r
+        Collator c = Collator.getInstance();\r
+        c.setStrength(Collator.PRIMARY);\r
+        CollationKey k1 = c.getCollationKey(s1);\r
+        CollationKey k2 = c.getCollationKey(s2);\r
+        assertTrue(k1.equals(k2));\r
+        c.setStrength(Collator.TERTIARY);\r
+        k1 = c.getCollationKey(s1);\r
+        k2 = c.getCollationKey(s2);\r
+        assertFalse(k1.equals(k2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.toString()'\r
+     */\r
+    public void testToString() {\r
+        assertNotNull(Collator.getInstance().toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.clone()'\r
+     */\r
+    public void testClone() {\r
+        // tested above\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.Collator.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // tested above\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatSymbolsTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatSymbolsTest.java
new file mode 100644 (file)
index 0000000..2021969
--- /dev/null
@@ -0,0 +1,257 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DateFormatSymbols;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class DateFormatSymbolsTest extends ICUTestCase {\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        DateFormatSymbols dfs2 = new DateFormatSymbols(ULocale.US);\r
+        DateFormatSymbols dfsn = new DateFormatSymbols(Locale.US);\r
+        dfsn.setAmPmStrings(new String[] { "sw", "xw" });\r
+        testEHCS(dfs, dfs2, dfsn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.DateFormatSymbols(DateFormatSymbols)'\r
+     */\r
+    public void testDateFormatSymbolsDateFormatSymbols() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.DateFormatSymbols()'\r
+     */\r
+    public void testDateFormatSymbols() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols();\r
+        assertNotNull(dfs.getWeekdays());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.DateFormatSymbols(Locale)'\r
+     */\r
+    public void testDateFormatSymbolsLocale() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getWeekdays());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.DateFormatSymbols(ULocale)'\r
+     */\r
+    public void testDateFormatSymbolsULocale() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(ULocale.US);\r
+        assertNotNull(dfs.getWeekdays());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getEras()'\r
+     */\r
+    public void testGetEras() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getEras());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setEras(String[])'\r
+     */\r
+    public void testSetEras() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String[] oldvalue = dfs.getEras();\r
+        String[] newvalue = (String[])oldvalue.clone();\r
+        newvalue[0] = newvalue[0] + "!";\r
+        dfs.setEras(newvalue);\r
+        String[] result = dfs.getEras();\r
+        assertArraysNotEqual(oldvalue, result);\r
+        assertArraysEqual(newvalue, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getMonths()'\r
+     */\r
+    public void testGetMonths() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getMonths());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setMonths(String[])'\r
+     */\r
+    public void testSetMonths() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String[] oldvalue = dfs.getMonths();\r
+        String[] newvalue = (String[])oldvalue.clone();\r
+        newvalue[0] = newvalue[0] + "!";\r
+        dfs.setMonths(newvalue);\r
+        String[] result = dfs.getMonths();\r
+        assertArraysNotEqual(oldvalue, result);\r
+        assertArraysEqual(newvalue, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getShortMonths()'\r
+     */\r
+    public void testGetShortMonths() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getShortMonths());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setShortMonths(String[])'\r
+     */\r
+    public void testSetShortMonths() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String[] oldvalue = dfs.getShortMonths();\r
+        String[] newvalue = (String[])oldvalue.clone();\r
+        newvalue[0] = newvalue[0] + "!";\r
+        dfs.setShortMonths(newvalue);\r
+        String[] result = dfs.getShortMonths();\r
+        assertArraysNotEqual(oldvalue, result);\r
+        assertArraysEqual(newvalue, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getWeekdays()'\r
+     */\r
+    public void testGetWeekdays() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getShortMonths());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setWeekdays(String[])'\r
+     */\r
+    public void testSetWeekdays() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String[] oldvalue = dfs.getWeekdays();\r
+        String[] newvalue = (String[])oldvalue.clone();\r
+        newvalue[0] = newvalue[0] + "!";\r
+        dfs.setWeekdays(newvalue);\r
+        String[] result = dfs.getWeekdays();\r
+        assertArraysNotEqual(oldvalue, result);\r
+        assertArraysEqual(newvalue, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getShortWeekdays()'\r
+     */\r
+    public void testGetShortWeekdays() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getShortWeekdays());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setShortWeekdays(String[])'\r
+     */\r
+    public void testSetShortWeekdays() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String[] oldvalue = dfs.getShortWeekdays();\r
+        String[] newvalue = (String[])oldvalue.clone();\r
+        newvalue[0] = newvalue[0] + "!";\r
+        dfs.setShortWeekdays(newvalue);\r
+        String[] result = dfs.getShortWeekdays();\r
+        assertArraysNotEqual(oldvalue, result);\r
+        assertArraysEqual(newvalue, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getAmPmStrings()'\r
+     */\r
+    public void testGetAmPmStrings() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getAmPmStrings());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setAmPmStrings(String[])'\r
+     */\r
+    public void testSetAmPmStrings() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String[] oldvalue = dfs.getAmPmStrings();\r
+        String[] newvalue = (String[])oldvalue.clone();\r
+        newvalue[0] = newvalue[0] + "!";\r
+        dfs.setAmPmStrings(newvalue);\r
+        String[] result = dfs.getAmPmStrings();\r
+        assertArraysNotEqual(oldvalue, result);\r
+        assertArraysEqual(newvalue, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getZoneStrings()'\r
+     */\r
+    public void testGetZoneStrings() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getZoneStrings());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setZoneStrings(String[][])'\r
+     */\r
+    public void testSetZoneStrings() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String[][] oldvalue = dfs.getZoneStrings();\r
+        String[][] newvalue = (String[][])cloneComplex(oldvalue);\r
+        newvalue[0][0] = newvalue[0][0] + "!";\r
+        dfs.setZoneStrings(newvalue);\r
+        String[][] result = dfs.getZoneStrings();\r
+        assertArraysNotEqual(oldvalue, result);\r
+        assertArraysEqual(newvalue, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.getLocalPatternChars()'\r
+     */\r
+    public void testGetLocalPatternChars() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.getLocalPatternChars());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.setLocalPatternChars(String)'\r
+     */\r
+    public void testSetLocalPatternChars() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        String pat = dfs.getLocalPatternChars();\r
+        StringBuffer buf = new StringBuffer(pat);\r
+        buf.setCharAt(0, (char)(pat.charAt(0) + 1));\r
+        String pat2 = buf.toString();\r
+        dfs.setLocalPatternChars(pat2);\r
+        String pat3 = dfs.getLocalPatternChars();\r
+        assertNotEqual(pat, pat2);\r
+        assertEquals(pat2, pat3);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.toString()'\r
+     */\r
+    public void testToString() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        assertNotNull(dfs.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.clone()'\r
+     */\r
+    public void testClone() {\r
+        // tested by testHashCode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormatSymbols.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // tested by testHashCode\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DateFormatTest.java
new file mode 100644 (file)
index 0000000..37f5559
--- /dev/null
@@ -0,0 +1,454 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.text.FieldPosition;\r
+import java.text.ParseException;\r
+import java.text.ParsePosition;\r
+import java.util.Date;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DateFormat;\r
+import com.ibm.icu.text.NumberFormat;\r
+import com.ibm.icu.util.Calendar;\r
+import com.ibm.icu.util.TimeZone;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class DateFormatTest extends ICUTestCase {\r
+    private Calendar aCal;\r
+    private Calendar anESTCal;\r
+    private Date aDate;\r
+    private String aDateString;\r
+    private String aTimeString;\r
+    private String anESTTimeString;\r
+    private String aDateTimeString;\r
+    private String aShortDateTimeString;\r
+    private String aDefaultESTDateTimeString;\r
+    private DateFormat aDF;\r
+    private StringBuffer aBuf;\r
+    private FieldPosition anFP;\r
+    private FieldPosition anFPField;\r
+\r
+    private static int YEAR_POS_START = 8;\r
+    private static int YEAR_POS_END = 12;\r
+\r
+    protected void setUp() throws Exception {\r
+        super.setUp();\r
+                \r
+        java.util.GregorianCalendar gcal = new java.util.GregorianCalendar();\r
+        gcal.clear();\r
+        gcal.set(java.util.GregorianCalendar.YEAR, 1990);\r
+        gcal.set(java.util.GregorianCalendar.MONTH, java.util.GregorianCalendar.DECEMBER);\r
+        gcal.set(java.util.GregorianCalendar.DATE, 17);\r
+        gcal.set(java.util.GregorianCalendar.HOUR, 5);\r
+        gcal.set(java.util.GregorianCalendar.MINUTE, 17);\r
+        aCal = new Calendar(gcal);\r
+        anESTCal = Calendar.getInstance();\r
+        anESTCal.setTimeZone(TimeZone.getTimeZone("EST"));\r
+        aDate = gcal.getTime();\r
+        aDateString = "Dec 17, 1990"; // medium -- the default\r
+        aTimeString = "5:17:00 AM"; // medium\r
+        anESTTimeString = "8:17:00 AM";\r
+        aDateTimeString = "Dec 17, 1990 5:17:00 AM"; // medium, medium\r
+        aDefaultESTDateTimeString = "Dec 17, 1990 8:17 AM"; // medium, short -- the default\r
+        aShortDateTimeString = "12/17/90 5:17 AM"; // short, short\r
+        aDF = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.US);\r
+        aBuf = new StringBuffer();\r
+        anFP = new FieldPosition(DateFormat.YEAR_FIELD);\r
+        anFPField = new FieldPosition(DateFormat.Field.YEAR);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.hashCode()'\r
+     */\r
+    public final void testHashCode() {\r
+        DateFormat df = DateFormat.getInstance();\r
+        DateFormat eq = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);\r
+        testEHCS(df, eq, aDF);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.DateFormat(DateFormat)'\r
+     */\r
+    public final void testDateFormat() {\r
+        DateFormat df = new DateFormat(java.text.DateFormat.getInstance());\r
+        assertEquals(DateFormat.getInstance(), df);\r
+    }\r
+\r
+    private void assertEqualDateString(StringBuffer buf) {\r
+        assertEquals(aDateTimeString, buf.toString());\r
+    }\r
+        \r
+    private void assertEqualDateString(String str) {\r
+        assertEquals(aDateTimeString, str);\r
+    }\r
+        \r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.format(Object, StringBuffer, FieldPosition)'\r
+     */\r
+    public final void testFormatObjectStringBufferFieldPosition() {\r
+        assertEqualDateString(aDF.format(aDate, aBuf, anFP));\r
+        assertEquals(YEAR_POS_START, anFP.getBeginIndex());\r
+        assertEquals(YEAR_POS_END, anFP.getEndIndex());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.format(Calendar, StringBuffer, FieldPosition)'\r
+     */\r
+    public final void testFormatCalendarStringBufferFieldPosition() {\r
+        assertEqualDateString(aDF.format(aCal, aBuf, anFP));\r
+        assertEquals(YEAR_POS_START, anFP.getBeginIndex());\r
+        assertEquals(YEAR_POS_END, anFP.getEndIndex());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.format(Date, StringBuffer, FieldPosition)'\r
+     */\r
+    public final void testFormatDateStringBufferFieldPosition() {\r
+        assertEqualDateString(aDF.format(aDate, aBuf, anFPField));\r
+        assertEquals(YEAR_POS_START, anFPField.getBeginIndex());\r
+        assertEquals(YEAR_POS_END, anFPField.getEndIndex());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.format(Date)'\r
+     */\r
+    public final void testFormatDate() {\r
+        assertEqualDateString(aDF.format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.parse(String)'\r
+     */\r
+    public final void testParseString() throws Exception {\r
+        assertEquals(aDate, aDF.parse(aDateTimeString));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.parse(String, Calendar, ParsePosition)'\r
+     */\r
+    public final void testParseStringCalendarParsePosition() {\r
+        aDF.parse(aDateTimeString, aCal, new ParsePosition(0));\r
+        assertEquals(aDate, aCal.getTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.parse(String, ParsePosition)'\r
+     */\r
+    public final void testParseStringParsePosition() {\r
+        assertEquals(aDate, aDF.parse(aDateTimeString, new ParsePosition(0)));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.parseObject(String, ParsePosition)'\r
+     */\r
+    public final void testParseObjectStringParsePosition() {\r
+        assertEquals(aDate, aDF.parseObject(aDateTimeString, new ParsePosition(0)));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeInstance()'\r
+     */\r
+    public final void testGetTimeInstance() {\r
+        assertEquals(aTimeString, DateFormat.getTimeInstance().format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeInstance(int)'\r
+     */\r
+    public final void testGetTimeInstanceInt() {\r
+        assertEquals(aTimeString, DateFormat.getTimeInstance(DateFormat.MEDIUM).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeInstance(int, Locale)'\r
+     */\r
+    public final void testGetTimeInstanceIntLocale() {\r
+        assertEquals(aTimeString, DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeInstance(int, ULocale)'\r
+     */\r
+    public final void testGetTimeInstanceIntULocale() {\r
+        assertEquals(aTimeString, DateFormat.getTimeInstance(DateFormat.MEDIUM, ULocale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateInstance()'\r
+     */\r
+    public final void testGetDateInstance() {\r
+        assertEquals(aDateString, DateFormat.getDateInstance().format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateInstance(int)'\r
+     */\r
+    public final void testGetDateInstanceInt() {\r
+        assertEquals(aDateString, DateFormat.getDateInstance(DateFormat.MEDIUM).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateInstance(int, Locale)'\r
+     */\r
+    public final void testGetDateInstanceIntLocale() {\r
+        assertEquals(aDateString, DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateInstance(int, ULocale)'\r
+     */\r
+    public final void testGetDateInstanceIntULocale() {\r
+        assertEquals(aDateString, DateFormat.getDateInstance(DateFormat.MEDIUM, ULocale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateTimeInstance()'\r
+     */\r
+    public final void testGetDateTimeInstance() {\r
+        assertEquals(aDateTimeString, DateFormat.getDateTimeInstance().format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateTimeInstance(int, int)'\r
+     */\r
+    public final void testGetDateTimeInstanceIntInt() {\r
+        assertEquals(aDateTimeString, \r
+                     DateFormat.getDateTimeInstance(\r
+                                                    DateFormat.MEDIUM, DateFormat.MEDIUM).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateTimeInstance(int, int, Locale)'\r
+     */\r
+    public final void testGetDateTimeInstanceIntIntLocale() {\r
+        assertEquals(aDateTimeString, \r
+                     DateFormat.getDateTimeInstance(\r
+                                                    DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateTimeInstance(int, int, ULocale)'\r
+     */\r
+    public final void testGetDateTimeInstanceIntIntULocale() {\r
+        assertEquals(aDateTimeString, \r
+                     DateFormat.getDateTimeInstance(\r
+                                                    DateFormat.MEDIUM, DateFormat.MEDIUM, ULocale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getInstance()'\r
+     */\r
+    public final void testGetInstance() {\r
+        assertEquals(aShortDateTimeString, DateFormat.getInstance().format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getAvailableLocales()'\r
+     */\r
+    public final void testGetAvailableLocales() {\r
+        Locale[] locales = DateFormat.getAvailableLocales();\r
+        if (ICUTestCase.testingWrapper) {\r
+            ICUTestCase.assertArraysEqual(java.text.DateFormat.getAvailableLocales(), locales);\r
+        } else {\r
+            assertNotNull(locales);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.setCalendar(Calendar)'\r
+     */\r
+    public final void testSetCalendar() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.setTimeZone(TimeZone.getTimeZone("EST"));\r
+        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);\r
+        df.setCalendar(cal);\r
+        assertEquals("8:17 AM", df.format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getCalendar()'\r
+     */\r
+    public final void testGetCalendar() {\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.setTimeZone(TimeZone.getTimeZone("EST"));\r
+        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);\r
+        df.setCalendar(cal);\r
+        assertEquals(cal, df.getCalendar());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.setNumberFormat(NumberFormat)'\r
+     */\r
+    public final void testSetNumberFormat() {\r
+        // no easy way to test effect of setting the number format\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);\r
+        df.setNumberFormat(nf);\r
+        // note, can't actually USE the dateformat since it changes the calendar\r
+        assertEquals(nf, df.getNumberFormat());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getNumberFormat()'\r
+     */\r
+    public final void testGetNumberFormat() {\r
+        // see testSetNumberFormat\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.setTimeZone(TimeZone)'\r
+     */\r
+    public final void testSetTimeZone() {\r
+        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);\r
+        TimeZone tz = TimeZone.getTimeZone("EST");\r
+        df.setTimeZone(tz);\r
+        assertEquals("8:17 AM", df.format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeZone()'\r
+     */\r
+    public final void testGetTimeZone() {\r
+        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);\r
+        TimeZone tz = TimeZone.getTimeZone("EST");\r
+        df.setTimeZone(tz);\r
+        assertEquals(tz, df.getTimeZone());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.setLenient(boolean)'\r
+     */\r
+    public final void testSetLenient() throws Exception {\r
+        DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);\r
+        df.parse("2/31/90"); // succeeds, default is lenient\r
+        df.setLenient(false);\r
+        try {\r
+            df.parse("2/31/90");\r
+            throw new Exception("strict parse should have failed");\r
+        }\r
+        catch (ParseException e) {\r
+            // ok, this is what we expect\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.isLenient()'\r
+     */\r
+    public final void testIsLenient() {\r
+        DateFormat df = DateFormat.getInstance();\r
+        assertTrue(df.isLenient());\r
+        df.setLenient(false);\r
+        assertFalse(df.isLenient());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateInstance(Calendar, int, Locale)'\r
+     */\r
+    public final void testGetDateInstanceCalendarIntLocale() {\r
+        assertEquals(aDateString, DateFormat.getDateInstance(aCal, DateFormat.MEDIUM, Locale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateInstance(Calendar, int, ULocale)'\r
+     */\r
+    public final void testGetDateInstanceCalendarIntULocale() {\r
+        assertEquals(aDateString, DateFormat.getDateInstance(aCal, DateFormat.MEDIUM, ULocale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeInstance(Calendar, int, Locale)'\r
+     */\r
+    public final void testGetTimeInstanceCalendarIntLocale() {\r
+        assertEquals(anESTTimeString, DateFormat.getTimeInstance(anESTCal, DateFormat.MEDIUM, Locale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeInstance(Calendar, int, ULocale)'\r
+     */\r
+    public final void testGetTimeInstanceCalendarIntULocale() {\r
+        assertEquals(anESTTimeString, DateFormat.getTimeInstance(anESTCal, DateFormat.MEDIUM, ULocale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateTimeInstance(Calendar, int, int, Locale)'\r
+     */\r
+    public final void testGetDateTimeInstanceCalendarIntIntLocale() {\r
+        assertEquals(aDefaultESTDateTimeString, DateFormat.getDateTimeInstance(anESTCal, DateFormat.MEDIUM, DateFormat.SHORT, Locale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateTimeInstance(Calendar, int, int, ULocale)'\r
+     */\r
+    public final void testGetDateTimeInstanceCalendarIntIntULocale() {\r
+        assertEquals(aDefaultESTDateTimeString, DateFormat.getDateTimeInstance(anESTCal, DateFormat.MEDIUM, DateFormat.SHORT, ULocale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getInstance(Calendar, Locale)'\r
+     */\r
+    public final void testGetInstanceCalendarLocale() {\r
+        assertEquals(aDefaultESTDateTimeString, DateFormat.getInstance(anESTCal, Locale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getInstance(Calendar, ULocale)'\r
+     */\r
+    public final void testGetInstanceCalendarULocale() {\r
+        assertEquals(aDefaultESTDateTimeString, DateFormat.getInstance(anESTCal, ULocale.US).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getInstance(Calendar)'\r
+     */\r
+    public final void testGetInstanceCalendar() {\r
+        assertEquals(aDefaultESTDateTimeString, DateFormat.getInstance(anESTCal).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateInstance(Calendar, int)'\r
+     */\r
+    public final void testGetDateInstanceCalendarInt() {\r
+        assertEquals(aDateString, DateFormat.getDateInstance(aCal, DateFormat.MEDIUM).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getTimeInstance(Calendar, int)'\r
+     */\r
+    public final void testGetTimeInstanceCalendarInt() {\r
+        assertEquals(anESTTimeString, DateFormat.getTimeInstance(anESTCal, DateFormat.MEDIUM).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.getDateTimeInstance(Calendar, int, int)'\r
+     */\r
+    public final void testGetDateTimeInstanceCalendarIntInt() {\r
+        assertEquals(aDefaultESTDateTimeString, DateFormat.getDateTimeInstance(anESTCal, DateFormat.MEDIUM, DateFormat.SHORT).format(aDate));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.toString()'\r
+     */\r
+    public final void testToString() {\r
+        assertNotNull(aDF.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.clone()'\r
+     */\r
+    public final void testClone() {\r
+        // see testHashCode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DateFormat.equals(Object)'\r
+     */\r
+    public final void testEqualsObject() {\r
+        // see testHashCode\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatSymbolsTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatSymbolsTest.java
new file mode 100644 (file)
index 0000000..9cc7ce6
--- /dev/null
@@ -0,0 +1,344 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DecimalFormatSymbols;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class DecimalFormatSymbolsTest extends ICUTestCase {\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);\r
+        DecimalFormatSymbols dfs2 = new DecimalFormatSymbols(ULocale.US);\r
+        DecimalFormatSymbols dfsn = new DecimalFormatSymbols(Locale.FRANCE);\r
+        testEHCS(dfs, dfs2, dfsn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols(DecimalFormatSymbols)'\r
+     */\r
+    public void testDecimalFormatSymbolsDecimalFormatSymbols() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols()'\r
+     */\r
+    public void testDecimalFormatSymbols() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols();\r
+        assertTrue(-1 != dfs.getDecimalSeparator());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols(Locale)'\r
+     */\r
+    public void testDecimalFormatSymbolsLocale() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);\r
+        assertTrue(-1 != dfs.getDecimalSeparator());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols(ULocale)'\r
+     */\r
+    public void testDecimalFormatSymbolsULocale() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertTrue(-1 != dfs.getDecimalSeparator());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getZeroDigit()'\r
+     */\r
+    public void testGetZeroDigit() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals('0', dfs.getZeroDigit());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setZeroDigit(char)'\r
+     */\r
+    public void testSetZeroDigit() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getZeroDigit();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setZeroDigit(value1);\r
+        char result = dfs.getZeroDigit();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getGroupingSeparator()'\r
+     */\r
+    public void testGetGroupingSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals(',', dfs.getGroupingSeparator());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setGroupingSeparator(char)'\r
+     */\r
+    public void testSetGroupingSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getGroupingSeparator();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setGroupingSeparator(value1);\r
+        char result = dfs.getGroupingSeparator();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getDecimalSeparator()'\r
+     */\r
+    public void testGetDecimalSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals('.', dfs.getDecimalSeparator());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setDecimalSeparator(char)'\r
+     */\r
+    public void testSetDecimalSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getDecimalSeparator();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setDecimalSeparator(value1);\r
+        char result = dfs.getDecimalSeparator();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getPerMill()'\r
+     */\r
+    public void testGetPerMill() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals('\u2030', dfs.getPerMill());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setPerMill(char)'\r
+     */\r
+    public void testSetPerMill() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getPerMill();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setPerMill(value1);\r
+        char result = dfs.getPerMill();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getPercent()'\r
+     */\r
+    public void testGetPercent() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals('%', dfs.getPercent());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setPercent(char)'\r
+     */\r
+    public void testSetPercent() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getPercent();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setPercent(value1);\r
+        char result = dfs.getPercent();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getDigit()'\r
+     */\r
+    public void testGetDigit() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals('#', dfs.getDigit());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setDigit(char)'\r
+     */\r
+    public void testSetDigit() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getDigit();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setDigit(value1);\r
+        char result = dfs.getDigit();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getPatternSeparator()'\r
+     */\r
+    public void testGetPatternSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals(';', dfs.getPatternSeparator());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setPatternSeparator(char)'\r
+     */\r
+    public void testSetPatternSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getPatternSeparator();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setPatternSeparator(value1);\r
+        char result = dfs.getPatternSeparator();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getInfinity()'\r
+     */\r
+    public void testGetInfinity() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals("\u221e", dfs.getInfinity());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setInfinity(String)'\r
+     */\r
+    public void testSetInfinity() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        String value = dfs.getInfinity();\r
+        String value1 = value + "!";\r
+        dfs.setInfinity(value1);\r
+        String result = dfs.getInfinity();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getNaN()'\r
+     */\r
+    public void testGetNaN() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertNotNull(dfs.getNaN()); // java returns missing character???\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setNaN(String)'\r
+     */\r
+    public void testSetNaN() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        String value = dfs.getNaN();\r
+        String value1 = value + "!";\r
+        dfs.setNaN(value1);\r
+        String result = dfs.getNaN();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getMinusSign()'\r
+     */\r
+    public void testGetMinusSign() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals('-', dfs.getMinusSign());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setMinusSign(char)'\r
+     */\r
+    public void testSetMinusSign() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getMinusSign();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setMinusSign(value1);\r
+        char result = dfs.getMinusSign();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getCurrencySymbol()'\r
+     */\r
+    public void testGetCurrencySymbol() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals("$", dfs.getCurrencySymbol());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setCurrencySymbol(String)'\r
+     */\r
+    public void testSetCurrencySymbol() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        String value = dfs.getCurrencySymbol();\r
+        String value1 = value + "!";\r
+        dfs.setCurrencySymbol(value1);\r
+        String result = dfs.getCurrencySymbol();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getInternationalCurrencySymbol()'\r
+     */\r
+    public void testGetInternationalCurrencySymbol() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals("USD", dfs.getInternationalCurrencySymbol());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setInternationalCurrencySymbol(String)'\r
+     */\r
+    public void testSetInternationalCurrencySymbol() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        String value = dfs.getInternationalCurrencySymbol();\r
+        String value1 = value + "!";\r
+        dfs.setInternationalCurrencySymbol(value1);\r
+        String result = dfs.getInternationalCurrencySymbol();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getMonetaryDecimalSeparator()'\r
+     */\r
+    public void testGetMonetaryDecimalSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        assertEquals('.', dfs.getMonetaryDecimalSeparator());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setMonetaryDecimalSeparator(char)'\r
+     */\r
+    public void testSetMonetaryDecimalSeparator() {\r
+        DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);\r
+        char value = dfs.getMonetaryDecimalSeparator();\r
+        char value1 = (char)(value + 1);\r
+        dfs.setMonetaryDecimalSeparator(value1);\r
+        char result = dfs.getMonetaryDecimalSeparator();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.clone()'\r
+     */\r
+    public void testClone() {\r
+        // tested in testHashcode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // tested in testHashcode\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/DecimalFormatTest.java
new file mode 100644 (file)
index 0000000..23cc40d
--- /dev/null
@@ -0,0 +1,242 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DecimalFormat;\r
+import com.ibm.icu.text.DecimalFormatSymbols;\r
+\r
+public class DecimalFormatTest extends ICUTestCase {\r
+    private static final long lmax = Long.MAX_VALUE;\r
+    private static final double dsmall = 23.33;\r
+        \r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.clone()'\r
+     */\r
+    public void testClone() {\r
+        DecimalFormat df = new DecimalFormat("#,#0.00");\r
+        DecimalFormat df2 = new DecimalFormat("#,#0.00");\r
+        DecimalFormat dfn = new DecimalFormat("#,#0.00");\r
+        dfn.setNegativePrefix(dfn.getNegativePrefix() + '!');\r
+        testEHCS(df, df2, dfn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.DecimalFormat(DecimalFormat)'\r
+     */\r
+    public void testDecimalFormatDecimalFormat() {\r
+        // tested implicitly\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.DecimalFormat()'\r
+     */\r
+    public void testDecimalFormat() {\r
+        DecimalFormat df = new DecimalFormat();\r
+        assertEquals("9,223,372,036,854,775,807", df.format(lmax));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.DecimalFormat(String)'\r
+     */\r
+    public void testDecimalFormatString() {\r
+        DecimalFormat df = new DecimalFormat("#,##0.000");\r
+        assertEquals("23.330", df.format(dsmall));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.DecimalFormat(String, DecimalFormatSymbols)'\r
+     */\r
+    public void testDecimalFormatStringDecimalFormatSymbols() {\r
+        DecimalFormatSymbols sym = new DecimalFormatSymbols(Locale.FRANCE);\r
+        DecimalFormat df = new DecimalFormat("#,##0.000", sym);\r
+        assertEquals("23,330", df.format(dsmall));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.getDecimalFormatSymbols()'\r
+     */\r
+    public void testGetDecimalFormatSymbols() {\r
+        DecimalFormatSymbols sym = new DecimalFormatSymbols(Locale.FRANCE);\r
+        DecimalFormat df = new DecimalFormat("#,##0.000", sym);\r
+        assertEquals(sym, df.getDecimalFormatSymbols());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setDecimalFormatSymbols(DecimalFormatSymbols)'\r
+     */\r
+    public void testSetDecimalFormatSymbols() {\r
+        DecimalFormat df = new DecimalFormat();\r
+        df.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.FRANCE));\r
+        assertEquals("23,33", df.format(dsmall));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.getPositivePrefix()'\r
+     */\r
+    public void testGetPositivePrefix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#;-#,##0.#");\r
+        assertEquals("+", df.getPositivePrefix());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setPositivePrefix(String)'\r
+     */\r
+    public void testSetPositivePrefix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#;-#,##0.#");\r
+        df.setPositivePrefix("?");\r
+        assertEquals("?23.3", df.format(dsmall));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.getNegativePrefix()'\r
+     */\r
+    public void testGetNegativePrefix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#;-#,##0.#");\r
+        assertEquals("-", df.getNegativePrefix());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setNegativePrefix(String)'\r
+     */\r
+    public void testSetNegativePrefix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#;-#,##0.#");\r
+        df.setNegativePrefix("~");\r
+        assertEquals("~23.3", df.format(-dsmall));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.getPositiveSuffix()'\r
+     */\r
+    public void testGetPositiveSuffix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#**;-#,##0.#~~");\r
+        assertEquals("**", df.getPositiveSuffix());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setPositiveSuffix(String)'\r
+     */\r
+    public void testSetPositiveSuffix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#;-#,##0.#");\r
+        df.setPositiveSuffix("**");\r
+        assertEquals("+23.3**", df.format(dsmall));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.getNegativeSuffix()'\r
+     */\r
+    public void testGetNegativeSuffix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#**;-#,##0.#~~");\r
+        assertEquals("~~", df.getNegativeSuffix());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setNegativeSuffix(String)'\r
+     */\r
+    public void testSetNegativeSuffix() {\r
+        DecimalFormat df = new DecimalFormat("+#,##0.#;-#,##0.#");\r
+        df.setNegativeSuffix("~~");\r
+        assertEquals("-23.3~~", df.format(-dsmall));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.getMultiplier()'\r
+     */\r
+    public void testGetMultiplier() {\r
+        DecimalFormat df = new DecimalFormat("%000");\r
+        df.setMultiplier(1000);\r
+        assertEquals(1000, df.getMultiplier());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setMultiplier(int)'\r
+     */\r
+    public void testSetMultiplier() {\r
+        DecimalFormat df = new DecimalFormat("%000");\r
+        assertEquals("%012", df.format(.123));\r
+        df.setMultiplier(1000);\r
+        assertEquals("%123", df.format(.123));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.getGroupingSize()'\r
+     */\r
+    public void testGetGroupingSize() {\r
+        DecimalFormat df = new DecimalFormat("#,#0.#");\r
+        assertEquals(2, df.getGroupingSize());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setGroupingSize(int)'\r
+     */\r
+    public void testSetGroupingSize() {\r
+        DecimalFormat df = new DecimalFormat("#,##0.##");\r
+        assertEquals("1,234,567.89", df.format(1234567.89));\r
+        df.setGroupingSize(2);\r
+        assertEquals("1,23,45,67.89", df.format(1234567.89));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.isDecimalSeparatorAlwaysShown()'\r
+     */\r
+    public void testIsDecimalSeparatorAlwaysShown() {\r
+        DecimalFormat df = new DecimalFormat("#.#");\r
+        df.setDecimalSeparatorAlwaysShown(false);\r
+        assertEquals("1", df.format(1));\r
+        assertEquals("1.2", df.format(1.2));\r
+        df.setDecimalSeparatorAlwaysShown(true);\r
+        assertEquals("1.", df.format(1));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.setDecimalSeparatorAlwaysShown(boolean)'\r
+     */\r
+    public void testSetDecimalSeparatorAlwaysShown() {\r
+        DecimalFormat df = new DecimalFormat("#.#");\r
+        df.setDecimalSeparatorAlwaysShown(false);\r
+        assertFalse(df.isDecimalSeparatorAlwaysShown());\r
+        df.setDecimalSeparatorAlwaysShown(true);\r
+        assertTrue(df.isDecimalSeparatorAlwaysShown());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.toPattern()'\r
+     */\r
+    public void testToPattern() {\r
+        DecimalFormat df = new DecimalFormat("#,##0.##");\r
+        assertEquals("#,##0.##", df.toPattern());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.toLocalizedPattern()'\r
+     */\r
+    public void testToLocalizedPattern() {\r
+        DecimalFormat df = new DecimalFormat("#,##0.##", new DecimalFormatSymbols(Locale.FRANCE));\r
+        assertEquals("#,##0.##", df.toPattern());\r
+        assertEquals("#\u00a0##0,##", df.toLocalizedPattern());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.applyPattern(String)'\r
+     */\r
+    public void testApplyPattern() {\r
+        DecimalFormat df = new DecimalFormat("#,##0.##");\r
+        df.applyPattern("#,0.#");\r
+        assertEquals("1,2,3.4", df.format(123.4));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.DecimalFormat.applyLocalizedPattern(String)'\r
+     */\r
+    public void testApplyLocalizedPattern() {\r
+        DecimalFormat df = new DecimalFormat("#,##0.##", new DecimalFormatSymbols(Locale.FRANCE));\r
+        df.applyLocalizedPattern("#\u00a00,#");\r
+        assertEquals("1\u00a02\u00a03,4", df.format(123.4));\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ICUTestCase.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ICUTestCase.java
new file mode 100644 (file)
index 0000000..2e3de90
--- /dev/null
@@ -0,0 +1,286 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.io.ByteArrayInputStream;\r
+import java.io.ByteArrayOutputStream;\r
+import java.io.Externalizable;\r
+import java.io.IOException;\r
+import java.io.ObjectInputStream;\r
+import java.io.ObjectOutputStream;\r
+import java.io.Serializable;\r
+import java.lang.reflect.Array;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.util.TimeZone;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+import junit.framework.TestCase;\r
+\r
+/**\r
+ * Implement boilerplate tests.\r
+ * Currently there is only one method, testEHCS, which tests equals, hashCode, \r
+ * clone, and serialization.\r
+ */\r
+public abstract class ICUTestCase extends TestCase {\r
+    private static final Object[] EMPTY_ARGS = {};\r
+       private static final Class<?>[] EMPTY_CLASSES = {};\r
+        \r
+    private static final Locale oldLocale = Locale.getDefault();\r
+    private static final ULocale oldULocale = ULocale.getDefault();\r
+    private static final java.util.TimeZone oldJTimeZone = java.util.TimeZone.getDefault();\r
+    private static final TimeZone oldITimeZone = TimeZone.getDefault();\r
+                \r
+    // TODO: what's the best way to check this?\r
+    public static final boolean testingWrapper = true;\r
+\r
+    protected void setUp() throws Exception {\r
+        super.setUp();\r
+        Locale.setDefault(Locale.US);\r
+        ULocale.setDefault(ULocale.US);\r
+        java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("PST"));\r
+        TimeZone.setDefault(TimeZone.getTimeZone("PST"));\r
+    }\r
+        \r
+    protected void tearDown() throws Exception {\r
+        ULocale.setDefault(oldULocale);\r
+        Locale.setDefault(oldLocale);\r
+        TimeZone.setDefault(oldITimeZone);\r
+        java.util.TimeZone.setDefault(oldJTimeZone);\r
+        super.tearDown();\r
+    }\r
+\r
+    private static final Object test = new Object();\r
+        \r
+    /**\r
+     * Assert that two objects are _not_ equal.  Curiously missing from Assert.\r
+     * @param lhs an object to test, may be null\r
+     * @param rhs an object to test, may be null\r
+     */\r
+    public static void assertNotEqual(Object lhs, Object rhs) {\r
+        if (lhs == null) {\r
+            if (rhs == null) fail("null equals null");\r
+        } else {\r
+            if (lhs.equals(rhs)) {\r
+                fail(lhs.toString() + " equals " + rhs);\r
+            }\r
+        }\r
+    }\r
+        \r
+    public static void assertNotEqual(long lhs, long rhs) {\r
+        if (lhs == rhs) {\r
+            fail("values are equal: " + lhs);\r
+        }\r
+    }\r
+        \r
+    /**\r
+     * Test whether equality, hashCode, clone, and serialization work as expected.  \r
+     * Equals(Object) is assumed to return false (not throw an exception) if passed \r
+     * null or an object of an incompatible class.\r
+     * Hashcodes must be equal iff the two objects compare equal.  No attempt is made to\r
+     * evaluate the quality of the hashcode distribution, so (in particular) degenerate \r
+     * hashcode implementations will pass this test.\r
+     * Clone will be tested if the method "clone" is public on the class of obj.  \r
+     * It is assumed to return an object that compares equal to obj.\r
+     * Serialization will be tested if object implements Serializable or Externalizable.\r
+     * It is assumed the serialized/deserialized object compares equal to obj.\r
+     * @param obj the object to test\r
+     * @param eq an object that should compare equal to, but is not the same as, obj.  \r
+     *     it should be assignable to the class of obj.\r
+     * @param neq a non-null object that should not compare equal to obj.  \r
+     *     it should be assignable to the class of obj.\r
+     */\r
+       public static void testEHCS(Object obj, Object eq, Object neq) {\r
+        if (obj == null || eq == null || neq == null) {\r
+            throw new NullPointerException();\r
+        }\r
+        Class<? extends Object> cls = obj.getClass();\r
+        if (!(cls.isAssignableFrom(eq.getClass()) && cls.isAssignableFrom(neq.getClass()))) {\r
+            throw new IllegalArgumentException("unassignable classes");\r
+        }\r
+                \r
+        // reflexive\r
+        assertEquals(obj, obj);\r
+                \r
+        // should return false, not throw exception\r
+        assertNotEqual(obj, test);\r
+        assertNotEqual(obj, null);\r
+                \r
+        // commutative\r
+        assertEquals(obj, eq);\r
+        assertEquals(eq, obj);\r
+                \r
+        assertNotEqual(obj, neq);\r
+        assertNotEqual(neq, obj);\r
+                \r
+        // equal objects MUST have equal hashes, unequal objects MAY have equal hashes\r
+        assertEquals(obj.hashCode(), eq.hashCode());\r
+                \r
+        Object clone = null;\r
+        try {\r
+            // look for public clone method and call it if available\r
+            Method method_clone = cls.getMethod("clone", EMPTY_CLASSES);\r
+            clone = method_clone.invoke(obj, EMPTY_ARGS);\r
+            assertNotNull(clone);\r
+        }\r
+        catch(NoSuchMethodException e) {\r
+            // ok\r
+        }\r
+        catch(InvocationTargetException e) {\r
+            // ok\r
+        }\r
+        catch(IllegalAccessException e) {\r
+            // ok\r
+        }\r
+                \r
+        if (clone != null) {\r
+            assertEquals(obj, clone);\r
+            assertEquals(clone, obj);\r
+        }\r
+                \r
+        if (obj instanceof Serializable || obj instanceof Externalizable) {\r
+            Object ser = null;\r
+            try {\r
+                ByteArrayOutputStream bos = new ByteArrayOutputStream();\r
+                ObjectOutputStream oos = new ObjectOutputStream(bos);\r
+                oos.writeObject(clone);\r
+                oos.close();\r
+                                \r
+                ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());\r
+                ObjectInputStream ois = new ObjectInputStream(bis);\r
+                ser = ois.readObject();\r
+                ois.close();\r
+            }\r
+            catch(IOException e) {\r
+                System.err.println(e.getMessage());\r
+                throw new RuntimeException(e);\r
+            }\r
+            catch(ClassNotFoundException e) {\r
+                System.err.println(e.getMessage());\r
+                throw new RuntimeException(e);\r
+            }\r
+                        \r
+            if (ser != null) {\r
+                assertEquals(obj, ser);\r
+                assertEquals(ser, obj);\r
+                assertEquals(obj.hashCode(), ser.hashCode());\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Fail if the arrays are not equal.  To be equal, the arrays must\r
+     * be the same length, and each element in the left array must compare\r
+     * equal to the corresponding element of the right array.\r
+     * Also fails if one of the objects is not an array.\r
+     * @param lhs the left array\r
+     * @param rhs the right array\r
+     */\r
+    public static void assertArraysEqual(Object lhs, Object rhs) {\r
+        Class<? extends Object> lcls = lhs.getClass();\r
+        Class<? extends Object> rcls = rhs.getClass();\r
+        if (!(lcls.isArray() && rcls.isArray())) {\r
+            fail("objects are not arrays");\r
+        }\r
+        String result = arraysAreEqual(lhs, rhs);\r
+        if (result != null) {\r
+            fail(result);\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Fail if the arrays are equal.  Also fails if one or the other \r
+     * argument is not an array.\r
+     * @param lhs the left array\r
+     * @param rhs the right array\r
+     */\r
+    public static void assertArraysNotEqual(Object lhs, Object rhs) {\r
+        Class<? extends Object> lcls = lhs.getClass();\r
+        Class<? extends Object> rcls = rhs.getClass();\r
+        if (!(lcls.isArray() && rcls.isArray())) {\r
+            fail("objects are not arrays");\r
+        }\r
+        String result = arraysAreEqual(lhs, rhs);\r
+        if (result == null) {\r
+            fail("arrays are equal");\r
+        }\r
+    }\r
+        \r
+    // slow but general\r
+    private static String arraysAreEqual(Object lhsa, Object rhsa) {\r
+        int lhsl = Array.getLength(lhsa);\r
+        int rhsl = Array.getLength(rhsa);\r
+        if (lhsl != rhsl) {\r
+            return "length " + lhsl + " != " + rhsl;\r
+        }\r
+        boolean lhsaA = lhsa.getClass().getComponentType().isArray();\r
+        boolean rhsaA = rhsa.getClass().getComponentType().isArray();\r
+        if (lhsaA != rhsaA) {\r
+            return (lhsaA ? "" : "non-") + "array != " + (rhsaA ? "" : "non-") + "array";\r
+        }\r
+        for (int i = 0; i < lhsl; ++i) {\r
+            Object lhse = Array.get(lhsa, i);\r
+            Object rhse = Array.get(rhsa, i);\r
+            if (lhse == null) {\r
+                if (rhse != null) {\r
+                    return "null != " + rhse;\r
+                }\r
+            } else {\r
+                if (lhsaA) {\r
+                    String result = arraysAreEqual(lhse, rhse);\r
+                    if (result != null) {\r
+                        if (result.charAt(0) != '[') {\r
+                            result = " " + result;\r
+                        }\r
+                        return "[" + i + "]" + result;\r
+                    }\r
+                } else {\r
+                    if (!lhse.equals(rhse)) {\r
+                        return lhse.toString() + " != " + rhse;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+        \r
+    // much more painful and slow than it should be... partly because of the\r
+    // oddness of clone, partly because arrays don't provide a Method for \r
+    // 'clone' despite the fact that they implement it and make it public.\r
+    public static Object cloneComplex(Object obj) {\r
+        Object result = null;\r
+        if (obj != null) {\r
+            Class<? extends Object> cls = obj.getClass();\r
+            if (cls.isArray()) {\r
+                int len = Array.getLength(obj);\r
+                Class<?> typ = cls.getComponentType();\r
+                result = Array.newInstance(typ, len);\r
+                boolean prim = typ.isPrimitive();\r
+                for (int i = 0; i < len; ++i) {\r
+                    Object elem = Array.get(obj, i);\r
+                    Array.set(result, i, prim ? elem : cloneComplex(elem));\r
+                }\r
+            } else {\r
+                result = obj; // default\r
+                try {\r
+                    Method cloneM = cls.getMethod("clone", EMPTY_CLASSES);\r
+                    result = cloneM.invoke(obj, EMPTY_ARGS);\r
+                }\r
+                catch (NoSuchMethodException e) {\r
+                }\r
+                catch (IllegalAccessException e) {\r
+                }\r
+                catch (InvocationTargetException e) {\r
+                }\r
+            }\r
+        }\r
+        return result;\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/MessageFormatTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/MessageFormatTest.java
new file mode 100644 (file)
index 0000000..7f269fa
--- /dev/null
@@ -0,0 +1,307 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.tests;\r
+\r
+import java.text.FieldPosition;\r
+import java.text.Format;\r
+import java.text.ParseException;\r
+import java.text.ParsePosition;\r
+import java.util.Date;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DateFormat;\r
+import com.ibm.icu.text.MessageFormat;\r
+import com.ibm.icu.text.NumberFormat;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class MessageFormatTest extends ICUTestCase {\r
+    private final String pattern = "Deleted {0,number} files at {1,time,short} on {1,date}.";\r
+    private final String altPattern = "Deleted {0,  number } files at {1, time, short} on {1, date}.";\r
+    private final Date date = new Date(716698890835L);\r
+    private final Number num = new Long(3456);\r
+    private final Object[] args = { num, date };\r
+    private final Date dateOnly = new Date(716626800000L);\r
+    private final String englishTarget = "Deleted 3,456 files at 8:01 PM on Sep 16, 1992.";\r
+    private final String germanTarget = "Deleted 3.456 files at 20:01 on 16.09.1992.";\r
+    private final String modifiedTarget = "Deleted 3,456 files at 8:01:30 PM PDT on Sep 16, 1992.";\r
+    \r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        MessageFormat mf = new MessageFormat(pattern);\r
+        MessageFormat eq = new MessageFormat(altPattern);\r
+        MessageFormat ne = new MessageFormat("Deleted (0, number, currency} files at {1, time} on {1, date}.");\r
+        testEHCS(mf, eq, ne);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.MessageFormat(MessageFormat)'\r
+     */\r
+    public void testMessageFormatMessageFormat() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.MessageFormat(String)'\r
+     */\r
+    public void testMessageFormatString() {\r
+        MessageFormat mf = new MessageFormat(pattern);\r
+        assertEquals(englishTarget, mf.format(args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.MessageFormat(String, Locale)'\r
+     */\r
+    public void testMessageFormatStringLocale() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        assertEquals(englishTarget, mf.format(args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.MessageFormat(String, ULocale)'\r
+     */\r
+    public void testMessageFormatStringULocale() {\r
+        MessageFormat mf = new MessageFormat(pattern, ULocale.US);\r
+        assertEquals(englishTarget, mf.format(args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.setLocale(Locale)'\r
+     */\r
+    public void testSetLocaleLocale() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        mf.setLocale(Locale.GERMANY);\r
+        mf.applyPattern(pattern);\r
+        assertEquals(germanTarget, mf.format(args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.setLocale(ULocale)'\r
+     */\r
+    public void testSetLocaleULocale() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        mf.setLocale(ULocale.GERMANY);\r
+        mf.applyPattern(pattern);\r
+        assertEquals(germanTarget, mf.format(args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.getLocale()'\r
+     */\r
+    public void testGetLocale() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        mf.setLocale(Locale.GERMANY);\r
+        assertEquals(Locale.GERMANY, mf.getLocale());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.getULocale()'\r
+     */\r
+    public void testGetULocale() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        mf.setLocale(ULocale.GERMANY);\r
+        assertEquals(ULocale.GERMANY, mf.getULocale());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.applyPattern(String)'\r
+     */\r
+    public void testApplyPattern() {\r
+        MessageFormat mf = new MessageFormat("foo");\r
+        mf.applyPattern(pattern);\r
+        assertEquals(englishTarget, mf.format(args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.toPattern()'\r
+     */\r
+    public void testToPattern() {\r
+        MessageFormat mf = new MessageFormat(altPattern);\r
+        assertEquals(pattern, mf.toPattern());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.setFormatsByArgumentIndex(Format[])'\r
+    public void testSetFormatsByArgumentIndex() {\r
+        // this api is broken.  if the same argument is used twice with two different\r
+        // formats, this can't be used, since it sets only one format per argument.\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        Format[] formats = {\r
+            NumberFormat.getIntegerInstance(),\r
+            DateFormat.getTimeInstance(DateFormat.SHORT),\r
+            DateFormat.getDateInstance(),\r
+        };\r
+        mf.setFormatsByArgumentIndex(formats);\r
+        assertEquals(brokenButConformantTarget, mf.format(args));\r
+    }\r
+     */\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.setFormats(Format[])'\r
+     */\r
+    public void testSetFormats() {\r
+        // this api, while it has the problem that the order of formats depends\r
+        // on the order in the string, at least lets you set all the formats.\r
+        \r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        Format[] formats = {\r
+            NumberFormat.getIntegerInstance(),\r
+            DateFormat.getTimeInstance(DateFormat.SHORT),\r
+            DateFormat.getDateInstance(),\r
+        };\r
+        mf.setFormats(formats);\r
+        assertEquals(englishTarget, mf.format(args));\r
+   }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.setFormatByArgumentIndex(int, Format)'\r
+     public void testSetFormatByArgumentIndex() {\r
+        // same problem, once you set a format for an argument, you've set all of them\r
+        \r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        mf.setFormatByArgumentIndex(1, DateFormat.getTimeInstance(DateFormat.SHORT));\r
+        assertEquals(brokenButConformantTarget, mf.format(args));\r
+\r
+    }\r
+    */\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.setFormat(int, Format)'\r
+     */\r
+    public void testSetFormat() {\r
+        // and ok again        \r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        mf.setFormat(1, DateFormat.getTimeInstance(DateFormat.LONG));\r
+        assertEquals(modifiedTarget, mf.format(args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.getFormatsByArgumentIndex()'\r
+    public void testGetFormatsByArgumentIndex() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        Format[] formats = mf.getFormatsByArgumentIndex();\r
+        NumberFormat nf = NumberFormat.getNumberInstance(Locale.US);\r
+        assertEquals(formats[0], nf);\r
+        DateFormat df = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.US);\r
+        assertEquals(formats[1], df);\r
+    }\r
+     */\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.getFormats()'\r
+     */\r
+    public void testGetFormats() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        Format[] formats = mf.getFormats();\r
+        NumberFormat nf = NumberFormat.getNumberInstance(Locale.US);\r
+        assertEquals(formats[0], nf);\r
+        DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.US);\r
+        assertEquals(formats[1], tf);\r
+        DateFormat df = DateFormat.getDateInstance(DateFormat.DEFAULT, Locale.US);\r
+        assertEquals(formats[2], df);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.format(Object[], StringBuffer, FieldPosition)'\r
+     */\r
+    public void testFormatObjectArrayStringBufferFieldPosition() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        StringBuffer buf = new StringBuffer();\r
+        FieldPosition fp = new FieldPosition(0);\r
+        mf.format(args, buf, fp);\r
+        assertEquals(englishTarget, buf.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.format(String, Object[])'\r
+     */\r
+    public void testFormatStringObjectArray() {\r
+        assertEquals(englishTarget, MessageFormat.format(pattern, args));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.format(Object, StringBuffer, FieldPosition)'\r
+     */\r
+    public void testFormatObjectStringBufferFieldPosition() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        StringBuffer buf = new StringBuffer();\r
+        FieldPosition fp = new FieldPosition(0);\r
+        mf.format((Object)args, buf, fp);\r
+        assertEquals(englishTarget, buf.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.parse(String, ParsePosition)'\r
+     */\r
+    public void testParseStringParsePosition() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        ParsePosition pp = new ParsePosition(1);\r
+        Object[] result = mf.parse("!" + englishTarget, pp);\r
+        assertEquals(num, result[0]);\r
+        assertEquals(dateOnly, result[1]);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.parse(String)'\r
+     */\r
+    public void testParseString() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        try {\r
+            Object[] result = mf.parse(englishTarget);\r
+            assertEquals(num, result[0]);\r
+            assertEquals(dateOnly, result[1]);\r
+        }\r
+        catch (ParseException e) {\r
+            fail(e.getMessage());\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.parseObject(String, ParsePosition)'\r
+     */\r
+    public void testParseObjectStringParsePosition() {\r
+        MessageFormat mf = new MessageFormat(pattern, Locale.US);\r
+        ParsePosition pp = new ParsePosition(0);\r
+        Object result = mf.parseObject(englishTarget, pp);\r
+        assertEquals(num, ((Object[])result)[0]);\r
+        assertEquals(dateOnly, ((Object[])result)[1]);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.autoQuoteApostrophe(String)'\r
+     */\r
+    public void testAutoQuoteApostrophe() {\r
+        String str = "Let's meet at {1,time,h 'o'' clock'} at l'Orange Bleue";\r
+        String pat = MessageFormat.autoQuoteApostrophe(str);\r
+        MessageFormat mf = new MessageFormat(pat, Locale.US);\r
+        String result = mf.format(args);\r
+        assertEquals("Let's meet at 8 o' clock at l'Orange Bleue", result);\r
+        assertEquals("Let''s meet at {1,time,h 'o'' clock'} at l''Orange Bleue", pat);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.clone()'\r
+     */\r
+    public void testClone() {\r
+        // tested already in testHashcode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // tested already in testHashcode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.MessageFormat.toString()'\r
+     */\r
+    public void testToString() {\r
+        // no need to test\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/NumberFormatTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/NumberFormatTest.java
new file mode 100644 (file)
index 0000000..3c7b7dd
--- /dev/null
@@ -0,0 +1,447 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2007-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.math.BigInteger;\r
+import java.text.FieldPosition;\r
+import java.text.ParseException;\r
+import java.text.ParsePosition;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.NumberFormat;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class NumberFormatTest extends ICUTestCase {\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.NumberFormat(NumberFormat)'\r
+     */\r
+    public void testNumberFormat() {\r
+        NumberFormat nf = new NumberFormat(java.text.NumberFormat.getInstance());\r
+        assertEquals(nf, NumberFormat.getInstance());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.format(Object, StringBuffer, FieldPosition)'\r
+     */\r
+    public void testFormatObjectStringBufferFieldPosition() {\r
+        Number num = new Long(1234L);\r
+        StringBuffer buf = new StringBuffer();\r
+        FieldPosition fp = new FieldPosition(NumberFormat.INTEGER_FIELD);\r
+        NumberFormat.getInstance().format(num, buf, fp);\r
+        assertEquals("1,234", buf.toString());\r
+        assertEquals(0, fp.getBeginIndex());\r
+        assertEquals(5, fp.getEndIndex());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.parseObject(String, ParsePosition)'\r
+     */\r
+    public void testParseObjectStringParsePosition() {\r
+        ParsePosition pp = new ParsePosition(0);\r
+        Object result = NumberFormat.getInstance().parse("1,234", pp);\r
+        assertEquals(result, new Long(1234));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.format(double)'\r
+     */\r
+    public void testFormatDouble() {\r
+        assertEquals("1,234.567", NumberFormat.getInstance().format(1234.567));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.format(long)'\r
+     */\r
+    public void testFormatLong() {\r
+        assertEquals("1,234", NumberFormat.getInstance().format(1234L));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.format(BigInteger)'\r
+     */\r
+    public void testFormatBigInteger() {\r
+        // note, java doesn't handle biginteger with full precision.\r
+        BigInteger bi = new BigInteger("123456");\r
+        assertEquals("123,456", java.text.NumberFormat.getInstance().format(bi));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.format(double, StringBuffer, FieldPosition)'\r
+     */\r
+    public void testFormatDoubleStringBufferFieldPosition() {\r
+        StringBuffer buf = new StringBuffer();\r
+        FieldPosition fp = new FieldPosition(NumberFormat.FRACTION_FIELD);\r
+        assertEquals("123,456.789", NumberFormat.getInstance().format(123456.789, buf, fp).toString());\r
+        assertEquals(8, fp.getBeginIndex());\r
+        assertEquals(11, fp.getEndIndex());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.format(long, StringBuffer, FieldPosition)'\r
+     */\r
+    public void testFormatLongStringBufferFieldPosition() {\r
+        StringBuffer buf = new StringBuffer();\r
+        FieldPosition fp = new FieldPosition(NumberFormat.Field.GROUPING_SEPARATOR);\r
+        assertEquals("123,456", NumberFormat.getInstance().format(123456L, buf, fp).toString());\r
+        assertEquals(3, fp.getBeginIndex());\r
+        assertEquals(4, fp.getEndIndex());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.format(BigInteger, StringBuffer, FieldPosition)'\r
+     */\r
+    public void testFormatBigIntegerStringBufferFieldPosition() {\r
+        // note, java doesn't handle biginteger with full precision.\r
+        StringBuffer buf = new StringBuffer();\r
+        FieldPosition fp = new FieldPosition(0);\r
+        BigInteger bi = new BigInteger("123456");\r
+        assertEquals("123,456", java.text.NumberFormat.getInstance().format(bi, buf, fp).toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.parse(String, ParsePosition)'\r
+     */\r
+    public void testParseStringParsePosition() {\r
+        ParsePosition pp = new ParsePosition(3);\r
+        assertEquals(new Long(123456), NumberFormat.getInstance().parse("xxx123,456yyy", pp));\r
+        assertEquals(10, pp.getIndex());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.parse(String)'\r
+     */\r
+    public void testParseString() throws ParseException {\r
+        Number result = NumberFormat.getInstance().parse("123,456,yyy");\r
+        assertEquals(new Long(123456), result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.isParseIntegerOnly()'\r
+     */\r
+    public void testIsParseIntegerOnly() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setParseIntegerOnly(true);\r
+        assertTrue(nf.isParseIntegerOnly());\r
+        nf.setParseIntegerOnly(false);\r
+        assertFalse(nf.isParseIntegerOnly());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.setParseIntegerOnly(boolean)'\r
+     */\r
+    public void testSetParseIntegerOnly() throws ParseException {\r
+        String str = "123.456,yyy";\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        assertEquals(new Double(123.456), nf.parse(str));\r
+        nf.setParseIntegerOnly(true);\r
+        assertEquals(new Long(123), nf.parse(str));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getInstance()'\r
+     */\r
+    public void testGetInstance() {\r
+        // used everywhere, no need to test\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getInstance(Locale)'\r
+     */\r
+    public void testGetInstanceLocale() {\r
+        NumberFormat nf = NumberFormat.getInstance(Locale.GERMANY);\r
+        assertEquals("123,456", nf.format(123.456));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getInstance(ULocale)'\r
+     */\r
+    public void testGetInstanceULocale() {\r
+        NumberFormat nf = NumberFormat.getInstance(ULocale.GERMANY);\r
+        assertEquals("123,456", nf.format(123.456));            \r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getNumberInstance()'\r
+     */\r
+    public void testGetNumberInstance() {\r
+        NumberFormat nf = NumberFormat.getNumberInstance();\r
+        assertEquals("123,456.789", nf.format(123456.789));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getNumberInstance(Locale)'\r
+     */\r
+    public void testGetNumberInstanceLocale() {\r
+        NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMANY);\r
+        assertEquals("123.456,789", nf.format(123456.789));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getNumberInstance(ULocale)'\r
+     */\r
+    public void testGetNumberInstanceULocale() {\r
+        NumberFormat nf = NumberFormat.getNumberInstance(ULocale.GERMANY);\r
+        assertEquals("123.456,789", nf.format(123456.789));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getIntegerInstance()'\r
+     */\r
+    public void testGetIntegerInstance() {\r
+        NumberFormat nf = NumberFormat.getIntegerInstance();\r
+        assertEquals("123,457", nf.format(123456.789)); // rounds\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getIntegerInstance(Locale)'\r
+     */\r
+    public void testGetIntegerInstanceLocale() {\r
+        NumberFormat nf = NumberFormat.getIntegerInstance(Locale.GERMANY);\r
+        assertEquals("123.457", nf.format(123456.789)); // rounds\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getIntegerInstance(ULocale)'\r
+     */\r
+    public void testGetIntegerInstanceULocale() {\r
+        NumberFormat nf = NumberFormat.getIntegerInstance(ULocale.GERMANY);\r
+        assertEquals("123.457", nf.format(123456.789)); // rounds\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getCurrencyInstance()'\r
+     */\r
+    public void testGetCurrencyInstance() {\r
+        NumberFormat nf = NumberFormat.getCurrencyInstance();\r
+        assertEquals("$123,456.99", nf.format(123456.99));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getCurrencyInstance(Locale)'\r
+     */\r
+    public void testGetCurrencyInstanceLocale() {\r
+        NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.GERMANY);\r
+        assertEquals("123.456,99 \u20AC", nf.format(123456.99));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getCurrencyInstance(ULocale)'\r
+     */\r
+    public void testGetCurrencyInstanceULocale() {\r
+        NumberFormat nf = NumberFormat.getCurrencyInstance(ULocale.GERMANY);\r
+        assertEquals("123.456,99 \u20AC", nf.format(123456.99));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getPercentInstance()'\r
+     */\r
+    public void testGetPercentInstance() {\r
+        NumberFormat nf = NumberFormat.getPercentInstance();\r
+        assertEquals("123,456%", nf.format(1234.56));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getPercentInstance(Locale)'\r
+     */\r
+    public void testGetPercentInstanceLocale() {\r
+        NumberFormat nf = NumberFormat.getPercentInstance(Locale.GERMANY);\r
+        assertEquals("123.456%", nf.format(1234.56));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getPercentInstance(ULocale)'\r
+     */\r
+    public void testGetPercentInstanceULocale() {\r
+        NumberFormat nf = NumberFormat.getPercentInstance(ULocale.GERMANY);\r
+        assertEquals("123.456%", nf.format(1234.56));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getScientificInstance()'\r
+     */\r
+    public void testGetScientificInstance() {\r
+        NumberFormat nf = NumberFormat.getScientificInstance();\r
+        assertEquals(".123456E4", nf.format(1234.56));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getScientificInstance(Locale)'\r
+     */\r
+    public void testGetScientificInstanceLocale() {\r
+        NumberFormat nf = NumberFormat.getScientificInstance(Locale.GERMANY);\r
+        assertEquals(",123456E4", nf.format(1234.56));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getScientificInstance(ULocale)'\r
+     */\r
+    public void testGetScientificInstanceULocale() {\r
+        NumberFormat nf = NumberFormat.getScientificInstance(ULocale.GERMANY);\r
+        assertEquals(",123456E4", nf.format(1234.56));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getAvailableLocales()'\r
+     */\r
+    public void testGetAvailableLocales() {\r
+        Locale[] ilocales = NumberFormat.getAvailableLocales();\r
+        if (ICUTestCase.testingWrapper) {\r
+            Locale[] jlocales = java.text.NumberFormat.getAvailableLocales();\r
+            for (int i = 0; i < ilocales.length; ++i) {\r
+                assertEquals(jlocales[i], ilocales[i]);\r
+            }\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getAvailableULocales()'\r
+     */\r
+    public void testGetAvailableULocales() {\r
+        ULocale[] ulocales = NumberFormat.getAvailableULocales();\r
+        if (ICUTestCase.testingWrapper) {\r
+            Locale[] jlocales = java.text.NumberFormat.getAvailableLocales();\r
+            for (int i = 0; i < ulocales.length; ++i) {\r
+                assertEquals(jlocales[i], ulocales[i].toLocale());\r
+            }\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.isGroupingUsed()'\r
+     */\r
+    public void testIsGroupingUsed() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setGroupingUsed(true);\r
+        assertTrue(nf.isGroupingUsed());\r
+        nf.setGroupingUsed(false);\r
+        assertFalse(nf.isGroupingUsed());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.setGroupingUsed(boolean)'\r
+     */\r
+    public void testSetGroupingUsed() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        assertEquals("123,456,789", nf.format(123456789));\r
+        nf.setGroupingUsed(false);\r
+        assertEquals("123456789", nf.format(123456789));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getMaximumIntegerDigits()'\r
+     */\r
+    public void testGetMaximumIntegerDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMaximumIntegerDigits(4);\r
+        assertEquals(4, nf.getMaximumIntegerDigits());\r
+        nf.setMaximumIntegerDigits(6);\r
+        assertEquals(6, nf.getMaximumIntegerDigits());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.setMaximumIntegerDigits(int)'\r
+     */\r
+    public void testSetMaximumIntegerDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMaximumIntegerDigits(4);\r
+        assertEquals("3,456", nf.format(123456)); // high digits truncated\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getMinimumIntegerDigits()'\r
+     */\r
+    public void testGetMinimumIntegerDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMinimumIntegerDigits(4);\r
+        assertEquals(4, nf.getMinimumIntegerDigits());\r
+        nf.setMinimumIntegerDigits(6);\r
+        assertEquals(6, nf.getMinimumIntegerDigits());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.setMinimumIntegerDigits(int)'\r
+     */\r
+    public void testSetMinimumIntegerDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMinimumIntegerDigits(4);\r
+        assertEquals("0,012", nf.format(12)); // pad out with zero, grouping still used\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getMaximumFractionDigits()'\r
+     */\r
+    public void testGetMaximumFractionDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMaximumFractionDigits(4);\r
+        assertEquals(4, nf.getMaximumFractionDigits());\r
+        nf.setMaximumFractionDigits(6);\r
+        assertEquals(6, nf.getMaximumFractionDigits());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.setMaximumFractionDigits(int)'\r
+     */\r
+    public void testSetMaximumFractionDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMaximumFractionDigits(4);\r
+        assertEquals("1.2346", nf.format(1.2345678)); // low digits rounded\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.getMinimumFractionDigits()'\r
+     */\r
+    public void testGetMinimumFractionDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMinimumFractionDigits(4);\r
+        assertEquals(4, nf.getMinimumFractionDigits());\r
+        nf.setMinimumFractionDigits(6);\r
+        assertEquals(6, nf.getMinimumFractionDigits());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.setMinimumFractionDigits(int)'\r
+     */\r
+    public void testSetMinimumFractionDigits() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        nf.setMinimumFractionDigits(4);\r
+        assertEquals("1.2000", nf.format(1.2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.toString()'\r
+     */\r
+    public void testToString() {\r
+        assertNotNull(NumberFormat.getInstance().toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        NumberFormat nf = NumberFormat.getInstance();\r
+        NumberFormat eq = NumberFormat.getInstance(Locale.US);\r
+        NumberFormat neq = NumberFormat.getInstance(Locale.GERMANY);\r
+                \r
+        ICUTestCase.testEHCS(nf, eq, neq);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.clone()'\r
+     */\r
+    public void testClone() {\r
+        // see testHashCode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.text.NumberFormat.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // see testHashCode\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/SimpleDateFormatTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/SimpleDateFormatTest.java
new file mode 100644 (file)
index 0000000..2bf3623
--- /dev/null
@@ -0,0 +1,202 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.text.FieldPosition;\r
+import java.text.ParseException;\r
+import java.text.ParsePosition;\r
+import java.util.Date;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DateFormatSymbols;\r
+import com.ibm.icu.text.SimpleDateFormat;\r
+import com.ibm.icu.util.Calendar;\r
+import com.ibm.icu.util.TimeZone;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class SimpleDateFormatTest extends ICUTestCase {\r
+    private static final String mdy = "MMM dd yyyy";\r
+    private static final String md2 = "MMM dd yy";\r
+    private static final String hmz = "'The time is' HH:mm:ss zzz";\r
+    private static final String hmzmdy = hmz + " 'on' " + mdy;\r
+    private static final String hmzmdyStr = "The time is 15:05:20 CST on Jan 10 2006";\r
+        \r
+    private static final TimeZone tzc = TimeZone.getTimeZone("CST");\r
+    private static final TimeZone tzp = TimeZone.getTimeZone("PST");\r
+    private static final Calendar cal = Calendar.getInstance(tzc);\r
+    private static final Date date;\r
+    static {\r
+        cal.clear();\r
+        cal.set(2006, 0, 10, 15, 5, 20); // arrgh, doesn't clear millis\r
+        date = cal.getTime();\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.format(Calendar, StringBuffer, FieldPosition)'\r
+     */\r
+    public void testFormatCalendarStringBufferFieldPosition() {\r
+        StringBuffer buf = new StringBuffer();\r
+        FieldPosition fp = new FieldPosition(0);\r
+        SimpleDateFormat sdf = new SimpleDateFormat(hmzmdy);\r
+        sdf.format(cal, buf, fp);\r
+        assertEquals(hmzmdyStr, buf.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.parse(String, Calendar, ParsePosition)'\r
+     */\r
+    public void testParseStringCalendarParsePosition() {\r
+        Calendar cal = Calendar.getInstance(tzp);\r
+        cal.clear();\r
+        ParsePosition pp = new ParsePosition(0);\r
+        SimpleDateFormat sdf = new SimpleDateFormat(hmzmdy);\r
+        sdf.parse(hmzmdyStr, cal, pp);\r
+        assertEquals(date, cal.getTime());\r
+        // note: java doesn't return the parsed time zone\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.clone()'\r
+     */\r
+    public void testClone() {\r
+\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat()'\r
+     */\r
+    public void testSimpleDateFormat() {\r
+        SimpleDateFormat sdf = new SimpleDateFormat();\r
+        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat();\r
+        assertEquals(jsdf.format(date), sdf.format(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String)'\r
+     */\r
+    public void testSimpleDateFormatString() {\r
+        SimpleDateFormat sdf = new SimpleDateFormat(mdy);\r
+        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy);\r
+        assertEquals(jsdf.format(date), sdf.format(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String, Locale)'\r
+     */\r
+    public void testSimpleDateFormatStringLocale() {\r
+        Locale l = Locale.JAPAN;\r
+        SimpleDateFormat sdf = new SimpleDateFormat(mdy, l);\r
+        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy, l);\r
+        assertEquals(jsdf.format(date), sdf.format(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String, ULocale)'\r
+     */\r
+    public void testSimpleDateFormatStringULocale() {\r
+        ULocale l = ULocale.JAPAN;\r
+        SimpleDateFormat sdf = new SimpleDateFormat(mdy, l);\r
+        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy, l.toLocale());\r
+        assertEquals(jsdf.format(date), sdf.format(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.SimpleDateFormat(String, DateFormatSymbols)'\r
+     */\r
+    public void testSimpleDateFormatStringDateFormatSymbols() {\r
+        Locale l = Locale.US;\r
+        DateFormatSymbols dfs = new DateFormatSymbols(l);\r
+        java.text.DateFormatSymbols jdfs = new java.text.DateFormatSymbols(l);\r
+        SimpleDateFormat sdf = new SimpleDateFormat(mdy, dfs);\r
+        java.text.SimpleDateFormat jsdf = new java.text.SimpleDateFormat(mdy, jdfs);\r
+        assertEquals(jsdf.format(date), sdf.format(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.set2DigitYearStart(Date)'\r
+     */\r
+    public void testSet2DigitYearStart() {\r
+        SimpleDateFormat sdf = new SimpleDateFormat(md2);\r
+        sdf.set2DigitYearStart(date);\r
+        try {\r
+            Date d = sdf.parse("Jan 15 04");\r
+            assertNotEqual(-1, d.toString().indexOf("2104"));\r
+        }\r
+        catch (ParseException pe) {\r
+            fail(pe.getMessage());\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.get2DigitYearStart()'\r
+     */\r
+    public void testGet2DigitYearStart() {\r
+        SimpleDateFormat sdf = new SimpleDateFormat(md2);\r
+        sdf.set2DigitYearStart(date);\r
+        assertEquals(date, sdf.get2DigitYearStart());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.toPattern()'\r
+     */\r
+    public void testToPattern() {\r
+        SimpleDateFormat sdf = new SimpleDateFormat(mdy);\r
+        assertEquals(mdy, sdf.toPattern());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.toLocalizedPattern()'\r
+     */\r
+    public void testToLocalizedPattern() {\r
+        Locale l = Locale.getDefault();\r
+        Locale.setDefault(Locale.US);\r
+        SimpleDateFormat sdf = new SimpleDateFormat(mdy);\r
+        assertEquals(mdy, sdf.toLocalizedPattern());\r
+        Locale.setDefault(l);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.applyPattern(String)'\r
+     */\r
+    public void testApplyPattern() {\r
+        SimpleDateFormat sdf = new SimpleDateFormat();\r
+        sdf.setTimeZone(tzc);\r
+        sdf.applyPattern(hmzmdy);\r
+        assertEquals(hmzmdyStr, sdf.format(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.applyLocalizedPattern(String)'\r
+     */\r
+    public void testApplyLocalizedPattern() {\r
+        SimpleDateFormat sdf = new SimpleDateFormat();\r
+        sdf.setTimeZone(tzc);\r
+        sdf.applyLocalizedPattern(hmzmdy);\r
+        assertEquals(hmzmdyStr, sdf.format(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.getDateFormatSymbols()'\r
+     */\r
+    public void testGetDateFormatSymbols() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);\r
+        SimpleDateFormat sdf = new SimpleDateFormat(mdy, dfs);\r
+        assertEquals(dfs, sdf.getDateFormatSymbols());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.text.SimpleDateFormat.setDateFormatSymbols(DateFormatSymbols)'\r
+     */\r
+    public void testSetDateFormatSymbols() {\r
+        DateFormatSymbols dfs = new DateFormatSymbols(Locale.JAPAN);\r
+        SimpleDateFormat sdf = new SimpleDateFormat(hmzmdy);\r
+        sdf.setDateFormatSymbols(dfs);\r
+        // assumes Japanese symbols do not have gregorian month names\r
+        assertEquals(-1, sdf.format(date).indexOf("Jan"));\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/TimeZoneTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/TimeZoneTest.java
new file mode 100644 (file)
index 0000000..d85d0a2
--- /dev/null
@@ -0,0 +1,235 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.util.Date;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.util.Calendar;\r
+import com.ibm.icu.util.TimeZone;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class TimeZoneTest extends ICUTestCase {\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        TimeZone tz1 = TimeZone.getTimeZone("PST");\r
+        TimeZone tz2 = TimeZone.getTimeZone("PST");\r
+        TimeZone tzn = TimeZone.getTimeZone("CST");\r
+        testEHCS(tz1, tz2, tzn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.TimeZone(TimeZone)'\r
+     */\r
+    public void testTimeZone() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getOffset(int, int, int, int, int, int)'\r
+     */\r
+    public void testGetOffset() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        int offset = tz.getOffset(1, 2004, 0, 01, 1, 0);\r
+        assertEquals(-28800000, offset);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.setRawOffset(int)'\r
+     */\r
+    public void testSetRawOffset() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        int value = tz.getRawOffset();\r
+        int value1 = value + 100000;\r
+        tz.setRawOffset(value1);\r
+        int result = tz.getRawOffset();\r
+        assertNotEqual(value, result);\r
+        assertEquals(value1, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getRawOffset()'\r
+     */\r
+    public void testGetRawOffset() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        int offset = tz.getRawOffset();\r
+        assertEquals(-28800000, offset);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getID()'\r
+     */\r
+    public void testGetID() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals("PST", tz.getID());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.setID(String)'\r
+     */\r
+    public void testSetID() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        String value1 = tz.getID();\r
+        String value2 = value1 + "!";\r
+        tz.setID(value2);\r
+        String result = tz.getID();\r
+        assertNotEqual(value1, result);\r
+        assertEquals(value2, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDisplayName()'\r
+     */\r
+    public void testGetDisplayName() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals("Pacific Standard Time", tz.getDisplayName());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDisplayName(Locale)'\r
+     */\r
+    public void testGetDisplayNameLocale() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals("Pacific Standard Time", tz.getDisplayName(Locale.US));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDisplayName(ULocale)'\r
+     */\r
+    public void testGetDisplayNameULocale() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals("Pacific Standard Time", tz.getDisplayName(ULocale.US));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDisplayName(boolean, int)'\r
+     */\r
+    public void testGetDisplayNameBooleanInt() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals("PDT", tz.getDisplayName(true, TimeZone.SHORT));\r
+        assertEquals("Pacific Daylight Time", tz.getDisplayName(true, TimeZone.LONG));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDisplayName(boolean, int, Locale)'\r
+     */\r
+    public void testGetDisplayNameBooleanIntLocale() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals("PDT", tz.getDisplayName(true, TimeZone.SHORT, Locale.US));\r
+        assertEquals("Pacific Daylight Time", tz.getDisplayName(true, TimeZone.LONG, Locale.US));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDisplayName(boolean, int, ULocale)'\r
+     */\r
+    public void testGetDisplayNameBooleanIntULocale() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals("PDT", tz.getDisplayName(true, TimeZone.SHORT, ULocale.US));\r
+        assertEquals("Pacific Daylight Time", tz.getDisplayName(true, TimeZone.LONG, ULocale.US));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDSTSavings()'\r
+     */\r
+    public void testGetDSTSavings() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertEquals(3600000, tz.getDSTSavings());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.useDaylightTime()'\r
+     */\r
+    public void testUseDaylightTime() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        assertTrue(tz.useDaylightTime());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.inDaylightTime(Date)'\r
+     */\r
+    public void testInDaylightTime() {\r
+        TimeZone tz = TimeZone.getTimeZone("PST");\r
+        Calendar cal = Calendar.getInstance();\r
+        cal.set(2005, 0, 17);\r
+        Date date = cal.getTime();\r
+        assertFalse(tz.inDaylightTime(date));\r
+        cal.set(2005, 6, 17);\r
+        date = cal.getTime();\r
+        assertTrue(tz.inDaylightTime(date));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getTimeZone(String)'\r
+     */\r
+    public void testGetTimeZone() {\r
+        // implicitly tested everywhere\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getAvailableIDs(int)'\r
+     */\r
+    public void testGetAvailableIDsInt() {\r
+        String[] ids = TimeZone.getAvailableIDs(-28800000);\r
+        assertNotNull(ids);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getAvailableIDs()'\r
+     */\r
+    public void testGetAvailableIDs() {\r
+        String[] ids = TimeZone.getAvailableIDs();\r
+        assertNotNull(ids);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.getDefault()'\r
+     */\r
+    public void testGetDefault() {\r
+        TimeZone tz = TimeZone.getDefault();\r
+        assertNotNull(tz);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.setDefault(TimeZone)'\r
+     */\r
+    public void testSetDefault() {\r
+        TimeZone tz1 = TimeZone.getDefault();\r
+        String newCode = "PDT".equals(tz1.getID()) ? "CST" : "PDT";\r
+        TimeZone tz2 = TimeZone.getTimeZone(newCode);\r
+        TimeZone.setDefault(tz2);\r
+        TimeZone result = TimeZone.getDefault();\r
+        assertNotEqual(tz1, result);\r
+        assertEquals(tz2, result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.hasSameRules(TimeZone)'\r
+     */\r
+    public void testHasSameRules() {\r
+        TimeZone tz1 = TimeZone.getTimeZone("PST");\r
+        TimeZone tz2 = TimeZone.getTimeZone("America/Los_Angeles");\r
+        assertTrue(tz1.hasSameRules(tz2));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.clone()'\r
+     */\r
+    public void testClone() {\r
+        // tested by testHashCode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.util.TimeZone.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // tested by testHashCode\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ULocaleTest.java b/eclipse-build/plugins.template/com.ibm.icu.base.tests/src/com/ibm/icu/tests/ULocaleTest.java
new file mode 100644 (file)
index 0000000..21cf50b
--- /dev/null
@@ -0,0 +1,748 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2006-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.tests;\r
+\r
+import java.util.Iterator;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.util.ULocale;\r
+\r
+public class ULocaleTest extends ICUTestCase {\r
+    private String sampleName;\r
+    private String longULocaleName;\r
+    private String longULocaleBasename;\r
+    private String nonNormalizedName;\r
+    private ULocale longULocale;\r
+    private Locale sampleLocale;\r
+        \r
+    /**\r
+     * @Override\r
+     */\r
+    protected void setUp() throws Exception {\r
+        super.setUp();\r
+                \r
+        sampleName = "ll_CC_VVVV";\r
+        longULocaleName = "ll_Ssss_CC_VVVV@collation=phonebook;key=value";\r
+        longULocaleBasename = longULocaleName.substring(0, longULocaleName.indexOf('@'));\r
+        nonNormalizedName = "LL_ssss_cc_VVVV@ Key = value ; Collation = phonebook ; ";\r
+        longULocale = new ULocale(longULocaleName);\r
+        sampleLocale = new ULocale(sampleName).toLocale();\r
+    }\r
+        \r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.hashCode()'\r
+     */\r
+    public void testHashCode() {\r
+        ULocale obj = ULocale.GERMANY;\r
+        ULocale eq = new ULocale("de_DE");\r
+        ULocale neq = new ULocale("de_DE_FRENCH");\r
+                \r
+        ICUTestCase.testEHCS(obj, eq, neq);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.forLocale(Locale)'\r
+     */\r
+    public void testForLocale() {\r
+        assertEquals(ULocale.GERMANY, ULocale.forLocale(Locale.GERMANY));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.ULocale(String)'\r
+     */\r
+    public void testULocaleString() {\r
+        assertEquals(ULocale.GERMAN, new ULocale("de"));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.ULocale(String, String)'\r
+     */\r
+    public void testULocaleStringString() {\r
+        assertEquals(ULocale.GERMANY, new ULocale("de", "DE"));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.ULocale(String, String, String)'\r
+     */\r
+    public void testULocaleStringStringString() {\r
+        assertEquals(sampleLocale, new ULocale("ll", "cc", "VVVV").toLocale());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.createCanonical(String)'\r
+     */\r
+    public void testCreateCanonical() {\r
+        ULocale result = ULocale.createCanonical("de__PHONEBOOK");\r
+        assertEquals(new ULocale("de@collation=phonebook"), result);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.toLocale()'\r
+     */\r
+    public void testToLocale() {\r
+        assertEquals(sampleLocale, new ULocale("ll", "cc", "VVVV").toLocale());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDefault()'\r
+     */\r
+    public void testGetDefault() {\r
+        assertEquals(Locale.getDefault(), ULocale.getDefault().toLocale());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.setDefault(ULocale)'\r
+     */\r
+    public void testSetDefault() {\r
+        Locale oldLocale = Locale.getDefault();\r
+        ULocale oldULocale = ULocale.getDefault();\r
+        try {\r
+            ULocale.setDefault(longULocale);\r
+            ICUTestCase.assertNotEqual(Locale.getDefault(), oldLocale);\r
+            ICUTestCase.assertNotEqual(ULocale.getDefault(), oldULocale);\r
+            assertEquals(longULocale, ULocale.getDefault());\r
+            assertEquals(sampleLocale, Locale.getDefault());\r
+        }\r
+        finally {\r
+            ULocale.setDefault(oldULocale);\r
+            Locale.setDefault(oldLocale); // in case of some error\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.clone()'\r
+     */\r
+    public void testClone() {\r
+        // see testHashcode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.equals(Object)'\r
+     */\r
+    public void testEqualsObject() {\r
+        // see testHashcode\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getAvailableLocales()'\r
+     */\r
+    public void testGetAvailableLocales() {\r
+        ULocale[] ulocales = ULocale.getAvailableLocales();\r
+        if (ICUTestCase.testingWrapper) {\r
+            Locale[] locales = Locale.getAvailableLocales();\r
+            for (int i = 0; i < ulocales.length; ++i) {\r
+                assertEquals(ulocales[i].toLocale(), locales[i]);\r
+            }\r
+        }\r
+        // else nothing to test except that the function returned.\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getISOCountries()'\r
+     */\r
+    public void testGetISOCountries() {\r
+        String[] ucountries = ULocale.getISOCountries();\r
+        assertNotNull(ucountries);\r
+        if (ICUTestCase.testingWrapper) {\r
+            // keep our own data for now\r
+            // our data doesn't match java's so this test would fail\r
+            // TODO: enable if we decide to use java's data\r
+            // String[] countries = Locale.getISOCountries();\r
+            // TestBoilerplate.assertArraysEqual(ucountries, countries);\r
+        }\r
+        // else nothing to test except that the function returned.\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getISOLanguages()'\r
+     */\r
+    public void testGetISOLanguages() {\r
+        String[] ulanguages = ULocale.getISOLanguages();\r
+        assertNotNull(ulanguages);\r
+        if (ICUTestCase.testingWrapper) {\r
+            // keep our own data for now\r
+            // our data doesn't match java's so this test would fail\r
+            // TODO: enable if we decide to use java's data\r
+            // String[] languages = Locale.getISOLanguages();\r
+            // TestBoilerplate.assertArraysEqual(ulanguages, languages);\r
+        }\r
+        // else nothing to test except that the function returned.\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getLanguage()'\r
+     */\r
+    public void testGetLanguage() {\r
+        assertEquals("ll", longULocale.getLanguage());\r
+        assertEquals("ll", longULocale.toLocale().getLanguage());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getLanguage(String)'\r
+     */\r
+    public void testGetLanguageString() {\r
+        assertEquals("ll", ULocale.getLanguage(longULocale.getName()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getScript()'\r
+     */\r
+    public void testGetScript() {\r
+        assertEquals("Ssss", longULocale.getScript());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getScript(String)'\r
+     */\r
+    public void testGetScriptString() {\r
+        assertEquals("Ssss", ULocale.getScript(longULocale.getName()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getCountry()'\r
+     */\r
+    public void testGetCountry() {\r
+        assertEquals("CC", longULocale.getCountry());\r
+        assertEquals("CC", longULocale.toLocale().getCountry());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getCountry(String)'\r
+     */\r
+    public void testGetCountryString() {\r
+        assertEquals("CC", ULocale.getCountry(longULocale.getName()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getVariant()'\r
+     */\r
+    public void testGetVariant() {\r
+        assertEquals("VVVV", longULocale.getVariant());\r
+        assertEquals("VVVV", longULocale.toLocale().getVariant());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getVariant(String)'\r
+     */\r
+    public void testGetVariantString() {\r
+        assertEquals("VVVV", ULocale.getVariant(longULocale.getName()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getFallback(String)'\r
+     */\r
+    public void testGetFallbackString() {\r
+        assertEquals(ULocale.GERMAN, ULocale.getFallback(ULocale.GERMANY.getName()));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getFallback()'\r
+     */\r
+    public void testGetFallback() {\r
+        assertEquals(ULocale.GERMAN, ULocale.GERMANY.getFallback());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getBaseName()'\r
+     */\r
+    public void testGetBaseName() {\r
+        assertEquals(longULocaleBasename, longULocale.getBaseName());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getBaseName(String)'\r
+     */\r
+    public void testGetBaseNameString() {\r
+        assertEquals(longULocaleBasename, longULocale.getBaseName());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getName()'\r
+     */\r
+    public void testGetName() {\r
+        assertEquals(longULocaleName, longULocale.getName());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getName(String)'\r
+     */\r
+    public void testGetNameString() {\r
+        assertEquals(longULocaleName, ULocale.getName(nonNormalizedName));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.toString()'\r
+     */\r
+    public void testToString() {\r
+        assertEquals(longULocaleName, longULocale.toString());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getKeywords()'\r
+     */\r
+    public void testGetKeywords() {\r
+        Iterator<String> iter = longULocale.getKeywords();\r
+        assertEquals(iter.next(), "collation");\r
+        assertEquals(iter.next(), "key");\r
+        assertFalse(iter.hasNext());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getKeywords(String)'\r
+     */\r
+    public void testGetKeywordsString() {\r
+        Iterator<String> iter = ULocale.getKeywords(nonNormalizedName);\r
+        assertEquals(iter.next(), "collation");\r
+        assertEquals(iter.next(), "key");\r
+        assertFalse(iter.hasNext());\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getKeywordValue(String)'\r
+     */\r
+    public void testGetKeywordValueString() {\r
+        assertEquals("value", longULocale.getKeywordValue("key"));\r
+        assertEquals("phonebook", longULocale.getKeywordValue("collation"));\r
+        assertNull(longULocale.getKeywordValue("zzyzx"));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getKeywordValue(String, String)'\r
+     */\r
+    public void testGetKeywordValueStringString() {\r
+        assertEquals("value", ULocale.getKeywordValue(longULocaleName, "key"));\r
+        assertEquals("phonebook", ULocale.getKeywordValue(longULocaleName, "collation"));\r
+        assertNull(ULocale.getKeywordValue(longULocaleName, "zzyzx"));\r
+\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.canonicalize(String)'\r
+     */\r
+    public void testCanonicalize() {\r
+        assertEquals("de@collation=phonebook", ULocale.canonicalize("de__PHONEBOOK"));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.setKeywordValue(String, String)'\r
+     */\r
+    public void testSetKeywordValueStringString() {\r
+        ULocale munged = longULocale.setKeywordValue("key", "C#");\r
+        assertEquals("C#", munged.getKeywordValue("key"));\r
+        munged = munged.setKeywordValue("zzyzx", "grue");\r
+        assertEquals("grue", munged.getKeywordValue("zzyzx"));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.setKeywordValue(String, String, String)'\r
+     */\r
+    public void testSetKeywordValueStringStringString() {\r
+        String munged = ULocale.setKeywordValue(longULocaleName, "key", "C#");\r
+        assertEquals("C#", ULocale.getKeywordValue(munged, "key"));\r
+        munged = ULocale.setKeywordValue(munged, "zzyzx", "grue");\r
+        assertEquals("grue", ULocale.getKeywordValue(munged, "zzyzx"));\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Language()'\r
+     */\r
+    public void testGetISO3Language() {\r
+        String il = ULocale.GERMANY.getISO3Language();\r
+        String jl = Locale.GERMANY.getISO3Language();\r
+        assertEquals(il, jl);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Language(String)'\r
+     */\r
+    public void testGetISO3LanguageString() {\r
+        String il = ULocale.getISO3Language(ULocale.GERMANY.getName());\r
+        String jl = Locale.GERMANY.getISO3Language();\r
+        assertEquals(il, jl);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Country()'\r
+     */\r
+    public void testGetISO3Country() {\r
+        String ic = ULocale.GERMANY.getISO3Country();\r
+        String jc = Locale.GERMANY.getISO3Country();\r
+        assertEquals(ic, jc);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getISO3Country(String)'\r
+     */\r
+    public void testGetISO3CountryString() {\r
+        String ic = ULocale.getISO3Country(ULocale.GERMANY.getName());\r
+        String jc = Locale.GERMANY.getISO3Country();\r
+        assertEquals(ic, jc);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage()'\r
+     */\r
+    public void testGetDisplayLanguage() {\r
+        String idl = ULocale.GERMANY.getDisplayLanguage();\r
+        String jdl = Locale.GERMANY.getDisplayLanguage();\r
+        assertEquals(idl, jdl);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage(ULocale)'\r
+     */\r
+    public void testGetDisplayLanguageULocale() {\r
+        String idl = ULocale.GERMANY.getDisplayLanguage(ULocale.GERMANY);\r
+        String jdl = Locale.GERMANY.getDisplayLanguage(Locale.GERMANY);\r
+        assertEquals(idl, jdl);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage(String, String)'\r
+     */\r
+    public void testGetDisplayLanguageStringString() {\r
+        String idl = ULocale.getDisplayLanguage(ULocale.GERMANY.getName(), "de_DE");\r
+        String jdl = Locale.GERMANY.getDisplayLanguage(Locale.GERMANY);\r
+        assertEquals(idl, jdl);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayLanguage(String, ULocale)'\r
+     */\r
+    public void testGetDisplayLanguageStringULocale() {\r
+        String idl = ULocale.getDisplayLanguage(ULocale.GERMANY.getName(), ULocale.GERMANY);\r
+        String jdl = Locale.GERMANY.getDisplayLanguage(Locale.GERMANY);\r
+        assertEquals(idl, jdl);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript()'\r
+     */\r
+    public void testGetDisplayScript() {\r
+        String is = ULocale.TRADITIONAL_CHINESE.getDisplayScript();\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("Hant", is);\r
+        } else {\r
+            assertEquals("Traditional Chinese", is);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript(ULocale)'\r
+     */\r
+    public void testGetDisplayScriptULocale() {\r
+        String is = ULocale.TRADITIONAL_CHINESE.getDisplayScript(ULocale.GERMANY);\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("Hant", is);\r
+        } else {\r
+            // TODO: look up expected value\r
+            assertEquals("Hant", is);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript(String, String)'\r
+     */\r
+    public void testGetDisplayScriptStringString() {\r
+        String is = ULocale.getDisplayScript("zh_Hant", "de_DE");\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("Hant", is);\r
+        } else {\r
+            // TODO: look up expected value\r
+            assertEquals("Hant", is);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayScript(String, ULocale)'\r
+     */\r
+    public void testGetDisplayScriptStringULocale() {\r
+        String is = ULocale.getDisplayScript("zh_Hant", ULocale.GERMANY);\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("Hant", is);\r
+        } else {\r
+            // TODO: look up expected value\r
+            assertEquals("Hant", is);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayCountry()'\r
+     */\r
+    public void testGetDisplayCountry() {\r
+        String idc = ULocale.GERMANY.getDisplayCountry();\r
+        String jdc = Locale.GERMANY.getDisplayCountry();\r
+        assertEquals(idc, jdc);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayCountry(ULocale)'\r
+     */\r
+    public void testGetDisplayCountryULocale() {\r
+        String idc = ULocale.GERMANY.getDisplayCountry(ULocale.GERMANY);\r
+        String jdc = Locale.GERMANY.getDisplayCountry(Locale.GERMANY);\r
+        assertEquals(idc, jdc);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayCountry(String, String)'\r
+     */\r
+    public void testGetDisplayCountryStringString() {\r
+        String idc = ULocale.getDisplayCountry("de_DE", "de_DE");\r
+        String jdc = Locale.GERMANY.getDisplayCountry(Locale.GERMANY);\r
+        assertEquals(idc, jdc);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayCountry(String, ULocale)'\r
+     */\r
+    public void testGetDisplayCountryStringULocale() {\r
+        String idc = ULocale.getDisplayCountry("de_DE", ULocale.GERMANY);\r
+        String jdc = Locale.GERMANY.getDisplayCountry(Locale.GERMANY);\r
+        assertEquals(idc, jdc);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant()'\r
+     */\r
+    public void testGetDisplayVariant() {\r
+        String idv = new ULocale("de_DE_PHONEBOOK").getDisplayVariant();\r
+        String jdv = new Locale("de", "DE", "PHONEBOOK").getDisplayVariant();\r
+        assertEquals(jdv, idv);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant(ULocale)'\r
+     */\r
+    public void testGetDisplayVariantULocale() {\r
+        String idv = new ULocale("de_DE_PHONEBOOK").getDisplayVariant(ULocale.GERMANY);\r
+        String jdv = new Locale("de", "DE", "PHONEBOOK").getDisplayVariant(Locale.GERMANY);\r
+        assertEquals(jdv, idv);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant(String, String)'\r
+     */\r
+    public void testGetDisplayVariantStringString() {\r
+        String idv = ULocale.getDisplayVariant("de_DE_PHONEBOOK", "de_DE");\r
+        String jdv = new Locale("de", "DE", "PHONEBOOK").getDisplayVariant(Locale.GERMANY);\r
+        assertEquals(jdv, idv);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant(String, ULocale)'\r
+     */\r
+    public void testGetDisplayVariantStringULocale() {\r
+        String idv = ULocale.getDisplayVariant("de_DE_PHONEBOOK", ULocale.GERMANY);\r
+        String jdv = new Locale("de", "DE", "PHONEBOOK").getDisplayVariant(Locale.GERMANY);\r
+        assertEquals(jdv, idv);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeyword(String)'\r
+     */\r
+    public void testGetDisplayKeywordString() {\r
+        String idk = ULocale.getDisplayKeyword("collation");\r
+        assertEquals("collation", idk);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeyword(String, String)'\r
+     */\r
+    public void testGetDisplayKeywordStringString() {\r
+        String idk = ULocale.getDisplayKeyword("collation", "de_DE");\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("collation", idk);\r
+        } else {\r
+            // TODO: find real value\r
+            assertEquals("collation", idk);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeyword(String, ULocale)'\r
+     */\r
+    public void testGetDisplayKeywordStringULocale() {\r
+        String idk = ULocale.getDisplayKeyword("collation", ULocale.GERMANY);\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("collation", idk);\r
+        } else {\r
+            // TODO: find real value\r
+            assertEquals("collation", idk);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String)'\r
+     */\r
+    public void testGetDisplayKeywordValueString() {\r
+        ULocale ul = new ULocale("de_DE@collation=phonebook");\r
+        String idk = ul.getDisplayKeywordValue("collation");\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("phonebook", idk);\r
+        } else {\r
+            // TODO: find real value\r
+            assertEquals("phonebook", idk);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String, ULocale)'\r
+     */\r
+    public void testGetDisplayKeywordValueStringULocale() {\r
+        ULocale ul = new ULocale("de_DE@collation=phonebook");\r
+        String idk = ul.getDisplayKeywordValue("collation", ULocale.GERMANY);\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("phonebook", idk);\r
+        } else {\r
+            // TODO: find real value\r
+            assertEquals("phonebook", idk);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String, String, String)'\r
+     */\r
+    public void testGetDisplayKeywordValueStringStringString() {\r
+        String idk = ULocale.getDisplayKeywordValue("de_DE@collation=phonebook", "collation", "de_DE");\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("phonebook", idk);\r
+        } else {\r
+            // TODO: find real value\r
+            assertEquals("phonebook", idk);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String, String, ULocale)'\r
+     */\r
+    public void testGetDisplayKeywordValueStringStringULocale() {\r
+        String idk = ULocale.getDisplayKeywordValue("de_DE@collation=phonebook", "collation", ULocale.GERMANY);\r
+        if (ICUTestCase.testingWrapper) {\r
+            assertEquals("phonebook", idk);\r
+        } else {\r
+            // TODO: find real value\r
+            assertEquals("phonebook", idk);\r
+        }\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName()'\r
+     */\r
+    public void testGetDisplayName() {\r
+        String idn = ULocale.GERMANY.getDisplayName();\r
+        String jdn = Locale.GERMANY.getDisplayName();\r
+        assertEquals(idn, jdn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName(ULocale)'\r
+     */\r
+    public void testGetDisplayNameULocale() {\r
+        String idn = ULocale.GERMANY.getDisplayName(ULocale.GERMANY);\r
+        String jdn = Locale.GERMANY.getDisplayName(Locale.GERMANY);\r
+        assertEquals(idn, jdn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName(String, String)'\r
+     */\r
+    public void testGetDisplayNameStringString() {\r
+        String idn = ULocale.getDisplayName("de_DE", "de_DE");\r
+        String jdn = Locale.GERMANY.getDisplayName(Locale.GERMANY);\r
+        assertEquals(idn, jdn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayName(String, ULocale)'\r
+     */\r
+    public void testGetDisplayNameStringULocale() {\r
+        String idn = ULocale.getDisplayName("de_DE", ULocale.GERMANY);\r
+        String jdn = Locale.GERMANY.getDisplayName(Locale.GERMANY);\r
+        assertEquals(idn, jdn);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(String, ULocale[], boolean[])'\r
+     */\r
+    public void testAcceptLanguageStringULocaleArrayBooleanArray() {\r
+        boolean[] fallback = new boolean[1];\r
+        ULocale[] locales = { \r
+            new ULocale("en_CA"), \r
+            new ULocale("es_US"), \r
+        };\r
+        ULocale result = ULocale.acceptLanguage("en-US, en-GB, en-CA, es-US", locales, fallback);\r
+        assertEquals(new ULocale("en_CA"), result);\r
+        assertFalse(fallback[0]);\r
+        result = ULocale.acceptLanguage("en-US, en-GB, es-US-NEWMEXICO", locales, fallback);\r
+        assertEquals(new ULocale("es_US"), result);\r
+        assertTrue(fallback[0]);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(ULocale[], ULocale[], boolean[])'\r
+     */\r
+    public void testAcceptLanguageULocaleArrayULocaleArrayBooleanArray() {\r
+        boolean[] fallback = new boolean[1];\r
+        ULocale[] locales = { \r
+            new ULocale("en_CA"), \r
+            new ULocale("es_US"), \r
+        };\r
+        ULocale[] accept_locales = {\r
+            new ULocale("en_US"),\r
+            new ULocale("en_GB"),\r
+            new ULocale("en_CA"),\r
+            new ULocale("es_US"),\r
+        };\r
+        ULocale[] accept_locales2 = {\r
+            new ULocale("en_US"),\r
+            new ULocale("en_GB"),\r
+            new ULocale("es_US_NEWMEXICO"),\r
+        };\r
+        ULocale result = ULocale.acceptLanguage(accept_locales, locales, fallback);\r
+        assertEquals(new ULocale("en_CA"), result);\r
+        assertFalse(fallback[0]);\r
+        result = ULocale.acceptLanguage(accept_locales2, locales, fallback);\r
+        assertEquals(new ULocale("es_US"), result);\r
+        assertTrue(fallback[0]);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(String, boolean[])'\r
+     */\r
+    public void testAcceptLanguageStringBooleanArray() {\r
+        boolean[] fallback = new boolean[1];\r
+        ULocale result = ULocale.acceptLanguage("en-CA, en-GB, es-US", fallback);\r
+        assertEquals(new ULocale("en_CA"), result);\r
+        assertFalse(fallback[0]);\r
+        result = ULocale.acceptLanguage("es-US-NEWMEXICO", fallback);\r
+        assertNotNull(result); // actual result depends on jdk\r
+        assertTrue(fallback[0]);\r
+    }\r
+\r
+    /*\r
+     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(ULocale[], boolean[])'\r
+     */\r
+    public void testAcceptLanguageULocaleArrayBooleanArray() {\r
+        boolean[] fallback = new boolean[1];\r
+        ULocale[] accept_locales = {\r
+            new ULocale("en_CA"),\r
+            new ULocale("en_GB"),\r
+            new ULocale("es_US"),\r
+        };\r
+        ULocale[] accept_locales2 = {\r
+            new ULocale("es_US_NEWMEXICO"),\r
+        };\r
+        ULocale result = ULocale.acceptLanguage(accept_locales, fallback);\r
+        assertEquals(new ULocale("en_CA"), result);\r
+        assertFalse(fallback[0]);\r
+        result = ULocale.acceptLanguage(accept_locales2, fallback);\r
+        assertNotNull(result); // actual result depends on jdk\r
+        assertTrue(fallback[0]);\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/.classpath b/eclipse-build/plugins.template/com.ibm.icu.base/.classpath
new file mode 100644 (file)
index 0000000..0215967
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/.project b/eclipse-build/plugins.template/com.ibm.icu.base/.project
new file mode 100644 (file)
index 0000000..5e6c7c3
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>com.ibm.icu.base</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.ManifestBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.SchemaBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+               <nature>org.eclipse.pde.PluginNature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.core.prefs b/eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..852d94d
--- /dev/null
@@ -0,0 +1,77 @@
+#Mon Aug 30 14:05:56 EDT 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore\r
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore\r
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning\r
+org.eclipse.jdt.core.compiler.problem.deadCode=warning\r
+org.eclipse.jdt.core.compiler.problem.deprecation=ignore\r
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled\r
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled\r
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning\r
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore\r
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore\r
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled\r
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore\r
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning\r
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning\r
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error\r
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning\r
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning\r
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore\r
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore\r
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore\r
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning\r
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore\r
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore\r
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore\r
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled\r
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning\r
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore\r
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning\r
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning\r
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore\r
+org.eclipse.jdt.core.compiler.problem.nullReference=warning\r
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning\r
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore\r
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore\r
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore\r
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning\r
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore\r
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore\r
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled\r
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning\r
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled\r
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled\r
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore\r
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning\r
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning\r
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore\r
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning\r
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore\r
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore\r
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled\r
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled\r
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning\r
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning\r
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning\r
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore\r
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled\r
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled\r
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled\r
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning\r
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning\r
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning\r
+org.eclipse.jdt.core.compiler.source=1.5\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.ui.prefs b/eclipse-build/plugins.template/com.ibm.icu.base/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644 (file)
index 0000000..22f322c
--- /dev/null
@@ -0,0 +1,3 @@
+#Thu Dec 14 11:50:17 EST 2006\r
+eclipse.preferences.version=1\r
+internal.default.compliance=default\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/META-INF/MANIFEST.MF b/eclipse-build/plugins.template/com.ibm.icu.base/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..fb58cf7
--- /dev/null
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0\r
+Bundle-ManifestVersion: 2\r
+Bundle-Name: %pluginName\r
+Bundle-SymbolicName: com.ibm.icu.base; singleton:=true\r
+Bundle-Version: @BUILD_VERSION@\r
+Bundle-Vendor: %providerName\r
+Bundle-Localization: plugin\r
+Bundle-Copyright: @COPYRIGHT@\r
+Export-Package: com.ibm.icu.text;base=true;version="@IMPL_VERSION@",\r
+ com.ibm.icu.util;base=true;version="@IMPL_VERSION@",\r
+ com.ibm.icu.math;base=true;version="@IMPL_VERSION@",\r
+ com.ibm.icu.impl;x-internal:=true,\r
+ com.ibm.icu.impl.locale;x-internal:=true\r
+Eclipse-LazyStart: true\r
+Bundle-RequiredExecutionEnvironment: J2SE-1.5\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/build.properties b/eclipse-build/plugins.template/com.ibm.icu.base/build.properties
new file mode 100644 (file)
index 0000000..8b3ddc3
--- /dev/null
@@ -0,0 +1,19 @@
+###############################################################################\r
+# Copyright (c) 2011 IBM Corporation and others.\r
+# All rights reserved. This program and the accompanying materials\r
+# are made available under the terms of the Eclipse Public License v1.0\r
+# which accompanies this distribution, and is available at\r
+# http://www.eclipse.org/legal/epl-v10.html\r
+# \r
+# Contributors:\r
+#     IBM Corporation - initial API and implementation\r
+###############################################################################\r
+source.. = src/\r
+output.. = bin/\r
+src.includes = about.html,\\r
+               about_files/\r
+bin.includes = .,\\r
+               about.html,\\r
+               about_files/,\\r
+               plugin.properties,\\r
+               META-INF/\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/plugin.properties b/eclipse-build/plugins.template/com.ibm.icu.base/plugin.properties
new file mode 100644 (file)
index 0000000..05f97ff
--- /dev/null
@@ -0,0 +1,12 @@
+###############################################################################\r
+# Copyright (c) 2011 IBM Corporation and others.\r
+# All rights reserved. This program and the accompanying materials \r
+# are made available under the terms of the Eclipse Public License v1.0\r
+# which accompanies this distribution, and is available at\r
+# http://www.eclipse.org/legal/epl-v10.html\r
+# \r
+# Contributors:\r
+#     IBM Corporation - initial API and implementation\r
+###############################################################################\r
+pluginName = International Components for Unicode for Java (ICU4J) Replacement plug-in\r
+providerName = IBM Corporation
\ No newline at end of file
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/ICUCache.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/ICUCache.java
new file mode 100644 (file)
index 0000000..c3ca4b5
--- /dev/null
@@ -0,0 +1,21 @@
+/*\r
+ ***************************************************************************\r
+ * Copyright (c) 2007-2011 International Business Machines Corporation and *\r
+ * others.  All rights reserved.                                           *\r
+ ***************************************************************************\r
+*/\r
+\r
+package com.ibm.icu.impl;\r
+\r
+public interface ICUCache<K, V> {\r
+    // Type of reference holding the Map instance\r
+    public static final int SOFT = 0;\r
+    public static final int WEAK = 1;\r
+\r
+    // NULL object, which may be used for a cache key\r
+    public static final Object NULL = new Object();\r
+\r
+    public void clear();\r
+    public void put(K key, V value);\r
+    public V get(Object key);\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDParser.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDParser.java
new file mode 100644 (file)
index 0000000..a9d0d30
--- /dev/null
@@ -0,0 +1,741 @@
+/*\r
+******************************************************************************\r
+* Copyright (C) 2003-2011, International Business Machines Corporation and   *\r
+* others. All Rights Reserved.                                               *\r
+******************************************************************************\r
+*/\r
+\r
+package com.ibm.icu.impl;\r
+\r
+import java.util.Collections;\r
+import java.util.Comparator;\r
+import java.util.Iterator;\r
+import java.util.Map;\r
+import java.util.TreeMap;\r
+\r
+import com.ibm.icu.impl.locale.AsciiUtil;\r
+\r
+/**\r
+ * Utility class to parse and normalize locale ids (including POSIX style)\r
+ */\r
+public final class LocaleIDParser {\r
+    private char[] id;\r
+    private int index;\r
+    private char[] buffer;\r
+    private int blen;\r
+    // um, don't handle POSIX ids unless we request it.  why not?  well... because.\r
+    private boolean canonicalize;\r
+    private boolean hadCountry;\r
+\r
+    // used when canonicalizing\r
+    Map<String, String> keywords;\r
+    String baseName;\r
+\r
+    /**\r
+     * Parsing constants.\r
+     */\r
+    private static final char KEYWORD_SEPARATOR     = '@';\r
+    private static final char HYPHEN                = '-';\r
+    private static final char KEYWORD_ASSIGN        = '=';\r
+    private static final char COMMA                 = ',';\r
+    private static final char ITEM_SEPARATOR        = ';';\r
+    private static final char DOT                   = '.';\r
+    private static final char UNDERSCORE            = '_';\r
+\r
+    public LocaleIDParser(String localeID) {\r
+        this(localeID, false);\r
+    }\r
+\r
+    public LocaleIDParser(String localeID, boolean canonicalize) {\r
+        id = localeID.toCharArray();\r
+        index = 0;\r
+        buffer = new char[id.length + 5];\r
+        blen = 0;\r
+        this.canonicalize = canonicalize;\r
+    }\r
+\r
+    private void reset() {\r
+        index = blen = 0;\r
+    }\r
+\r
+    // utilities for working on text in the buffer\r
+\r
+    /**\r
+     * Append c to the buffer.\r
+     */\r
+    private void append(char c) {\r
+        try {\r
+            buffer[blen] = c;\r
+        }\r
+        catch (IndexOutOfBoundsException e) {\r
+            if (buffer.length > 512) {\r
+                // something is seriously wrong, let this go\r
+                throw e;\r
+            }\r
+            char[] nbuffer = new char[buffer.length * 2];\r
+            System.arraycopy(buffer, 0, nbuffer, 0, buffer.length);\r
+            nbuffer[blen] = c;\r
+            buffer = nbuffer;\r
+        }\r
+        ++blen;\r
+    }\r
+\r
+    private void addSeparator() {\r
+        append(UNDERSCORE);\r
+    }\r
+\r
+    /**\r
+     * Returns the text in the buffer from start to blen as a String.\r
+     */\r
+    private String getString(int start) {\r
+        if (start == blen) {\r
+            return "";\r
+        }\r
+        return new String(buffer, start, blen-start);\r
+    }\r
+\r
+    /**\r
+     * Set the length of the buffer to pos, then append the string.\r
+     */\r
+    private void set(int pos, String s) {\r
+        this.blen = pos; // no safety\r
+        append(s);\r
+    }\r
+\r
+    /**\r
+     * Append the string to the buffer.\r
+     */\r
+    private void append(String s) {\r
+        for (int i = 0; i < s.length(); ++i) {\r
+            append(s.charAt(i));\r
+        }\r
+    }\r
+\r
+    // utilities for parsing text out of the id\r
+\r
+    /**\r
+     * Character to indicate no more text is available in the id.\r
+     */\r
+    private static final char DONE = '\uffff';\r
+\r
+    /**\r
+     * Returns the character at index in the id, and advance index.  The returned character\r
+     * is DONE if index was at the limit of the buffer.  The index is advanced regardless\r
+     * so that decrementing the index will always 'unget' the last character returned.\r
+     */\r
+    private char next() {\r
+        if (index == id.length) {\r
+            index++;\r
+            return DONE;\r
+        }\r
+\r
+        return id[index++];\r
+    }\r
+\r
+    /**\r
+     * Advance index until the next terminator or id separator, and leave it there.\r
+     */\r
+    private void skipUntilTerminatorOrIDSeparator() {\r
+        while (!isTerminatorOrIDSeparator(next())) {\r
+        }\r
+        --index;\r
+    }\r
+\r
+    /**\r
+     * Returns true if the character at index in the id is a terminator.\r
+     */\r
+    private boolean atTerminator() {\r
+        return index >= id.length || isTerminator(id[index]);\r
+    }\r
+\r
+    /*\r
+     * Returns true if the character is an id separator (underscore or hyphen).\r
+     */\r
+    /*        private boolean isIDSeparator(char c) {\r
+            return c == UNDERSCORE || c == HYPHEN;\r
+        }*/\r
+\r
+    /**\r
+     * Returns true if the character is a terminator (keyword separator, dot, or DONE).\r
+     * Dot is a terminator because of the POSIX form, where dot precedes the codepage.\r
+     */\r
+    private boolean isTerminator(char c) {\r
+        // always terminate at DOT, even if not handling POSIX.  It's an error...\r
+        return c == KEYWORD_SEPARATOR || c == DONE || c == DOT;\r
+    }\r
+\r
+    /**\r
+     * Returns true if the character is a terminator or id separator.\r
+     */\r
+    private boolean isTerminatorOrIDSeparator(char c) {\r
+        return c == KEYWORD_SEPARATOR || c == UNDERSCORE || c == HYPHEN ||\r
+        c == DONE || c == DOT;\r
+    }\r
+\r
+    /**\r
+     * Returns true if the start of the buffer has an experimental or private language\r
+     * prefix, the pattern '[ixIX][-_].' shows the syntax checked.\r
+     */\r
+    private boolean haveExperimentalLanguagePrefix() {\r
+        if (id.length > 2) {\r
+            char c = id[1];\r
+            if (c == HYPHEN || c == UNDERSCORE) {\r
+                c = id[0];\r
+                return c == 'x' || c == 'X' || c == 'i' || c == 'I';\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+\r
+    /**\r
+     * Returns true if a value separator occurs at or after index.\r
+     */\r
+    private boolean haveKeywordAssign() {\r
+        // assume it is safe to start from index\r
+        for (int i = index; i < id.length; ++i) {\r
+            if (id[i] == KEYWORD_ASSIGN) {\r
+                return true;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+\r
+    /**\r
+     * Advance index past language, and accumulate normalized language code in buffer.\r
+     * Index must be at 0 when this is called.  Index is left at a terminator or id\r
+     * separator.  Returns the start of the language code in the buffer.\r
+     */\r
+    private int parseLanguage() {\r
+        if (haveExperimentalLanguagePrefix()) {\r
+            append(Character.toLowerCase(id[0]));\r
+            append(HYPHEN);\r
+            index = 2;\r
+        }\r
+\r
+        char c;\r
+        while(!isTerminatorOrIDSeparator(c = next())) {\r
+            append(Character.toLowerCase(c));\r
+        }\r
+        --index; // unget\r
+\r
+        if (blen == 3) {\r
+            String lang = LocaleIDs.threeToTwoLetterLanguage(getString(0));\r
+            if (lang != null) {\r
+                set(0, lang);\r
+            }\r
+        }\r
+\r
+        return 0;\r
+    }\r
+\r
+    /**\r
+     * Advance index past language.  Index must be at 0 when this is called.  Index\r
+     * is left at a terminator or id separator.\r
+     */\r
+    private void skipLanguage() {\r
+        if (haveExperimentalLanguagePrefix()) {\r
+            index = 2;\r
+        }\r
+        skipUntilTerminatorOrIDSeparator();\r
+    }\r
+\r
+    /**\r
+     * Advance index past script, and accumulate normalized script in buffer.\r
+     * Index must be immediately after the language.\r
+     * If the item at this position is not a script (is not four characters\r
+     * long) leave index and buffer unchanged.  Otherwise index is left at\r
+     * a terminator or id separator.  Returns the start of the script code\r
+     * in the buffer (this may be equal to the buffer length, if there is no\r
+     * script).\r
+     */\r
+    private int parseScript() {\r
+        if (!atTerminator()) {\r
+            int oldIndex = index; // save original index\r
+            ++index;\r
+\r
+            int oldBlen = blen; // get before append hyphen, if we truncate everything is undone\r
+            char c;\r
+            while(!isTerminatorOrIDSeparator(c = next())) {\r
+                if (blen == oldBlen) { // first pass\r
+                    addSeparator();\r
+                    append(Character.toUpperCase(c));\r
+                } else {\r
+                    append(Character.toLowerCase(c));\r
+                }\r
+            }\r
+            --index; // unget\r
+\r
+            /* If it's not exactly 4 characters long, then it's not a script. */\r
+            if (index - oldIndex != 5) { // +1 to account for separator\r
+                index = oldIndex;\r
+                blen = oldBlen;\r
+            } else {\r
+                oldBlen++; // index past hyphen, for clients who want to extract just the script\r
+            }\r
+\r
+            return oldBlen;\r
+        }\r
+        return blen;\r
+    }\r
+\r
+    /**\r
+     * Advance index past script.\r
+     * Index must be immediately after the language and IDSeparator.\r
+     * If the item at this position is not a script (is not four characters\r
+     * long) leave index.  Otherwise index is left at a terminator or\r
+     * id separator.\r
+     */\r
+    private void skipScript() {\r
+        if (!atTerminator()) {\r
+            int oldIndex = index;\r
+            ++index;\r
+\r
+            skipUntilTerminatorOrIDSeparator();\r
+            if (index - oldIndex != 5) { // +1 to account for separator\r
+                index = oldIndex;\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Advance index past country, and accumulate normalized country in buffer.\r
+     * Index must be immediately after the script (if there is one, else language)\r
+     * and IDSeparator.  Return the start of the country code in the buffer.\r
+     */\r
+    private int parseCountry() {\r
+        if (!atTerminator()) {\r
+            int oldIndex = index;\r
+            ++index;\r
+\r
+            int oldBlen = blen;\r
+            char c;\r
+            while (!isTerminatorOrIDSeparator(c = next())) {\r
+                if (oldBlen == blen) { // first, add hyphen\r
+                    hadCountry = true; // we have a country, let variant parsing know\r
+                    addSeparator();\r
+                    ++oldBlen; // increment past hyphen\r
+                }\r
+                append(Character.toUpperCase(c));\r
+            }\r
+            --index; // unget\r
+\r
+            int charsAppended = blen - oldBlen;\r
+\r
+            if (charsAppended == 0) {\r
+                // Do nothing.\r
+            }\r
+            else if (charsAppended < 2 || charsAppended > 3) {\r
+                // It's not a country, so return index and blen to\r
+                // their previous values.\r
+                index = oldIndex;\r
+                --oldBlen;\r
+                blen = oldBlen;\r
+                hadCountry = false;\r
+            }\r
+            else if (charsAppended == 3) {\r
+                String region = LocaleIDs.threeToTwoLetterRegion(getString(oldBlen));\r
+                if (region != null) {\r
+                    set(oldBlen, region);\r
+                }\r
+            }\r
+\r
+            return oldBlen;\r
+        }\r
+\r
+        return blen;\r
+    }\r
+\r
+    /**\r
+     * Advance index past country.\r
+     * Index must be immediately after the script (if there is one, else language)\r
+     * and IDSeparator.\r
+     */\r
+    private void skipCountry() {\r
+        if (!atTerminator()) {\r
+            ++index;\r
+            /*\r
+             * Save the index point after the separator, since the format\r
+             * requires two separators if the country is not present.\r
+             */\r
+            int oldIndex = index;\r
+\r
+            skipUntilTerminatorOrIDSeparator();\r
+            int charsSkipped = index - oldIndex;\r
+            if (charsSkipped < 2 || charsSkipped > 3) {\r
+                index = oldIndex;\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Advance index past variant, and accumulate normalized variant in buffer.  This ignores\r
+     * the codepage information from POSIX ids.  Index must be immediately after the country\r
+     * or script.  Index is left at the keyword separator or at the end of the text.  Return\r
+     * the start of the variant code in the buffer.\r
+     *\r
+     * In standard form, we can have the following forms:\r
+     * ll__VVVV\r
+     * ll_CC_VVVV\r
+     * ll_Ssss_VVVV\r
+     * ll_Ssss_CC_VVVV\r
+     *\r
+     * This also handles POSIX ids, which can have the following forms (pppp is code page id):\r
+     * ll_CC.pppp          --> ll_CC\r
+     * ll_CC.pppp@VVVV     --> ll_CC_VVVV\r
+     * ll_CC@VVVV          --> ll_CC_VVVV\r
+     *\r
+     * We identify this use of '@' in POSIX ids by looking for an '=' following\r
+     * the '@'.  If there is one, we consider '@' to start a keyword list, instead of\r
+     * being part of a POSIX id.\r
+     *\r
+     * Note:  since it was decided that we want an option to not handle POSIX ids, this\r
+     * becomes a bit more complex.\r
+     */\r
+    private int parseVariant() {\r
+        int oldBlen = blen;\r
+\r
+        boolean start = true;\r
+        boolean needSeparator = true;\r
+        boolean skipping = false;\r
+        char c;\r
+        while ((c = next()) != DONE) {\r
+            if (c == DOT) {\r
+                start = false;\r
+                skipping = true;\r
+            } else if (c == KEYWORD_SEPARATOR) {\r
+                if (haveKeywordAssign()) {\r
+                    break;\r
+                }\r
+                skipping = false;\r
+                start = false;\r
+                needSeparator = true; // add another underscore if we have more text\r
+            } else if (start) {\r
+                start = false;\r
+            } else if (!skipping) {\r
+                if (needSeparator) {\r
+                    boolean incOldBlen = blen == oldBlen; // need to skip separators\r
+                    needSeparator = false;\r
+                    if (incOldBlen && !hadCountry) { // no country, we'll need two\r
+                        addSeparator();\r
+                        ++oldBlen; // for sure\r
+                    }\r
+                    addSeparator();\r
+                    if (incOldBlen) { // only for the first separator\r
+                        ++oldBlen;\r
+                    }\r
+                }\r
+                c = Character.toUpperCase(c);\r
+                if (c == HYPHEN || c == COMMA) {\r
+                    c = UNDERSCORE;\r
+                }\r
+                append(c);\r
+            }\r
+        }\r
+        --index; // unget\r
+\r
+        return oldBlen;\r
+    }\r
+\r
+    // no need for skipvariant, to get the keywords we'll just scan directly for\r
+    // the keyword separator\r
+\r
+    /**\r
+     * Returns the normalized language id, or the empty string.\r
+     */\r
+    public String getLanguage() {\r
+        reset();\r
+        return getString(parseLanguage());\r
+    }\r
+\r
+    /**\r
+     * Returns the normalized script id, or the empty string.\r
+     */\r
+    public String getScript() {\r
+        reset();\r
+        skipLanguage();\r
+        return getString(parseScript());\r
+    }\r
+\r
+    /**\r
+     * return the normalized country id, or the empty string.\r
+     */\r
+    public String getCountry() {\r
+        reset();\r
+        skipLanguage();\r
+        skipScript();\r
+        return getString(parseCountry());\r
+    }\r
+\r
+    /**\r
+     * Returns the normalized variant id, or the empty string.\r
+     */\r
+    public String getVariant() {\r
+        reset();\r
+        skipLanguage();\r
+        skipScript();\r
+        skipCountry();\r
+        return getString(parseVariant());\r
+    }\r
+\r
+    /**\r
+     * Returns the language, script, country, and variant as separate strings.\r
+     */\r
+    public String[] getLanguageScriptCountryVariant() {\r
+        reset();\r
+        return new String[] {\r
+                getString(parseLanguage()),\r
+                getString(parseScript()),\r
+                getString(parseCountry()),\r
+                getString(parseVariant())\r
+        };\r
+    }\r
+\r
+    public void setBaseName(String baseName) {\r
+        this.baseName = baseName;\r
+    }\r
+\r
+    public void parseBaseName() {\r
+        if (baseName != null) {\r
+            set(0, baseName);\r
+        } else {\r
+            reset();\r
+            parseLanguage();\r
+            parseScript();\r
+            parseCountry();\r
+            parseVariant();\r
+\r
+            // catch unwanted trailing underscore after country if there was no variant\r
+            if (blen > 1 && buffer[blen-1] == UNDERSCORE) {\r
+                --blen;\r
+            }\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Returns the normalized base form of the locale id.  The base\r
+     * form does not include keywords.\r
+     */\r
+    public String getBaseName() {\r
+        if (baseName != null) {\r
+            return baseName;\r
+        }\r
+        parseBaseName();\r
+        return getString(0);\r
+    }\r
+\r
+    /**\r
+     * Returns the normalized full form of the locale id.  The full\r
+     * form includes keywords if they are present.\r
+     */\r
+    public String getName() {\r
+        parseBaseName();\r
+        parseKeywords();\r
+        return getString(0);\r
+    }\r
+\r
+    // keyword utilities\r
+\r
+    /**\r
+     * If we have keywords, advance index to the start of the keywords and return true,\r
+     * otherwise return false.\r
+     */\r
+    private boolean setToKeywordStart() {\r
+        for (int i = index; i < id.length; ++i) {\r
+            if (id[i] == KEYWORD_SEPARATOR) {\r
+                if (canonicalize) {\r
+                    for (int j = ++i; j < id.length; ++j) { // increment i past separator for return\r
+                        if (id[j] == KEYWORD_ASSIGN) {\r
+                            index = i;\r
+                            return true;\r
+                        }\r
+                    }\r
+                } else {\r
+                    if (++i < id.length) {\r
+                        index = i;\r
+                        return true;\r
+                    }\r
+                }\r
+                break;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+\r
+    private static boolean isDoneOrKeywordAssign(char c) {\r
+        return c == DONE || c == KEYWORD_ASSIGN;\r
+    }\r
+\r
+    private static boolean isDoneOrItemSeparator(char c) {\r
+        return c == DONE || c == ITEM_SEPARATOR;\r
+    }\r
+\r
+    private String getKeyword() {\r
+        int start = index;\r
+        while (!isDoneOrKeywordAssign(next())) {\r
+        }\r
+        --index;\r
+        return AsciiUtil.toLowerString(new String(id, start, index-start).trim());\r
+    }\r
+\r
+    private String getValue() {\r
+        int start = index;\r
+        while (!isDoneOrItemSeparator(next())) {\r
+        }\r
+        --index;\r
+        return new String(id, start, index-start).trim(); // leave case alone\r
+    }\r
+\r
+    private Comparator<String> getKeyComparator() {\r
+        final Comparator<String> comp = new Comparator<String>() {\r
+            public int compare(String lhs, String rhs) {\r
+                return lhs.compareTo(rhs);\r
+            }\r
+        };\r
+        return comp;\r
+    }\r
+\r
+    /**\r
+     * Returns a map of the keywords and values, or null if there are none.\r
+     */\r
+    public Map<String, String> getKeywordMap() {\r
+        if (keywords == null) {\r
+            TreeMap<String, String> m = null;\r
+            if (setToKeywordStart()) {\r
+                // trim spaces and convert to lower case, both keywords and values.\r
+                do {\r
+                    String key = getKeyword();\r
+                    if (key.length() == 0) {\r
+                        break;\r
+                    }\r
+                    char c = next();\r
+                    if (c != KEYWORD_ASSIGN) {\r
+                        // throw new IllegalArgumentException("key '" + key + "' missing a value.");\r
+                        if (c == DONE) {\r
+                            break;\r
+                        } else {\r
+                            continue;\r
+                        }\r
+                    }\r
+                    String value = getValue();\r
+                    if (value.length() == 0) {\r
+                        // throw new IllegalArgumentException("key '" + key + "' missing a value.");\r
+                        continue;\r
+                    }\r
+                    if (m == null) {\r
+                        m = new TreeMap<String, String>(getKeyComparator());\r
+                    } else if (m.containsKey(key)) {\r
+                        // throw new IllegalArgumentException("key '" + key + "' already has a value.");\r
+                        continue;\r
+                    }\r
+                    m.put(key, value);\r
+                } while (next() == ITEM_SEPARATOR);\r
+            }\r
+            keywords = m != null ? m : Collections.<String, String>emptyMap();\r
+        }\r
+\r
+        return keywords;\r
+    }\r
+\r
+\r
+    /**\r
+     * Parse the keywords and return start of the string in the buffer.\r
+     */\r
+    private int parseKeywords() {\r
+        int oldBlen = blen;\r
+        Map<String, String> m = getKeywordMap();\r
+        if (!m.isEmpty()) {\r
+            boolean first = true;\r
+            for (Map.Entry<String, String> e : m.entrySet()) {\r
+                append(first ? KEYWORD_SEPARATOR : ITEM_SEPARATOR);\r
+                first = false;\r
+                append(e.getKey());\r
+                append(KEYWORD_ASSIGN);\r
+                append(e.getValue());\r
+            }\r
+            if (blen != oldBlen) {\r
+                ++oldBlen;\r
+            }\r
+        }\r
+        return oldBlen;\r
+    }\r
+\r
+    /**\r
+     * Returns an iterator over the keywords, or null if we have an empty map.\r
+     */\r
+    public Iterator<String> getKeywords() {\r
+        Map<String, String> m = getKeywordMap();\r
+        return m.isEmpty() ? null : m.keySet().iterator();\r
+    }\r
+\r
+    /**\r
+     * Returns the value for the named keyword, or null if the keyword is not\r
+     * present.\r
+     */\r
+    public String getKeywordValue(String keywordName) {\r
+        Map<String, String> m = getKeywordMap();\r
+        return m.isEmpty() ? null : m.get(AsciiUtil.toLowerString(keywordName.trim()));\r
+    }\r
+\r
+    /**\r
+     * Set the keyword value only if it is not already set to something else.\r
+     */\r
+    public void defaultKeywordValue(String keywordName, String value) {\r
+        setKeywordValue(keywordName, value, false);\r
+    }\r
+\r
+    /**\r
+     * Set the value for the named keyword, or unset it if value is null.  If\r
+     * keywordName itself is null, unset all keywords.  If keywordName is not null,\r
+     * value must not be null.\r
+     */\r
+    public void setKeywordValue(String keywordName, String value) {\r
+        setKeywordValue(keywordName, value, true);\r
+    }\r
+\r
+    /**\r
+     * Set the value for the named keyword, or unset it if value is null.  If\r
+     * keywordName itself is null, unset all keywords.  If keywordName is not null,\r
+     * value must not be null.  If reset is true, ignore any previous value for\r
+     * the keyword, otherwise do not change the keyword (including removal of\r
+     * one or all keywords).\r
+     */\r
+    private void setKeywordValue(String keywordName, String value, boolean reset) {\r
+        if (keywordName == null) {\r
+            if (reset) {\r
+                // force new map, ignore value\r
+                keywords = Collections.<String, String>emptyMap();\r
+            }\r
+        } else {\r
+            keywordName = AsciiUtil.toLowerString(keywordName.trim());\r
+            if (keywordName.length() == 0) {\r
+                throw new IllegalArgumentException("keyword must not be empty");\r
+            }\r
+            if (value != null) {\r
+                value = value.trim();\r
+                if (value.length() == 0) {\r
+                    throw new IllegalArgumentException("value must not be empty");\r
+                }\r
+            }\r
+            Map<String, String> m = getKeywordMap();\r
+            if (m.isEmpty()) { // it is EMPTY_MAP\r
+                if (value != null) {\r
+                    // force new map\r
+                    keywords = new TreeMap<String, String>(getKeyComparator());\r
+                    keywords.put(keywordName, value.trim());\r
+                }\r
+            } else {\r
+                if (reset || !m.containsKey(keywordName)) {\r
+                    if (value != null) {\r
+                        m.put(keywordName, value);\r
+                    } else {\r
+                        m.remove(keywordName);\r
+                        if (m.isEmpty()) {\r
+                            // force new map\r
+                            keywords = Collections.<String, String>emptyMap();\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+}
\ No newline at end of file
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDs.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleIDs.java
new file mode 100644 (file)
index 0000000..8edd3d4
--- /dev/null
@@ -0,0 +1,536 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2009-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.impl;\r
+\r
+import java.util.MissingResourceException;\r
+\r
+import com.ibm.icu.util.ULocale;\r
+\r
+\r
+/**\r
+ * Utilities for mapping between old and new language, country, and other\r
+ * locale ID related names.\r
+ */\r
+public class LocaleIDs {\r
+\r
+    /**\r
+     * Returns a list of all 2-letter country codes defined in ISO 3166.\r
+     * Can be used to create Locales.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String[] getISOCountries() {\r
+        initCountryTables();\r
+        return _countries.clone();\r
+    }\r
+\r
+    /**\r
+     * Returns a list of all 2-letter language codes defined in ISO 639.\r
+     * Can be used to create Locales.\r
+     * [NOTE:  ISO 639 is not a stable standard-- some languages' codes have changed.\r
+     * The list this function returns includes both the new and the old codes for the\r
+     * languages whose codes have changed.]\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String[] getISOLanguages() {\r
+        initLanguageTables();\r
+        return _languages.clone();\r
+    }\r
+\r
+    /**\r
+     * Returns a three-letter abbreviation for the provided country.  If the provided\r
+     * country is empty, returns the empty string.  Otherwise, returns\r
+     * an uppercase ISO 3166 3-letter country code.\r
+     * @exception MissingResourceException Throws MissingResourceException if the\r
+     * three-letter country abbreviation is not available for this locale.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getISO3Country(String country){\r
+        initCountryTables();\r
+\r
+        int offset = findIndex(_countries, country);\r
+        if(offset>=0){\r
+            return _countries3[offset];\r
+        }else{\r
+            offset = findIndex(_obsoleteCountries, country);\r
+            if(offset>=0){\r
+                return _obsoleteCountries3[offset];\r
+            }\r
+        }\r
+        return "";\r
+    }\r
+    /**\r
+     * Returns a three-letter abbreviation for the language.  If language is\r
+     * empty, returns the empty string.  Otherwise, returns\r
+     * a lowercase ISO 639-2/T language code.\r
+     * The ISO 639-2 language codes can be found on-line at\r
+     *   <a href="ftp://dkuug.dk/i18n/iso-639-2.txt"><code>ftp://dkuug.dk/i18n/iso-639-2.txt</code></a>\r
+     * @exception MissingResourceException Throws MissingResourceException if the\r
+     * three-letter language abbreviation is not available for this locale.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getISO3Language(String language) {\r
+        initLanguageTables();\r
+\r
+        int offset = findIndex(_languages, language);\r
+        if(offset>=0){\r
+            return _languages3[offset];\r
+        } else {\r
+            offset = findIndex(_obsoleteLanguages, language);\r
+            if (offset >= 0) {\r
+                return _obsoleteLanguages3[offset];\r
+            }\r
+        }\r
+        return "";\r
+    }\r
+\r
+    public static String threeToTwoLetterLanguage(String lang) {\r
+        initLanguageTables();\r
+\r
+        /* convert 3 character code to 2 character code if possible *CWB*/\r
+        int offset = findIndex(_languages3, lang);\r
+        if (offset >= 0) {\r
+            return _languages[offset];\r
+        }\r
+\r
+        offset = findIndex(_obsoleteLanguages3, lang);\r
+        if (offset >= 0) {\r
+            return _obsoleteLanguages[offset];\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    public static String threeToTwoLetterRegion(String region) {\r
+        initCountryTables();\r
+\r
+        /* convert 3 character code to 2 character code if possible *CWB*/\r
+        int offset = findIndex(_countries3, region);\r
+        if (offset >= 0) {\r
+            return _countries[offset];\r
+        }\r
+\r
+        offset = findIndex(_obsoleteCountries3, region);\r
+        if (offset >= 0) {\r
+            return _obsoleteCountries[offset];\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    /**\r
+     * linear search of the string array. the arrays are unfortunately ordered by the\r
+     * two-letter target code, not the three-letter search code, which seems backwards.\r
+     */\r
+    private static int findIndex(String[] array, String target){\r
+        for (int i = 0; i < array.length; i++) {\r
+            if (target.equals(array[i])) {\r
+                return i;\r
+            }\r
+        }\r
+        return -1;\r
+    }\r
+\r
+\r
+    /**\r
+     * Tables used in normalizing portions of the id.\r
+     */\r
+    /* tables updated per http://lcweb.loc.gov/standards/iso639-2/\r
+       to include the revisions up to 2001/7/27 *CWB*/\r
+    /* The 3 character codes are the terminology codes like RFC 3066.\r
+       This is compatible with prior ICU codes */\r
+    /* "in" "iw" "ji" "jw" & "sh" have been withdrawn but are still in\r
+       the table but now at the end of the table because\r
+       3 character codes are duplicates.  This avoids bad searches\r
+       going from 3 to 2 character codes.*/\r
+    /* The range qaa-qtz is reserved for local use. */\r
+\r
+    private static String[] _languages;\r
+    private static String[] _replacementLanguages;\r
+    private static String[] _obsoleteLanguages;\r
+    private static String[] _languages3;\r
+    private static String[] _obsoleteLanguages3;\r
+\r
+    // Avoid initializing languages tables unless we have to.\r
+    private static void initLanguageTables() {\r
+        if (_languages == null) {\r
+\r
+            /* This list MUST be in sorted order, and MUST contain the two-letter codes\r
+               if one exists otherwise use the three letter code */\r
+            String[] tempLanguages = {\r
+                "aa",  "ab",  "ace", "ach", "ada", "ady", "ae",  "af",  "afa",\r
+                "afh", "ak",  "akk", "ale", "alg", "am",  "an",  "ang", "apa",\r
+                "ar",  "arc", "arn", "arp", "art", "arw", "as",  "ast",\r
+                "ath", "aus", "av",  "awa", "ay",  "az",  "ba",  "bad",\r
+                "bai", "bal", "ban", "bas", "bat", "be",  "bej",\r
+                "bem", "ber", "bg",  "bh",  "bho", "bi",  "bik", "bin",\r
+                "bla", "bm",  "bn",  "bnt", "bo",  "br",  "bra", "bs",\r
+                "btk", "bua", "bug", "byn", "ca",  "cad", "cai", "car", "cau",\r
+                "ce",  "ceb", "cel", "ch",  "chb", "chg", "chk", "chm",\r
+                "chn", "cho", "chp", "chr", "chy", "cmc", "co",  "cop",\r
+                "cpe", "cpf", "cpp", "cr",  "crh", "crp", "cs",  "csb", "cu",  "cus",\r
+                "cv",  "cy",  "da",  "dak", "dar", "day", "de",  "del", "den",\r
+                "dgr", "din", "doi", "dra", "dsb", "dua", "dum", "dv",  "dyu",\r
+                "dz",  "ee",  "efi", "egy", "eka", "el",  "elx", "en",\r
+                "enm", "eo",  "es",  "et",  "eu",  "ewo", "fa",\r
+                "fan", "fat", "ff",  "fi",  "fiu", "fj",  "fo",  "fon",\r
+                "fr",  "frm", "fro", "fur", "fy",  "ga",  "gaa", "gay",\r
+                "gba", "gd",  "gem", "gez", "gil", "gl",  "gmh", "gn",\r
+                "goh", "gon", "gor", "got", "grb", "grc", "gu",  "gv",\r
+                "gwi", "ha",  "hai", "haw", "he",  "hi",  "hil", "him",\r
+                "hit", "hmn", "ho",  "hr",  "hsb", "ht",  "hu",  "hup", "hy",  "hz",\r
+                "ia",  "iba", "id",  "ie",  "ig",  "ii",  "ijo", "ik",\r
+                "ilo", "inc", "ine", "inh", "io",  "ira", "iro", "is",  "it",\r
+                "iu",  "ja",  "jbo", "jpr", "jrb", "jv",  "ka",  "kaa", "kab",\r
+                "kac", "kam", "kar", "kaw", "kbd", "kg",  "kha", "khi",\r
+                "kho", "ki",  "kj",  "kk",  "kl",  "km",  "kmb", "kn",\r
+                "ko",  "kok", "kos", "kpe", "kr",  "krc", "kro", "kru", "ks",\r
+                "ku",  "kum", "kut", "kv",  "kw",  "ky",  "la",  "lad",\r
+                "lah", "lam", "lb",  "lez", "lg",  "li",  "ln",  "lo",  "lol",\r
+                "loz", "lt",  "lu",  "lua", "lui", "lun", "luo", "lus",\r
+                "lv",  "mad", "mag", "mai", "mak", "man", "map", "mas",\r
+                "mdf", "mdr", "men", "mg",  "mga", "mh",  "mi",  "mic", "min",\r
+                "mis", "mk",  "mkh", "ml",  "mn",  "mnc", "mni", "mno",\r
+                "mo",  "moh", "mos", "mr",  "ms",  "mt",  "mul", "mun",\r
+                "mus", "mwr", "my",  "myn", "myv", "na",  "nah", "nai", "nap",\r
+                "nb",  "nd",  "nds", "ne",  "new", "ng",  "nia", "nic",\r
+                "niu", "nl",  "nn",  "no",  "nog", "non", "nr",  "nso", "nub",\r
+                "nv",  "nwc", "ny",  "nym", "nyn", "nyo", "nzi", "oc",  "oj",\r
+                "om",  "or",  "os",  "osa", "ota", "oto", "pa",  "paa",\r
+                "pag", "pal", "pam", "pap", "pau", "peo", "phi", "phn",\r
+                "pi",  "pl",  "pon", "pra", "pro", "ps",  "pt",  "qu",\r
+                "raj", "rap", "rar", "rm",  "rn",  "ro",  "roa", "rom",\r
+                "ru",  "rup", "rw",  "sa",  "sad", "sah", "sai", "sal", "sam",\r
+                "sas", "sat", "sc",  "sco", "sd",  "se",  "sel", "sem",\r
+                "sg",  "sga", "sgn", "shn", "si",  "sid", "sio", "sit",\r
+                "sk",  "sl",  "sla", "sm",  "sma", "smi", "smj", "smn",\r
+                "sms", "sn",  "snk", "so",  "sog", "son", "sq",  "sr",\r
+                "srr", "ss",  "ssa", "st",  "su",  "suk", "sus", "sux",\r
+                "sv",  "sw",  "syr", "ta",  "tai", "te",  "tem", "ter",\r
+                "tet", "tg",  "th",  "ti",  "tig", "tiv", "tk",  "tkl",\r
+                "tl",  "tlh", "tli", "tmh", "tn",  "to",  "tog", "tpi", "tr",\r
+                "ts",  "tsi", "tt",  "tum", "tup", "tut", "tvl", "tw",\r
+                "ty",  "tyv", "udm", "ug",  "uga", "uk",  "umb", "und", "ur",\r
+                "uz",  "vai", "ve",  "vi",  "vo",  "vot", "wa",  "wak",\r
+                "wal", "war", "was", "wen", "wo",  "xal", "xh",  "yao", "yap",\r
+                "yi",  "yo",  "ypk", "za",  "zap", "zen", "zh",  "znd",\r
+                "zu",  "zun",\r
+            };\r
+\r
+            String[] tempReplacementLanguages = {\r
+                "id", "he", "yi", "jv", "sr", "nb",/* replacement language codes */\r
+            };\r
+\r
+            String[] tempObsoleteLanguages = {\r
+                "in", "iw", "ji", "jw", "sh", "no",    /* obsolete language codes */\r
+            };\r
+\r
+            /* This list MUST contain a three-letter code for every two-letter code in the\r
+               list above, and they MUST ne in the same order (i.e., the same language must\r
+               be in the same place in both lists)! */\r
+            String[] tempLanguages3 = {\r
+                /*"aa",  "ab",  "ace", "ach", "ada", "ady", "ae",  "af",  "afa",    */\r
+                "aar", "abk", "ace", "ach", "ada", "ady", "ave", "afr", "afa",\r
+                /*"afh", "ak",  "akk", "ale", "alg", "am",  "an",  "ang", "apa",    */\r
+                "afh", "aka", "akk", "ale", "alg", "amh", "arg", "ang", "apa",\r
+                /*"ar",  "arc", "arn", "arp", "art", "arw", "as",  "ast",    */\r
+                "ara", "arc", "arn", "arp", "art", "arw", "asm", "ast",\r
+                /*"ath", "aus", "av",  "awa", "ay",  "az",  "ba",  "bad",    */\r
+                "ath", "aus", "ava", "awa", "aym", "aze", "bak", "bad",\r
+                /*"bai", "bal", "ban", "bas", "bat", "be",  "bej",    */\r
+                "bai", "bal", "ban", "bas", "bat", "bel", "bej",\r
+                /*"bem", "ber", "bg",  "bh",  "bho", "bi",  "bik", "bin",    */\r
+                "bem", "ber", "bul", "bih", "bho", "bis", "bik", "bin",\r
+                /*"bla", "bm",  "bn",  "bnt", "bo",  "br",  "bra", "bs",     */\r
+                "bla", "bam",  "ben", "bnt", "bod", "bre", "bra", "bos",\r
+                /*"btk", "bua", "bug", "byn", "ca",  "cad", "cai", "car", "cau",    */\r
+                "btk", "bua", "bug", "byn", "cat", "cad", "cai", "car", "cau",\r
+                /*"ce",  "ceb", "cel", "ch",  "chb", "chg", "chk", "chm",    */\r
+                "che", "ceb", "cel", "cha", "chb", "chg", "chk", "chm",\r
+                /*"chn", "cho", "chp", "chr", "chy", "cmc", "co",  "cop",    */\r
+                "chn", "cho", "chp", "chr", "chy", "cmc", "cos", "cop",\r
+                /*"cpe", "cpf", "cpp", "cr",  "crh", "crp", "cs",  "csb", "cu",  "cus",    */\r
+                "cpe", "cpf", "cpp", "cre", "crh", "crp", "ces", "csb", "chu", "cus",\r
+                /*"cv",  "cy",  "da",  "dak", "dar", "day", "de",  "del", "den",    */\r
+                "chv", "cym", "dan", "dak", "dar", "day", "deu", "del", "den",\r
+                /*"dgr", "din", "doi", "dra", "dsb", "dua", "dum", "dv",  "dyu",    */\r
+                "dgr", "din", "doi", "dra", "dsb", "dua", "dum", "div", "dyu",\r
+                /*"dz",  "ee",  "efi", "egy", "eka", "el",  "elx", "en",     */\r
+                "dzo", "ewe", "efi", "egy", "eka", "ell", "elx", "eng",\r
+                /*"enm", "eo",  "es",  "et",  "eu",  "ewo", "fa",     */\r
+                "enm", "epo", "spa", "est", "eus", "ewo", "fas",\r
+                /*"fan", "fat", "ff",  "fi",  "fiu", "fj",  "fo",  "fon",    */\r
+                "fan", "fat", "ful", "fin", "fiu", "fij", "fao", "fon",\r
+                /*"fr",  "frm", "fro", "fur", "fy",  "ga",  "gaa", "gay",    */\r
+                "fra", "frm", "fro", "fur", "fry", "gle", "gaa", "gay",\r
+                /*"gba", "gd",  "gem", "gez", "gil", "gl",  "gmh", "gn",     */\r
+                "gba", "gla", "gem", "gez", "gil", "glg", "gmh", "grn",\r
+                /*"goh", "gon", "gor", "got", "grb", "grc", "gu",  "gv",     */\r
+                "goh", "gon", "gor", "got", "grb", "grc", "guj", "glv",\r
+                /*"gwi", "ha",  "hai", "haw", "he",  "hi",  "hil", "him",    */\r
+                "gwi", "hau", "hai", "haw", "heb", "hin", "hil", "him",\r
+                /*"hit", "hmn", "ho",  "hr",  "hsb", "ht",  "hu",  "hup", "hy",  "hz",     */\r
+                "hit", "hmn", "hmo", "hrv", "hsb", "hat", "hun", "hup", "hye", "her",\r
+                /*"ia",  "iba", "id",  "ie",  "ig",  "ii",  "ijo", "ik",     */\r
+                "ina", "iba", "ind", "ile", "ibo", "iii", "ijo", "ipk",\r
+                /*"ilo", "inc", "ine", "inh", "io",  "ira", "iro", "is",  "it",      */\r
+                "ilo", "inc", "ine", "inh", "ido", "ira", "iro", "isl", "ita",\r
+                /*"iu",  "ja",  "jbo", "jpr", "jrb", "jv",  "ka",  "kaa", "kab",   */\r
+                "iku", "jpn", "jbo", "jpr", "jrb", "jaw", "kat", "kaa", "kab",\r
+                /*"kac", "kam", "kar", "kaw", "kbd", "kg",  "kha", "khi",    */\r
+                "kac", "kam", "kar", "kaw", "kbd", "kon", "kha", "khi",\r
+                /*"kho", "ki",  "kj",  "kk",  "kl",  "km",  "kmb", "kn",     */\r
+                "kho", "kik", "kua", "kaz", "kal", "khm", "kmb", "kan",\r
+                /*"ko",  "kok", "kos", "kpe", "kr",  "krc", "kro", "kru", "ks",     */\r
+                "kor", "kok", "kos", "kpe", "kau", "krc", "kro", "kru", "kas",\r
+                /*"ku",  "kum", "kut", "kv",  "kw",  "ky",  "la",  "lad",    */\r
+                "kur", "kum", "kut", "kom", "cor", "kir", "lat", "lad",\r
+                /*"lah", "lam", "lb",  "lez", "lg",  "li",  "ln",  "lo",  "lol",    */\r
+                "lah", "lam", "ltz", "lez", "lug", "lim", "lin", "lao", "lol",\r
+                /*"loz", "lt",  "lu",  "lua", "lui", "lun", "luo", "lus",    */\r
+                "loz", "lit", "lub", "lua", "lui", "lun", "luo", "lus",\r
+                /*"lv",  "mad", "mag", "mai", "mak", "man", "map", "mas",    */\r
+                "lav", "mad", "mag", "mai", "mak", "man", "map", "mas",\r
+                /*"mdf", "mdr", "men", "mg",  "mga", "mh",  "mi",  "mic", "min",    */\r
+                "mdf", "mdr", "men", "mlg", "mga", "mah", "mri", "mic", "min",\r
+                /*"mis", "mk",  "mkh", "ml",  "mn",  "mnc", "mni", "mno",    */\r
+                "mis", "mkd", "mkh", "mal", "mon", "mnc", "mni", "mno",\r
+                /*"mo",  "moh", "mos", "mr",  "ms",  "mt",  "mul", "mun",    */\r
+                "mol", "moh", "mos", "mar", "msa", "mlt", "mul", "mun",\r
+                /*"mus", "mwr", "my",  "myn", "myv", "na",  "nah", "nai", "nap",    */\r
+                "mus", "mwr", "mya", "myn", "myv", "nau", "nah", "nai", "nap",\r
+                /*"nb",  "nd",  "nds", "ne",  "new", "ng",  "nia", "nic",    */\r
+                "nob", "nde", "nds", "nep", "new", "ndo", "nia", "nic",\r
+                /*"niu", "nl",  "nn",  "no",  "nog", "non", "nr",  "nso", "nub",    */\r
+                "niu", "nld", "nno", "nor", "nog", "non", "nbl", "nso", "nub",\r
+                /*"nv",  "nwc", "ny",  "nym", "nyn", "nyo", "nzi", "oc",  "oj",     */\r
+                "nav", "nwc", "nya", "nym", "nyn", "nyo", "nzi", "oci", "oji",\r
+                /*"om",  "or",  "os",  "osa", "ota", "oto", "pa",  "paa",    */\r
+                "orm", "ori", "oss", "osa", "ota", "oto", "pan", "paa",\r
+                /*"pag", "pal", "pam", "pap", "pau", "peo", "phi", "phn",    */\r
+                "pag", "pal", "pam", "pap", "pau", "peo", "phi", "phn",\r
+                /*"pi",  "pl",  "pon", "pra", "pro", "ps",  "pt",  "qu",     */\r
+                "pli", "pol", "pon", "pra", "pro", "pus", "por", "que",\r
+                /*"raj", "rap", "rar", "rm",  "rn",  "ro",  "roa", "rom",    */\r
+                "raj", "rap", "rar", "roh", "run", "ron", "roa", "rom",\r
+                /*"ru",  "rup", "rw",  "sa",  "sad", "sah", "sai", "sal", "sam",    */\r
+                "rus", "rup", "kin", "san", "sad", "sah", "sai", "sal", "sam",\r
+                /*"sas", "sat", "sc",  "sco", "sd",  "se",  "sel", "sem",    */\r
+                "sas", "sat", "srd", "sco", "snd", "sme", "sel", "sem",\r
+                /*"sg",  "sga", "sgn", "shn", "si",  "sid", "sio", "sit",    */\r
+                "sag", "sga", "sgn", "shn", "sin", "sid", "sio", "sit",\r
+                /*"sk",  "sl",  "sla", "sm",  "sma", "smi", "smj", "smn",    */\r
+                "slk", "slv", "sla", "smo", "sma", "smi", "smj", "smn",\r
+                /*"sms", "sn",  "snk", "so",  "sog", "son", "sq",  "sr",     */\r
+                "sms", "sna", "snk", "som", "sog", "son", "sqi", "srp",\r
+                /*"srr", "ss",  "ssa", "st",  "su",  "suk", "sus", "sux",    */\r
+                "srr", "ssw", "ssa", "sot", "sun", "suk", "sus", "sux",\r
+                /*"sv",  "sw",  "syr", "ta",  "tai", "te",  "tem", "ter",    */\r
+                "swe", "swa", "syr", "tam", "tai", "tel", "tem", "ter",\r
+                /*"tet", "tg",  "th",  "ti",  "tig", "tiv", "tk",  "tkl",    */\r
+                "tet", "tgk", "tha", "tir", "tig", "tiv", "tuk", "tkl",\r
+                /*"tl",  "tlh", "tli", "tmh", "tn",  "to",  "tog", "tpi", "tr",     */\r
+                "tgl", "tlh", "tli", "tmh", "tsn", "ton", "tog", "tpi", "tur",\r
+                /*"ts",  "tsi", "tt",  "tum", "tup", "tut", "tvl", "tw",     */\r
+                "tso", "tsi", "tat", "tum", "tup", "tut", "tvl", "twi",\r
+                /*"ty",  "tyv", "udm", "ug",  "uga", "uk",  "umb", "und", "ur",     */\r
+                "tah", "tyv", "udm", "uig", "uga", "ukr", "umb", "und", "urd",\r
+                /*"uz",  "vai", "ve",  "vi",  "vo",  "vot", "wa",  "wak",    */\r
+                "uzb", "vai", "ven", "vie", "vol", "vot", "wln", "wak",\r
+                /*"wal", "war", "was", "wen", "wo",  "xal", "xh",  "yao", "yap",    */\r
+                "wal", "war", "was", "wen", "wol", "xal", "xho", "yao", "yap",\r
+                /*"yi",  "yo",  "ypk", "za",  "zap", "zen", "zh",  "znd",    */\r
+                "yid", "yor", "ypk", "zha", "zap", "zen", "zho", "znd",\r
+                /*"zu",  "zun",                                              */\r
+                "zul", "zun",\r
+            };\r
+\r
+            String[] tempObsoleteLanguages3 = {\r
+                /* "in",  "iw",  "ji",  "jw",  "sh", */\r
+                "ind", "heb", "yid", "jaw", "srp",\r
+            };\r
+\r
+            synchronized (ULocale.class) {\r
+                if (_languages == null) {\r
+                    _languages = tempLanguages;\r
+                    _replacementLanguages = tempReplacementLanguages;\r
+                    _obsoleteLanguages = tempObsoleteLanguages;\r
+                    _languages3 = tempLanguages3;\r
+                    _obsoleteLanguages3 = tempObsoleteLanguages3;\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    private static String[] _countries;\r
+    private static String[] _deprecatedCountries;\r
+    private static String[] _replacementCountries;\r
+    private static String[] _obsoleteCountries;\r
+    private static String[] _countries3;\r
+    private static String[] _obsoleteCountries3;\r
+\r
+    // Avoid initializing country tables unless we have to.\r
+    private static void initCountryTables() {\r
+        if (_countries == null) {\r
+            /* ZR(ZAR) is now CD(COD) and FX(FXX) is PS(PSE) as per\r
+               http://www.evertype.com/standards/iso3166/iso3166-1-en.html\r
+               added new codes keeping the old ones for compatibility\r
+               updated to include 1999/12/03 revisions *CWB*/\r
+\r
+            /* RO(ROM) is now RO(ROU) according to\r
+               http://www.iso.org/iso/en/prods-services/iso3166ma/03updates-on-iso-3166/nlv3e-rou.html\r
+            */\r
+\r
+            /* This list MUST be in sorted order, and MUST contain only two-letter codes! */\r
+            String[] tempCountries = {\r
+                "AD",  "AE",  "AF",  "AG",  "AI",  "AL",  "AM",  "AN",\r
+                "AO",  "AQ",  "AR",  "AS",  "AT",  "AU",  "AW",  "AX",  "AZ",\r
+                "BA",  "BB",  "BD",  "BE",  "BF",  "BG",  "BH",  "BI",\r
+                "BJ",  "BL",  "BM",  "BN",  "BO",  "BR",  "BS",  "BT",  "BV",\r
+                "BW",  "BY",  "BZ",  "CA",  "CC",  "CD",  "CF",  "CG",\r
+                "CH",  "CI",  "CK",  "CL",  "CM",  "CN",  "CO",  "CR",\r
+                "CU",  "CV",  "CX",  "CY",  "CZ",  "DE",  "DJ",  "DK",\r
+                "DM",  "DO",  "DZ",  "EC",  "EE",  "EG",  "EH",  "ER",\r
+                "ES",  "ET",  "FI",  "FJ",  "FK",  "FM",  "FO",  "FR",\r
+                "GA",  "GB",  "GD",  "GE",  "GF",  "GG",  "GH",  "GI",  "GL",\r
+                "GM",  "GN",  "GP",  "GQ",  "GR",  "GS",  "GT",  "GU",\r
+                "GW",  "GY",  "HK",  "HM",  "HN",  "HR",  "HT",  "HU",\r
+                "ID",  "IE",  "IL",  "IM",  "IN",  "IO",  "IQ",  "IR",  "IS",\r
+                "IT",  "JE",  "JM",  "JO",  "JP",  "KE",  "KG",  "KH",  "KI",\r
+                "KM",  "KN",  "KP",  "KR",  "KW",  "KY",  "KZ",  "LA",\r
+                "LB",  "LC",  "LI",  "LK",  "LR",  "LS",  "LT",  "LU",\r
+                "LV",  "LY",  "MA",  "MC",  "MD",  "ME",  "MF",  "MG",  "MH",  "MK",\r
+                "ML",  "MM",  "MN",  "MO",  "MP",  "MQ",  "MR",  "MS",\r
+                "MT",  "MU",  "MV",  "MW",  "MX",  "MY",  "MZ",  "NA",\r
+                "NC",  "NE",  "NF",  "NG",  "NI",  "NL",  "NO",  "NP",\r
+                "NR",  "NU",  "NZ",  "OM",  "PA",  "PE",  "PF",  "PG",\r
+                "PH",  "PK",  "PL",  "PM",  "PN",  "PR",  "PS",  "PT",\r
+                "PW",  "PY",  "QA",  "RE",  "RO",  "RS",  "RU",  "RW",  "SA",\r
+                "SB",  "SC",  "SD",  "SE",  "SG",  "SH",  "SI",  "SJ",\r
+                "SK",  "SL",  "SM",  "SN",  "SO",  "SR",  "ST",  "SV",\r
+                "SY",  "SZ",  "TC",  "TD",  "TF",  "TG",  "TH",  "TJ",\r
+                "TK",  "TL",  "TM",  "TN",  "TO",  "TR",  "TT",  "TV",\r
+                "TW",  "TZ",  "UA",  "UG",  "UM",  "US",  "UY",  "UZ",\r
+                "VA",  "VC",  "VE",  "VG",  "VI",  "VN",  "VU",  "WF",\r
+                "WS",  "YE",  "YT",  "ZA",  "ZM",  "ZW",\r
+            };\r
+\r
+            /* this table is used for 3 letter codes */\r
+            String[] tempObsoleteCountries = {\r
+                "FX",  "CS",  "RO",  "TP",  "YU",  "ZR",  /* obsolete country codes */\r
+            };\r
+\r
+            String[] tempDeprecatedCountries = {\r
+               "BU", "CS", "DY", "FX", "HV", "NH", "RH", "TP", "YU", "ZR" /* deprecated country list */\r
+            };\r
+            String[] tempReplacementCountries = {\r
+           /*  "BU", "CS", "DY", "FX", "HV", "NH", "RH", "TP", "YU", "ZR" */\r
+               "MM", "RS", "BJ", "FR", "BF", "VU", "ZW", "TL", "RS", "CD",   /* replacement country codes */\r
+            };\r
+\r
+            /* This list MUST contain a three-letter code for every two-letter code in\r
+               the above list, and they MUST be listed in the same order! */\r
+            String[] tempCountries3 = {\r
+                /*  "AD",  "AE",  "AF",  "AG",  "AI",  "AL",  "AM",  "AN",     */\r
+                    "AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", "ANT",\r
+                /*  "AO",  "AQ",  "AR",  "AS",  "AT",  "AU",  "AW",  "AX",  "AZ",     */\r
+                    "AGO", "ATA", "ARG", "ASM", "AUT", "AUS", "ABW", "ALA", "AZE",\r
+                /*  "BA",  "BB",  "BD",  "BE",  "BF",  "BG",  "BH",  "BI",     */\r
+                    "BIH", "BRB", "BGD", "BEL", "BFA", "BGR", "BHR", "BDI",\r
+                /*  "BJ",  "BL",  "BM",  "BN",  "BO",  "BR",  "BS",  "BT",  "BV",     */\r
+                    "BEN", "BLM", "BMU", "BRN", "BOL", "BRA", "BHS", "BTN", "BVT",\r
+                /*  "BW",  "BY",  "BZ",  "CA",  "CC",  "CD",  "CF",  "CG",     */\r
+                    "BWA", "BLR", "BLZ", "CAN", "CCK", "COD", "CAF", "COG",\r
+                /*  "CH",  "CI",  "CK",  "CL",  "CM",  "CN",  "CO",  "CR",     */\r
+                    "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI",\r
+                /*  "CU",  "CV",  "CX",  "CY",  "CZ",  "DE",  "DJ",  "DK",     */\r
+                    "CUB", "CPV", "CXR", "CYP", "CZE", "DEU", "DJI", "DNK",\r
+                /*  "DM",  "DO",  "DZ",  "EC",  "EE",  "EG",  "EH",  "ER",     */\r
+                    "DMA", "DOM", "DZA", "ECU", "EST", "EGY", "ESH", "ERI",\r
+                /*  "ES",  "ET",  "FI",  "FJ",  "FK",  "FM",  "FO",  "FR",     */\r
+                    "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", "FRA",\r
+                /*  "GA",  "GB",  "GD",  "GE",  "GF",  "GG",  "GH",  "GI",  "GL",     */\r
+                    "GAB", "GBR", "GRD", "GEO", "GUF", "GGY", "GHA", "GIB", "GRL",\r
+                /*  "GM",  "GN",  "GP",  "GQ",  "GR",  "GS",  "GT",  "GU",     */\r
+                    "GMB", "GIN", "GLP", "GNQ", "GRC", "SGS", "GTM", "GUM",\r
+                /*  "GW",  "GY",  "HK",  "HM",  "HN",  "HR",  "HT",  "HU",     */\r
+                    "GNB", "GUY", "HKG", "HMD", "HND", "HRV", "HTI", "HUN",\r
+                /*  "ID",  "IE",  "IL",  "IM",  "IN",  "IO",  "IQ",  "IR",  "IS" */\r
+                    "IDN", "IRL", "ISR", "IMN", "IND", "IOT", "IRQ", "IRN", "ISL",\r
+                /*  "IT",  "JE",  "JM",  "JO",  "JP",  "KE",  "KG",  "KH",  "KI",     */\r
+                    "ITA", "JEY", "JAM", "JOR", "JPN", "KEN", "KGZ", "KHM", "KIR",\r
+                /*  "KM",  "KN",  "KP",  "KR",  "KW",  "KY",  "KZ",  "LA",     */\r
+                    "COM", "KNA", "PRK", "KOR", "KWT", "CYM", "KAZ", "LAO",\r
+                /*  "LB",  "LC",  "LI",  "LK",  "LR",  "LS",  "LT",  "LU",     */\r
+                    "LBN", "LCA", "LIE", "LKA", "LBR", "LSO", "LTU", "LUX",\r
+                /*  "LV",  "LY",  "MA",  "MC",  "MD",  "ME",  "MF",  "MG",  "MH",  "MK",     */\r
+                    "LVA", "LBY", "MAR", "MCO", "MDA", "MNE", "MAF", "MDG", "MHL", "MKD",\r
+                /*  "ML",  "MM",  "MN",  "MO",  "MP",  "MQ",  "MR",  "MS",     */\r
+                    "MLI", "MMR", "MNG", "MAC", "MNP", "MTQ", "MRT", "MSR",\r
+                /*  "MT",  "MU",  "MV",  "MW",  "MX",  "MY",  "MZ",  "NA",     */\r
+                    "MLT", "MUS", "MDV", "MWI", "MEX", "MYS", "MOZ", "NAM",\r
+                /*  "NC",  "NE",  "NF",  "NG",  "NI",  "NL",  "NO",  "NP",     */\r
+                    "NCL", "NER", "NFK", "NGA", "NIC", "NLD", "NOR", "NPL",\r
+                /*  "NR",  "NU",  "NZ",  "OM",  "PA",  "PE",  "PF",  "PG",     */\r
+                    "NRU", "NIU", "NZL", "OMN", "PAN", "PER", "PYF", "PNG",\r
+                /*  "PH",  "PK",  "PL",  "PM",  "PN",  "PR",  "PS",  "PT",     */\r
+                    "PHL", "PAK", "POL", "SPM", "PCN", "PRI", "PSE", "PRT",\r
+                /*  "PW",  "PY",  "QA",  "RE",  "RO",  "RS",  "RU",  "RW",  "SA",     */\r
+                    "PLW", "PRY", "QAT", "REU", "ROU", "SRB", "RUS", "RWA", "SAU",\r
+                /*  "SB",  "SC",  "SD",  "SE",  "SG",  "SH",  "SI",  "SJ",     */\r
+                    "SLB", "SYC", "SDN", "SWE", "SGP", "SHN", "SVN", "SJM",\r
+                /*  "SK",  "SL",  "SM",  "SN",  "SO",  "SR",  "ST",  "SV",     */\r
+                    "SVK", "SLE", "SMR", "SEN", "SOM", "SUR", "STP", "SLV",\r
+                /*  "SY",  "SZ",  "TC",  "TD",  "TF",  "TG",  "TH",  "TJ",     */\r
+                    "SYR", "SWZ", "TCA", "TCD", "ATF", "TGO", "THA", "TJK",\r
+                /*  "TK",  "TL",  "TM",  "TN",  "TO",  "TR",  "TT",  "TV",     */\r
+                    "TKL", "TLS", "TKM", "TUN", "TON", "TUR", "TTO", "TUV",\r
+                /*  "TW",  "TZ",  "UA",  "UG",  "UM",  "US",  "UY",  "UZ",     */\r
+                    "TWN", "TZA", "UKR", "UGA", "UMI", "USA", "URY", "UZB",\r
+                /*  "VA",  "VC",  "VE",  "VG",  "VI",  "VN",  "VU",  "WF",     */\r
+                    "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF",\r
+                /*  "WS",  "YE",  "YT",  "ZA",  "ZM",  "ZW"          */\r
+                    "WSM", "YEM", "MYT", "ZAF", "ZMB", "ZWE",\r
+            };\r
+\r
+            String[] tempObsoleteCountries3 = {\r
+                /*"FX",  "CS",  "RO",  "TP",  "YU",  "ZR",   */\r
+                "FXX", "SCG", "ROM", "TMP", "YUG", "ZAR",\r
+            };\r
+\r
+            synchronized (ULocale.class) {\r
+                if (_countries == null) {\r
+                    _countries = tempCountries;\r
+                    _deprecatedCountries = tempDeprecatedCountries;\r
+                    _replacementCountries = tempReplacementCountries;\r
+                    _obsoleteCountries = tempObsoleteCountries;\r
+                    _countries3 = tempCountries3;\r
+                    _obsoleteCountries3 = tempObsoleteCountries3;\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    public static String getCurrentCountryID(String oldID){\r
+        initCountryTables();\r
+        int offset = findIndex(_deprecatedCountries, oldID);\r
+        if (offset >= 0) {\r
+            return _replacementCountries[offset];\r
+        }\r
+        return oldID;\r
+    }\r
+\r
+    public static String getCurrentLanguageID(String oldID){\r
+        initLanguageTables();\r
+        int offset = findIndex(_obsoleteLanguages, oldID);\r
+        if (offset >= 0) {\r
+            return _replacementLanguages[offset];\r
+        }\r
+        return oldID;\r
+    }\r
+\r
+\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleUtility.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/LocaleUtility.java
new file mode 100644 (file)
index 0000000..f219f09
--- /dev/null
@@ -0,0 +1,132 @@
+/*\r
+ ******************************************************************************\r
+ * Copyright (C) 1996-2011, International Business Machines Corporation and   *\r
+ * others. All Rights Reserved.                                               *\r
+ ******************************************************************************\r
+ *\r
+ ******************************************************************************\r
+ */\r
\r
+package com.ibm.icu.impl;\r
+\r
+import java.util.Locale;\r
+\r
+/**\r
+ * A class to hold utility functions missing from java.util.Locale.\r
+ */\r
+public class LocaleUtility {\r
+\r
+    /**\r
+     * A helper function to convert a string of the form\r
+     * aa_BB_CC to a locale object.  Why isn't this in Locale?\r
+     */\r
+    public static Locale getLocaleFromName(String name) {\r
+        String language = "";\r
+        String country = "";\r
+        String variant = "";\r
+\r
+        int i1 = name.indexOf('_');\r
+        if (i1 < 0) {\r
+            language = name;\r
+        } else {\r
+            language = name.substring(0, i1);\r
+            ++i1;\r
+            int i2 = name.indexOf('_', i1);\r
+            if (i2 < 0) {\r
+                country = name.substring(i1);\r
+            } else {\r
+                country = name.substring(i1, i2);\r
+                variant = name.substring(i2+1);\r
+            }\r
+        }\r
+\r
+        return new Locale(language, country, variant);\r
+    }\r
+\r
+    /**\r
+     * Compare two locale strings of the form aa_BB_CC, and\r
+     * return true if parent is a 'strict' fallback of child, that is,\r
+     * if child =~ "^parent(_.+)*" (roughly).\r
+     */\r
+    public static boolean isFallbackOf(String parent, String child) {\r
+        if (!child.startsWith(parent)) {\r
+            return false;\r
+        }\r
+        int i = parent.length();\r
+        return (i == child.length() ||\r
+                child.charAt(i) == '_');\r
+    }\r
+\r
+    /**\r
+     * Compare two locales, and return true if the parent is a\r
+     * 'strict' fallback of the child (parent string is a fallback\r
+     * of child string).\r
+     */\r
+    public static boolean isFallbackOf(Locale parent, Locale child) {\r
+        return isFallbackOf(parent.toString(), child.toString());\r
+    }\r
+\r
+\r
+    /*\r
+     * Convenience method that calls canonicalLocaleString(String) with\r
+     * locale.toString();\r
+     */\r
+    /*public static String canonicalLocaleString(Locale locale) {\r
+        return canonicalLocaleString(locale.toString());\r
+    }*/\r
+\r
+    /*\r
+     * You'd think that Locale canonicalizes, since it munges the\r
+     * renamed languages, but it doesn't quite.  It forces the region\r
+     * to be upper case but doesn't do anything about the language or\r
+     * variant.  Our canonical form is 'lower_UPPER_UPPER'.  \r
+     */\r
+    /*public static String canonicalLocaleString(String id) {\r
+        if (id != null) {\r
+            int x = id.indexOf("_");\r
+            if (x == -1) {\r
+                id = id.toLowerCase(Locale.ENGLISH);\r
+            } else {\r
+                StringBuffer buf = new StringBuffer();\r
+                buf.append(id.substring(0, x).toLowerCase(Locale.ENGLISH));\r
+                buf.append(id.substring(x).toUpperCase(Locale.ENGLISH));\r
+\r
+                int len = buf.length();\r
+                int n = len;\r
+                while (--n >= 0 && buf.charAt(n) == '_') {\r
+                }\r
+                if (++n != len) {\r
+                    buf.delete(n, len);\r
+                }\r
+                id = buf.toString();\r
+            }\r
+        }\r
+        return id;\r
+    }*/\r
+\r
+    /**\r
+     * Fallback from the given locale name by removing the rightmost _-delimited\r
+     * element. If there is none, return the root locale ("", "", ""). If this\r
+     * is the root locale, return null. NOTE: The string "root" is not\r
+     * recognized; do not use it.\r
+     * \r
+     * @return a new Locale that is a fallback from the given locale, or null.\r
+     */\r
+    public static Locale fallback(Locale loc) {\r
+\r
+        // Split the locale into parts and remove the rightmost part\r
+        String[] parts = new String[]\r
+            { loc.getLanguage(), loc.getCountry(), loc.getVariant() };\r
+        int i;\r
+        for (i=2; i>=0; --i) {\r
+            if (parts[i].length() != 0) {\r
+                parts[i] = "";\r
+                break;\r
+            }\r
+        }\r
+        if (i<0) {\r
+            return null; // All parts were empty\r
+        }\r
+        return new Locale(parts[0], parts[1], parts[2]);\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/SimpleCache.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/SimpleCache.java
new file mode 100644 (file)
index 0000000..fc431b0
--- /dev/null
@@ -0,0 +1,73 @@
+/*\r
+ ****************************************************************************\r
+ * Copyright (c) 2007-2011 International Business Machines Corporation and  *\r
+ * others.  All rights reserved.                                            *\r
+ ****************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.impl;\r
+\r
+import java.lang.ref.Reference;\r
+import java.lang.ref.SoftReference;\r
+import java.lang.ref.WeakReference;\r
+import java.util.Collections;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+public class SimpleCache<K, V> implements ICUCache<K, V> {\r
+    private static final int DEFAULT_CAPACITY = 16;\r
+\r
+    private Reference<Map<K, V>> cacheRef = null;\r
+    private int type = ICUCache.SOFT;\r
+    private int capacity = DEFAULT_CAPACITY;\r
+\r
+    public SimpleCache() {\r
+    }\r
+\r
+    public SimpleCache(int cacheType) {\r
+        this(cacheType, DEFAULT_CAPACITY);\r
+    }\r
+\r
+    public SimpleCache(int cacheType, int initialCapacity) {\r
+        if (cacheType == ICUCache.WEAK) {\r
+            type = cacheType;\r
+        }\r
+        if (initialCapacity > 0) {\r
+            capacity = initialCapacity;\r
+        }\r
+    }\r
+\r
+    public V get(Object key) {\r
+        Reference<Map<K, V>> ref = cacheRef;\r
+        if (ref != null) {\r
+            Map<K, V> map = ref.get();\r
+            if (map != null) {\r
+                return map.get(key);\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+\r
+    public void put(K key, V value) {\r
+        Reference<Map<K, V>> ref = cacheRef;\r
+        Map<K, V> map = null;\r
+        if (ref != null) {\r
+            map = ref.get();\r
+        }\r
+        if (map == null) {\r
+            map = Collections.synchronizedMap(new HashMap<K, V>(capacity));\r
+            if (type == ICUCache.WEAK) {\r
+                ref = new WeakReference<Map<K, V>>(map);\r
+            } else {\r
+                ref = new SoftReference<Map<K, V>>(map);\r
+            }\r
+            cacheRef = ref;\r
+        }\r
+        map.put(key, value);\r
+    }\r
+\r
+    public void clear() {\r
+        cacheRef = null;\r
+    }\r
+\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/locale/AsciiUtil.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/impl/locale/AsciiUtil.java
new file mode 100644 (file)
index 0000000..24383f0
--- /dev/null
@@ -0,0 +1,180 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2009-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.impl.locale;\r
+\r
+public final class AsciiUtil {\r
+    public static boolean caseIgnoreMatch(String s1, String s2) {\r
+        if (s1 == s2) {\r
+            return true;\r
+        }\r
+        int len = s1.length();\r
+        if (len != s2.length()) {\r
+            return false;\r
+        }\r
+        int i = 0;\r
+        while (i < len) {\r
+            char c1 = s1.charAt(i);\r
+            char c2 = s2.charAt(i);\r
+            if (c1 != c2 && toLower(c1) != toLower(c2)) {\r
+                break;\r
+            }\r
+            i++;\r
+        }\r
+        return (i == len);\r
+    }\r
+\r
+    public static int caseIgnoreCompare(String s1, String s2) {\r
+        if (s1 == s2) {\r
+            return 0;\r
+        }\r
+        return AsciiUtil.toLowerString(s1).compareTo(AsciiUtil.toLowerString(s2));\r
+    }\r
+\r
+\r
+    public static char toUpper(char c) {\r
+        if (c >= 'a' && c <= 'z') {\r
+            c -= 0x20;\r
+        }\r
+        return c;\r
+    }\r
+\r
+    public static char toLower(char c) {\r
+        if (c >= 'A' && c <= 'Z') {\r
+            c += 0x20;\r
+        }\r
+        return c;\r
+    }\r
+\r
+    public static String toLowerString(String s) {\r
+        int idx = 0;\r
+        for (; idx < s.length(); idx++) {\r
+            char c = s.charAt(idx);\r
+            if (c >= 'A' && c <= 'Z') {\r
+                break;\r
+            }\r
+        }\r
+        if (idx == s.length()) {\r
+            return s;\r
+        }\r
+        StringBuilder buf = new StringBuilder(s.substring(0, idx));\r
+        for (; idx < s.length(); idx++) {\r
+            buf.append(toLower(s.charAt(idx)));\r
+        }\r
+        return buf.toString();\r
+    }\r
+\r
+    public static String toUpperString(String s) {\r
+        int idx = 0;\r
+        for (; idx < s.length(); idx++) {\r
+            char c = s.charAt(idx);\r
+            if (c >= 'a' && c <= 'z') {\r
+                break;\r
+            }\r
+        }\r
+        if (idx == s.length()) {\r
+            return s;\r
+        }\r
+        StringBuilder buf = new StringBuilder(s.substring(0, idx));\r
+        for (; idx < s.length(); idx++) {\r
+            buf.append(toUpper(s.charAt(idx)));\r
+        }\r
+        return buf.toString();\r
+    }\r
+\r
+    public static String toTitleString(String s) {\r
+        if (s.length() == 0) {\r
+            return s;\r
+        }\r
+        int idx = 0;\r
+        char c = s.charAt(idx);\r
+        if (!(c >= 'a' && c <= 'z')) {\r
+            for (idx = 1; idx < s.length(); idx++) {\r
+                if (c >= 'A' && c <= 'Z') {\r
+                    break;\r
+                }\r
+            }\r
+        }\r
+        if (idx == s.length()) {\r
+            return s;\r
+        }\r
+        StringBuilder buf = new StringBuilder(s.substring(0, idx));\r
+        if (idx == 0) {\r
+            buf.append(toUpper(s.charAt(idx)));\r
+            idx++;\r
+        }\r
+        for (; idx < s.length(); idx++) {\r
+            buf.append(toLower(s.charAt(idx)));\r
+        }\r
+        return buf.toString();\r
+    }\r
+\r
+    public static boolean isAlpha(char c) {\r
+        return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');\r
+    }\r
+\r
+    public static boolean isAlphaString(String s) {\r
+        boolean b = true;\r
+        for (int i = 0; i < s.length(); i++) {\r
+            if (!isAlpha(s.charAt(i))) {\r
+                b = false;\r
+                break;\r
+            }\r
+        }\r
+        return b;\r
+    }\r
+\r
+    public static boolean isNumeric(char c) {\r
+        return (c >= '0' && c <= '9');\r
+    }\r
+\r
+    public static boolean isNumericString(String s) {\r
+        boolean b = true;\r
+        for (int i = 0; i < s.length(); i++) {\r
+            if (!isNumeric(s.charAt(i))) {\r
+                b = false;\r
+                break;\r
+            }\r
+        }\r
+        return b;\r
+    }\r
+\r
+    public static boolean isAlphaNumeric(char c) {\r
+        return isAlpha(c) || isNumeric(c);\r
+    }\r
+\r
+    public static boolean isAlphaNumericString(String s) {\r
+        boolean b = true;\r
+        for (int i = 0; i < s.length(); i++) {\r
+            if (!isAlphaNumeric(s.charAt(i))) {\r
+                b = false;\r
+                break;\r
+            }\r
+        }\r
+        return b;\r
+    }\r
+\r
+    public static class CaseInsensitiveKey {\r
+        private String _key;\r
+        private int _hash;\r
+\r
+        public CaseInsensitiveKey(String key) {\r
+            _key = key;\r
+            _hash = AsciiUtil.toLowerString(key).hashCode();\r
+        }\r
+\r
+        public boolean equals(Object o) {\r
+            if (o instanceof CaseInsensitiveKey) {\r
+                return AsciiUtil.caseIgnoreMatch(_key, ((CaseInsensitiveKey)o)._key);\r
+            }\r
+            return false;\r
+        }\r
+\r
+        public int hashCode() {\r
+            return _hash;\r
+        }\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/BigDecimal.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/BigDecimal.java
new file mode 100644 (file)
index 0000000..3dfa95b
--- /dev/null
@@ -0,0 +1,3880 @@
+/* Generated from 'BigDecimal.nrx' 8 Sep 2000 11:10:50 [v2.00] */\r
+/* Options: Binary Comments Crossref Format Java Logo Strictargs Strictcase Trace2 Verbose3 */\r
+package com.ibm.icu.math;\r
+\r
+import java.math.BigInteger;\r
+\r
+/* ------------------------------------------------------------------ */\r
+/* BigDecimal -- Decimal arithmetic for Java                          */\r
+/* ------------------------------------------------------------------ */\r
+/* Copyright IBM Corporation, 1996-2011.  All Rights Reserved.       */\r
+/*                                                                    */\r
+/* The BigDecimal class provides immutable arbitrary-precision        */\r
+/* floating point (including integer) decimal numbers.                */\r
+/*                                                                    */\r
+/* As the numbers are decimal, there is an exact correspondence       */\r
+/* between an instance of a BigDecimal object and its String          */\r
+/* representation; the BigDecimal class provides direct conversions   */\r
+/* to and from String and character array objects, and well as        */\r
+/* conversions to and from the Java primitive types (which may not    */\r
+/* be exact).                                                         */\r
+/* ------------------------------------------------------------------ */\r
+/* Notes:                                                             */\r
+/*                                                                    */\r
+/* 1. A BigDecimal object is never changed in value once constructed; */\r
+/*    this avoids the need for locking.  Note in particular that the  */\r
+/*    mantissa array may be shared between many BigDecimal objects,   */\r
+/*    so that once exposed it must not be altered.                    */\r
+/*                                                                    */\r
+/* 2. This class looks at MathContext class fields directly (for      */\r
+/*    performance).  It must not and does not change them.            */\r
+/*                                                                    */\r
+/* 3. Exponent checking is delayed until finish(), as we know         */\r
+/*    intermediate calculations cannot cause 31-bit overflow.         */\r
+/*    [This assertion depends on MAX_DIGITS in MathContext.]          */\r
+/*                                                                    */\r
+/* 4. Comments for the public API now follow the javadoc conventions. */\r
+/*    The NetRexx -comments option is used to pass these comments     */\r
+/*    through to the generated Java code (with -format, if desired).  */\r
+/*                                                                    */\r
+/* 5. System.arraycopy is faster than explicit loop as follows        */\r
+/*      Mean length 4:  equal                                         */\r
+/*      Mean length 8:  x2                                            */\r
+/*      Mean length 16: x3                                            */\r
+/*      Mean length 24: x4                                            */\r
+/*    From prior experience, we expect mean length a little below 8,  */\r
+/*    but arraycopy is still the one to use, in general, until later  */\r
+/*    measurements suggest otherwise.                                 */\r
+/*                                                                    */\r
+/* 6. 'DMSRCN' referred to below is the original (1981) IBM S/370     */\r
+/*    assembler code implementation of the algorithms below; it is    */\r
+/*    now called IXXRCN and is available with the OS/390 and VM/ESA   */\r
+/*    operating systems.                                              */\r
+/* ------------------------------------------------------------------ */\r
+/* Change History:                                                    */\r
+/* 1997.09.02 Initial version (derived from netrexx.lang classes)     */\r
+/* 1997.09.12 Add lostDigits checking                                 */\r
+/* 1997.10.06 Change mantissa to a byte array                         */\r
+/* 1997.11.22 Rework power [did not prepare arguments, etc.]          */\r
+/* 1997.12.13 multiply did not prepare arguments                      */\r
+/* 1997.12.14 add did not prepare and align arguments correctly       */\r
+/* 1998.05.02 0.07 packaging changes suggested by Sun and Oracle      */\r
+/* 1998.05.21 adjust remainder operator finalization                  */\r
+/* 1998.06.04 rework to pass MathContext to finish() and round()      */\r
+/* 1998.06.06 change format to use round(); support rounding modes    */\r
+/* 1998.06.25 rename to BigDecimal and begin merge                    */\r
+/*            zero can now have trailing zeros (i.e., exp\=0)         */\r
+/* 1998.06.28 new methods: movePointXxxx, scale, toBigInteger         */\r
+/*                         unscaledValue, valueof                     */\r
+/* 1998.07.01 improve byteaddsub to allow array reuse, etc.           */\r
+/* 1998.07.01 make null testing explicit to avoid JIT bug [Win32]     */\r
+/* 1998.07.07 scaled division  [divide(BigDecimal, int, int)]         */\r
+/* 1998.07.08 setScale, faster equals                                 */\r
+/* 1998.07.11 allow 1E6 (no sign) <sigh>; new double/float conversion */\r
+/* 1998.10.12 change package to com.ibm.icu.math                          */\r
+/* 1998.12.14 power operator no longer rounds RHS [to match ANSI]     */\r
+/*            add toBigDecimal() and BigDecimal(java.math.BigDecimal) */\r
+/* 1998.12.29 improve byteaddsub by using table lookup                */\r
+/* 1999.02.04 lostdigits=0 behaviour rounds instead of digits+1 guard */\r
+/* 1999.02.05 cleaner code for BigDecimal(char[])                     */\r
+/* 1999.02.06 add javadoc comments                                    */\r
+/* 1999.02.11 format() changed from 7 to 2 method form                */\r
+/* 1999.03.05 null pointer checking is no longer explicit             */\r
+/* 1999.03.05 simplify; changes from discussion with J. Bloch:        */\r
+/*            null no longer permitted for MathContext; drop boolean, */\r
+/*            byte, char, float, short constructor, deprecate double  */\r
+/*            constructor, no blanks in string constructor, add       */\r
+/*            offset and length version of char[] constructor;        */\r
+/*            add valueOf(double); drop booleanValue, charValue;      */\r
+/*            add ...Exact versions of remaining convertors           */\r
+/* 1999.03.13 add toBigIntegerExact                                   */\r
+/* 1999.03.13 1.00 release to IBM Centre for Java Technology          */\r
+/* 1999.05.27 1.01 correct 0-0.2 bug under scaled arithmetic          */\r
+/* 1999.06.29 1.02 constructors should not allow exponent > 9 digits  */\r
+/* 1999.07.03 1.03 lost digits should not be checked if digits=0      */\r
+/* 1999.07.06      lost digits Exception message changed              */\r
+/* 1999.07.10 1.04 more work on 0-0.2 (scaled arithmetic)             */\r
+/* 1999.07.17      improve messages from pow method                   */\r
+/* 1999.08.08      performance tweaks                                 */\r
+/* 1999.08.15      fastpath in multiply                               */\r
+/* 1999.11.05 1.05 fix problem in intValueExact [e.g., 5555555555]    */\r
+/* 1999.12.22 1.06 remove multiply fastpath, and improve performance  */\r
+/* 2000.01.01      copyright update [Y2K has arrived]                 */\r
+/* 2000.06.18 1.08 no longer deprecate BigDecimal(double)             */\r
+/* ------------------------------------------------------------------ */\r
+\r
+/**\r
+ * The <code>BigDecimal</code> class implements immutable arbitrary-precision decimal numbers. The methods of the\r
+ * <code>BigDecimal</code> class provide operations for fixed and floating point arithmetic, comparison, format\r
+ * conversions, and hashing.\r
+ * <p>\r
+ * As the numbers are decimal, there is an exact correspondence between an instance of a <code>BigDecimal</code> object\r
+ * and its <code>String</code> representation; the <code>BigDecimal</code> class provides direct conversions to and from\r
+ * <code>String</code> and character array (<code>char[]</code>) objects, as well as conversions to and from the Java\r
+ * primitive types (which may not be exact) and <code>BigInteger</code>.\r
+ * <p>\r
+ * In the descriptions of constructors and methods in this documentation, the value of a <code>BigDecimal</code> number\r
+ * object is shown as the result of invoking the <code>toString()</code> method on the object. The internal\r
+ * representation of a decimal number is neither defined nor exposed, and is not permitted to affect the result of any\r
+ * operation.\r
+ * <p>\r
+ * The floating point arithmetic provided by this class is defined by the ANSI X3.274-1996 standard, and is also\r
+ * documented at <code>http://www2.hursley.ibm.com/decimal</code> <br>\r
+ * <i>[This URL will change.]</i>\r
+ * \r
+ * <h3>Operator methods</h3>\r
+ * <p>\r
+ * Operations on <code>BigDecimal</code> numbers are controlled by a {@link MathContext} object, which provides the\r
+ * context (precision and other information) for the operation. Methods that can take a <code>MathContext</code>\r
+ * parameter implement the standard arithmetic operators for <code>BigDecimal</code> objects and are known as\r
+ * <i>operator methods</i>. The default settings provided by the constant {@link MathContext#DEFAULT} (<code>digits=9,\r
+ * form=SCIENTIFIC, lostDigits=false, roundingMode=ROUND_HALF_UP</code>) perform general-purpose floating point\r
+ * arithmetic to nine digits of precision. The <code>MathContext</code> parameter must not be <code>null</code>.\r
+ * <p>\r
+ * Each operator method also has a version provided which does not take a <code>MathContext</code> parameter. For this\r
+ * version of each method, the context settings used are <code>digits=0,\r
+ * form=PLAIN, lostDigits=false, roundingMode=ROUND_HALF_UP</code>; these settings perform fixed point arithmetic with\r
+ * unlimited precision, as defined for the original BigDecimal class in Java 1.1 and Java 1.2.\r
+ * <p>\r
+ * For monadic operators, only the optional <code>MathContext</code> parameter is present; the operation acts upon the\r
+ * current object.\r
+ * <p>\r
+ * For dyadic operators, a <code>BigDecimal</code> parameter is always present; it must not be <code>null</code>. The\r
+ * operation acts with the current object being the left-hand operand and the <code>BigDecimal</code> parameter being\r
+ * the right-hand operand.\r
+ * <p>\r
+ * For example, adding two <code>BigDecimal</code> objects referred to by the names <code>award</code> and\r
+ * <code>extra</code> could be written as any of:\r
+ * <p>\r
+ * <code>\r
+ *     award.add(extra)\r
+ * <br>award.add(extra, MathContext.DEFAULT)\r
+ * <br>award.add(extra, acontext)\r
+ * </code>\r
+ * <p>\r
+ * (where <code>acontext</code> is a <code>MathContext</code> object), which would return a <code>BigDecimal</code>\r
+ * object whose value is the result of adding <code>award</code> and <code>extra</code> under the appropriate context\r
+ * settings.\r
+ * <p>\r
+ * When a <code>BigDecimal</code> operator method is used, a set of rules define what the result will be (and, by\r
+ * implication, how the result would be represented as a character string). These rules are defined in the BigDecimal\r
+ * arithmetic documentation (see the URL above), but in summary:\r
+ * <ul>\r
+ * <li>Results are normally calculated with up to some maximum number of significant digits. For example, if the\r
+ * <code>MathContext</code> parameter for an operation were <code>MathContext.DEFAULT</code> then the result would be\r
+ * rounded to 9 digits; the division of 2 by 3 would then result in 0.666666667. <br>\r
+ * You can change the default of 9 significant digits by providing the method with a suitable <code>MathContext</code>\r
+ * object. This lets you calculate using as many digits as you need -- thousands, if necessary. Fixed point (scaled)\r
+ * arithmetic is indicated by using a <code>digits</code> setting of 0 (or omitting the <code>MathContext</code>\r
+ * parameter). <br>\r
+ * Similarly, you can change the algorithm used for rounding from the default "classic" algorithm.\r
+ * <li>\r
+ * In standard arithmetic (that is, when the <code>form</code> setting is not <code>PLAIN</code>), a zero result is\r
+ * always expressed as the single digit <code>'0'</code> (that is, with no sign, decimal point, or exponent part).\r
+ * <li>\r
+ * Except for the division and power operators in standard arithmetic, trailing zeros are preserved (this is in contrast\r
+ * to binary floating point operations and most electronic calculators, which lose the information about trailing zeros\r
+ * in the fractional part of results). <br>\r
+ * So, for example:\r
+ * <p>\r
+ * <code>\r
+ *     new BigDecimal("2.40").add(     new BigDecimal("2"))      =&gt; "4.40"\r
+ * <br>new BigDecimal("2.40").subtract(new BigDecimal("2"))      =&gt; "0.40"\r
+ * <br>new BigDecimal("2.40").multiply(new BigDecimal("2"))      =&gt; "4.80"\r
+ * <br>new BigDecimal("2.40").divide(  new BigDecimal("2"), def) =&gt; "1.2"\r
+ * </code>\r
+ * <p>\r
+ * where the value on the right of the <code>=&gt;</code> would be the result of the operation, expressed as a\r
+ * <code>String</code>, and <code>def</code> (in this and following examples) refers to <code>MathContext.DEFAULT</code>\r
+ * ). This preservation of trailing zeros is desirable for most calculations (including financial calculations). If\r
+ * necessary, trailing zeros may be easily removed using division by 1.\r
+ * <li>\r
+ * In standard arithmetic, exponential form is used for a result depending on its value and the current setting of\r
+ * <code>digits</code> (the default is 9 digits). If the number of places needed before the decimal point exceeds the\r
+ * <code>digits</code> setting, or the absolute value of the number is less than <code>0.000001</code>, then the number\r
+ * will be expressed in exponential notation; thus\r
+ * <p>\r
+ * <code>\r
+ *   new BigDecimal("1e+6").multiply(new BigDecimal("1e+6"), def)\r
+ * </code>\r
+ * <p>\r
+ * results in <code>1E+12</code> instead of <code>1000000000000</code>, and\r
+ * <p>\r
+ * <code>\r
+ *   new BigDecimal("1").divide(new BigDecimal("3E+10"), def)\r
+ * </code>\r
+ * <p>\r
+ * results in <code>3.33333333E-11</code> instead of <code>0.0000000000333333333</code>.\r
+ * <p>\r
+ * The form of the exponential notation (scientific or engineering) is determined by the <code>form</code> setting.\r
+ * <eul>\r
+ * <p>\r
+ * The names of methods in this class follow the conventions established by <code>java.lang.Number</code>,\r
+ * <code>java.math.BigInteger</code>, and <code>java.math.BigDecimal</code> in Java 1.1 and Java 1.2.\r
+ * \r
+ * @see MathContext\r
+ * @author Mike Cowlishaw\r
+ * @stable ICU 2.0\r
+ */\r
+\r
+public class BigDecimal extends java.lang.Number implements java.io.Serializable, java.lang.Comparable<BigDecimal> {\r
+    // private static final java.lang.String $0="BigDecimal.nrx";\r
+\r
+    /* ----- Constants ----- */\r
+    /* properties constant public */// useful to others\r
+    /**\r
+     * The <code>BigDecimal</code> constant "0".\r
+     * \r
+     * @see #ONE\r
+     * @see #TEN\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final com.ibm.icu.math.BigDecimal ZERO = new com.ibm.icu.math.BigDecimal((long) 0); // use long as we\r
+                                                                                                      // want the int\r
+                                                                                                      // constructor\r
+    // .. to be able to use this, for speed\r
+\r
+    /**\r
+     * The <code>BigDecimal</code> constant "1".\r
+     * \r
+     * @see #TEN\r
+     * @see #ZERO\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final com.ibm.icu.math.BigDecimal ONE = new com.ibm.icu.math.BigDecimal((long) 1); // use long as we\r
+                                                                                                     // want the int\r
+                                                                                                     // constructor\r
+    // .. to be able to use this, for speed\r
+\r
+    /**\r
+     * The <code>BigDecimal</code> constant "10".\r
+     * \r
+     * @see #ONE\r
+     * @see #ZERO\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final com.ibm.icu.math.BigDecimal TEN = new com.ibm.icu.math.BigDecimal(10);\r
+\r
+    // the rounding modes (copied here for upwards compatibility)\r
+    /**\r
+     * Rounding mode to round to a more positive number.\r
+     * \r
+     * @see MathContext#ROUND_CEILING\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_CEILING = com.ibm.icu.math.MathContext.ROUND_CEILING;\r
+\r
+    /**\r
+     * Rounding mode to round towards zero.\r
+     * \r
+     * @see MathContext#ROUND_DOWN\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_DOWN = com.ibm.icu.math.MathContext.ROUND_DOWN;\r
+\r
+    /**\r
+     * Rounding mode to round to a more negative number.\r
+     * \r
+     * @see MathContext#ROUND_FLOOR\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_FLOOR = com.ibm.icu.math.MathContext.ROUND_FLOOR;\r
+\r
+    /**\r
+     * Rounding mode to round to nearest neighbor, where an equidistant value is rounded down.\r
+     * \r
+     * @see MathContext#ROUND_HALF_DOWN\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_HALF_DOWN = com.ibm.icu.math.MathContext.ROUND_HALF_DOWN;\r
+\r
+    /**\r
+     * Rounding mode to round to nearest neighbor, where an equidistant value is rounded to the nearest even neighbor.\r
+     * \r
+     * @see MathContext#ROUND_HALF_EVEN\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_HALF_EVEN = com.ibm.icu.math.MathContext.ROUND_HALF_EVEN;\r
+\r
+    /**\r
+     * Rounding mode to round to nearest neighbor, where an equidistant value is rounded up.\r
+     * \r
+     * @see MathContext#ROUND_HALF_UP\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_HALF_UP = com.ibm.icu.math.MathContext.ROUND_HALF_UP;\r
+\r
+    /**\r
+     * Rounding mode to assert that no rounding is necessary.\r
+     * \r
+     * @see MathContext#ROUND_UNNECESSARY\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_UNNECESSARY = com.ibm.icu.math.MathContext.ROUND_UNNECESSARY;\r
+\r
+    /**\r
+     * Rounding mode to round away from zero.\r
+     * \r
+     * @see MathContext#ROUND_UP\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int ROUND_UP = com.ibm.icu.math.MathContext.ROUND_UP;\r
+\r
+    /* properties constant private */// locals\r
+    private static final byte ispos = 1; // ind: indicates positive (must be 1)\r
+    private static final byte iszero = 0; // ind: indicates zero (must be 0)\r
+    private static final byte isneg = -1; // ind: indicates negative (must be -1)\r
+    // [later could add NaN, +/- infinity, here]\r
+\r
+    private static final int MinExp = -999999999; // minimum exponent allowed\r
+    private static final int MaxExp = 999999999; // maximum exponent allowed\r
+    private static final int MinArg = -999999999; // minimum argument integer\r
+    private static final int MaxArg = 999999999; // maximum argument integer\r
+\r
+    private static final com.ibm.icu.math.MathContext plainMC = new com.ibm.icu.math.MathContext(0,\r
+            com.ibm.icu.math.MathContext.PLAIN); // context for plain unlimited math\r
+\r
+    /* properties constant private unused */// present but not referenced\r
+    // Serialization version\r
+    private static final long serialVersionUID = 8245355804974198832L;\r
+\r
+    // private static final java.lang.String\r
+    // copyright=" Copyright (c) IBM Corporation 1996, 2000.  All rights reserved. ";\r
+\r
+    /* properties static private */\r
+    // Precalculated constant arrays (used by byteaddsub)\r
+    private static byte bytecar[] = new byte[(90 + 99) + 1]; // carry/borrow array\r
+    private static byte bytedig[] = diginit(); // next digit array\r
+\r
+    /* ----- Instance properties [all private and immutable] ----- */\r
+    /* properties private */\r
+\r
+    /**\r
+     * The indicator. This may take the values:\r
+     * <ul>\r
+     * <li>ispos -- the number is positive <li>iszero -- the number is zero <li>isneg -- the number is negative\r
+     * </ul>\r
+     * \r
+     * @serial\r
+     */\r
+    private byte ind; // assumed undefined\r
+    // Note: some code below assumes IND = Sign [-1, 0, 1], at present.\r
+    // We only need two bits for this, but use a byte [also permits\r
+    // smooth future extension].\r
+\r
+    /**\r
+     * The formatting style. This may take the values:\r
+     * <ul>\r
+     * <li>MathContext.PLAIN -- no exponent needed <li>MathContext.SCIENTIFIC -- scientific notation required <li>\r
+     * MathContext.ENGINEERING -- engineering notation required\r
+     * </ul>\r
+     * <p>\r
+     * This property is an optimization; it allows us to defer number layout until it is actually needed as a string,\r
+     * hence avoiding unnecessary formatting.\r
+     * \r
+     * @serial\r
+     */\r
+    private byte form = (byte) com.ibm.icu.math.MathContext.PLAIN; // assumed PLAIN\r
+    // We only need two bits for this, at present, but use a byte\r
+    // [again, to allow for smooth future extension]\r
+\r
+    /**\r
+     * The value of the mantissa.\r
+     * <p>\r
+     * Once constructed, this may become shared between several BigDecimal objects, so must not be altered.\r
+     * <p>\r
+     * For efficiency (speed), this is a byte array, with each byte taking a value of 0 -> 9.\r
+     * <p>\r
+     * If the first byte is 0 then the value of the number is zero (and mant.length=1, except when constructed from a\r
+     * plain number, for example, 0.000).\r
+     * \r
+     * @serial\r
+     */\r
+    private byte mant[]; // assumed null\r
+\r
+    /**\r
+     * The exponent.\r
+     * <p>\r
+     * For fixed point arithmetic, scale is <code>-exp</code>, and can apply to zero.\r
+     * \r
+     * Note that this property can have a value less than MinExp when the mantissa has more than one digit.\r
+     * \r
+     * @serial\r
+     */\r
+    private int exp;\r
+\r
+    // assumed 0\r
+\r
+    /* ---------------------------------------------------------------- */\r
+    /* Constructors */\r
+    /* ---------------------------------------------------------------- */\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object from a <code>java.math.BigDecimal</code>.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> as though the parameter had been represented as a <code>String</code> (using\r
+     * its <code>toString</code> method) and the {@link #BigDecimal(java.lang.String)} constructor had then been used.\r
+     * The parameter must not be <code>null</code>.\r
+     * <p>\r
+     * <i>(Note: this constructor is provided only in the <code>com.ibm.icu.math</code> version of the BigDecimal class.\r
+     * It would not be present in a <code>java.math</code> version.)</i>\r
+     * \r
+     * @param bd The <code>BigDecimal</code> to be translated.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(java.math.BigDecimal bd) {\r
+        this(bd.toString());\r
+        return;\r
+    }\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object from a <code>BigInteger</code>, with scale 0.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> which is the exact decimal representation of the <code>BigInteger</code>,\r
+     * with a scale of zero. The value of the <code>BigDecimal</code> is identical to the value of the <code>BigInteger\r
+     * </code>. The parameter must not be <code>null</code>.\r
+     * <p>\r
+     * The <code>BigDecimal</code> will contain only decimal digits, prefixed with a leading minus sign (hyphen) if the\r
+     * <code>BigInteger</code> is negative. A leading zero will be present only if the <code>BigInteger</code> is zero.\r
+     * \r
+     * @param bi The <code>BigInteger</code> to be converted.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(java.math.BigInteger bi) {\r
+        this(bi.toString(10));\r
+        return;\r
+    }\r
+\r
+    // exp remains 0\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object from a <code>BigInteger</code> and a scale.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> which is the exact decimal representation of the <code>BigInteger</code>,\r
+     * scaled by the second parameter, which may not be negative. The value of the <code>BigDecimal</code> is the <code>\r
+     * BigInteger</code> divided by ten to the power of the scale. The <code>BigInteger</code> parameter must not be\r
+     * <code>null</code>.\r
+     * <p>\r
+     * The <code>BigDecimal</code> will contain only decimal digits, (with an embedded decimal point followed by <code>\r
+     * scale</code> decimal digits if the scale is positive), prefixed with a leading minus sign (hyphen) if the <code>\r
+     * BigInteger</code> is negative. A leading zero will be present only if the <code>BigInteger</code> is zero.\r
+     * \r
+     * @param bi The <code>BigInteger</code> to be converted.\r
+     * @param scale The <code>int</code> specifying the scale.\r
+     * @throws NumberFormatException If the scale is negative.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(java.math.BigInteger bi, int scale) {\r
+        this(bi.toString(10));\r
+        if (scale < 0)\r
+            throw new java.lang.NumberFormatException("Negative scale:" + " " + scale);\r
+        exp = -scale; // exponent is -scale\r
+        return;\r
+    }\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object from an array of characters.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> as though a <code>String</code> had been constructed from the character\r
+     * array and the {@link #BigDecimal(java.lang.String)} constructor had then been used. The parameter must not be\r
+     * <code>null</code>.\r
+     * <p>\r
+     * Using this constructor is faster than using the <code>BigDecimal(String)</code> constructor if the string is\r
+     * already available in character array form.\r
+     * \r
+     * @param inchars The <code>char[]</code> array containing the number to be converted.\r
+     * @throws NumberFormatException If the parameter is not a valid number.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(char inchars[]) {\r
+        this(inchars, 0, inchars.length);\r
+        return;\r
+    }\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object from an array of characters.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> as though a <code>String</code> had been constructed from the character\r
+     * array (or a subarray of that array) and the {@link #BigDecimal(java.lang.String)} constructor had then been used.\r
+     * The first parameter must not be <code>null</code>, and the subarray must be wholly contained within it.\r
+     * <p>\r
+     * Using this constructor is faster than using the <code>BigDecimal(String)</code> constructor if the string is\r
+     * already available within a character array.\r
+     * \r
+     * @param inchars The <code>char[]</code> array containing the number to be converted.\r
+     * @param offset The <code>int</code> offset into the array of the start of the number to be converted.\r
+     * @param length The <code>int</code> length of the number.\r
+     * @throws NumberFormatException If the parameter is not a valid number for any reason.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(char inchars[], int offset, int length) {\r
+        super();\r
+        boolean exotic;\r
+        boolean hadexp;\r
+        int d;\r
+        int dotoff;\r
+        int last;\r
+        int i = 0;\r
+        char si = 0;\r
+        boolean eneg = false;\r
+        int k = 0;\r
+        int elen = 0;\r
+        int j = 0;\r
+        char sj = 0;\r
+        int dvalue = 0;\r
+        int mag = 0;\r
+        // This is the primary constructor; all incoming strings end up\r
+        // here; it uses explicit (inline) parsing for speed and to avoid\r
+        // generating intermediate (temporary) objects of any kind.\r
+        // 1998.06.25: exponent form built only if E/e in string\r
+        // 1998.06.25: trailing zeros not removed for zero\r
+        // 1999.03.06: no embedded blanks; allow offset and length\r
+        if (length <= 0)\r
+            bad(inchars); // bad conversion (empty string)\r
+        // [bad offset will raise array bounds exception]\r
+\r
+        /* Handle and step past sign */\r
+        ind = ispos; // assume positive\r
+        if (inchars[offset] == ('-')) {\r
+            length--;\r
+            if (length == 0)\r
+                bad(inchars); // nothing after sign\r
+            ind = isneg;\r
+            offset++;\r
+        } else if (inchars[offset] == ('+')) {\r
+            length--;\r
+            if (length == 0)\r
+                bad(inchars); // nothing after sign\r
+            offset++;\r
+        }\r
+\r
+        /* We're at the start of the number */\r
+        exotic = false; // have extra digits\r
+        hadexp = false; // had explicit exponent\r
+        d = 0; // count of digits found\r
+        dotoff = -1; // offset where dot was found\r
+        last = -1; // last character of mantissa\r
+        {\r
+            int $1 = length;\r
+            i = offset;\r
+            i: for (; $1 > 0; $1--, i++) {\r
+                si = inchars[i];\r
+                if (si >= '0') // test for Arabic digit\r
+                    if (si <= '9') {\r
+                        last = i;\r
+                        d++; // still in mantissa\r
+                        continue i;\r
+                    }\r
+                if (si == '.') { // record and ignore\r
+                    if (dotoff >= 0)\r
+                        bad(inchars); // two dots\r
+                    dotoff = i - offset; // offset into mantissa\r
+                    continue i;\r
+                }\r
+                if (si != 'e')\r
+                    if (si != 'E') { // expect an extra digit\r
+                        if ((!(Character.isDigit(si))))\r
+                            bad(inchars); // not a number\r
+                        // defer the base 10 check until later to avoid extra method call\r
+                        exotic = true; // will need conversion later\r
+                        last = i;\r
+                        d++; // still in mantissa\r
+                        continue i;\r
+                    }\r
+                /* Found 'e' or 'E' -- now process explicit exponent */\r
+                // 1998.07.11: sign no longer required\r
+                if ((i - offset) > (length - 2))\r
+                    bad(inchars); // no room for even one digit\r
+                eneg = false;\r
+                if ((inchars[i + 1]) == ('-')) {\r
+                    eneg = true;\r
+                    k = i + 2;\r
+                } else if ((inchars[i + 1]) == ('+'))\r
+                    k = i + 2;\r
+                else\r
+                    k = i + 1;\r
+                // k is offset of first expected digit\r
+                elen = length - ((k - offset)); // possible number of digits\r
+                if ((elen == 0) | (elen > 9))\r
+                    bad(inchars); // 0 or more than 9 digits\r
+                {\r
+                    int $2 = elen;\r
+                    j = k;\r
+                    for (; $2 > 0; $2--, j++) {\r
+                        sj = inchars[j];\r
+                        if (sj < '0')\r
+                            bad(inchars); // always bad\r
+                        if (sj > '9') { // maybe an exotic digit\r
+                            if ((!(Character.isDigit(sj))))\r
+                                bad(inchars); // not a number\r
+                            dvalue = Character.digit(sj, 10); // check base\r
+                            if (dvalue < 0)\r
+                                bad(inchars); // not base 10\r
+                        } else\r
+                            dvalue = ((int) (sj)) - ((int) ('0'));\r
+                        exp = (exp * 10) + dvalue;\r
+                    }\r
+                }/* j */\r
+                if (eneg)\r
+                    exp = -exp; // was negative\r
+                hadexp = true; // remember we had one\r
+                break i; // we are done\r
+            }\r
+        }/* i */\r
+\r
+        /* Here when all inspected */\r
+        if (d == 0)\r
+            bad(inchars); // no mantissa digits\r
+        if (dotoff >= 0)\r
+            exp = (exp + dotoff) - d; // adjust exponent if had dot\r
+\r
+        /* strip leading zeros/dot (leave final if all 0's) */\r
+        {\r
+            int $3 = last - 1;\r
+            i = offset;\r
+            i: for (; i <= $3; i++) {\r
+                si = inchars[i];\r
+                if (si == '0') {\r
+                    offset++;\r
+                    dotoff--;\r
+                    d--;\r
+                } else if (si == '.') {\r
+                    offset++; // step past dot\r
+                    dotoff--;\r
+                } else if (si <= '9')\r
+                    break i;/* non-0 */\r
+                else {/* exotic */\r
+                    if ((Character.digit(si, 10)) != 0)\r
+                        break i; // non-0 or bad\r
+                    // is 0 .. strip like '0'\r
+                    offset++;\r
+                    dotoff--;\r
+                    d--;\r
+                }\r
+            }\r
+        }/* i */\r
+\r
+        /* Create the mantissa array */\r
+        mant = new byte[d]; // we know the length\r
+        j = offset; // input offset\r
+        if (exotic) {\r
+            do { // slow: check for exotica\r
+                {\r
+                    int $4 = d;\r
+                    i = 0;\r
+                    for (; $4 > 0; $4--, i++) {\r
+                        if (i == dotoff)\r
+                            j++; // at dot\r
+                        sj = inchars[j];\r
+                        if (sj <= '9')\r
+                            mant[i] = (byte) (((int) (sj)) - ((int) ('0')));/* easy */\r
+                        else {\r
+                            dvalue = Character.digit(sj, 10);\r
+                            if (dvalue < 0)\r
+                                bad(inchars); // not a number after all\r
+                            mant[i] = (byte) dvalue;\r
+                        }\r
+                        j++;\r
+                    }\r
+                }/* i */\r
+            } while (false);\r
+        }/* exotica */\r
+        else {\r
+            do {\r
+                {\r
+                    int $5 = d;\r
+                    i = 0;\r
+                    for (; $5 > 0; $5--, i++) {\r
+                        if (i == dotoff)\r
+                            j++;\r
+                        mant[i] = (byte) (((int) (inchars[j])) - ((int) ('0')));\r
+                        j++;\r
+                    }\r
+                }/* i */\r
+            } while (false);\r
+        }/* simple */\r
+\r
+        /* Looks good. Set the sign indicator and form, as needed. */\r
+        // Trailing zeros are preserved\r
+        // The rule here for form is:\r
+        // If no E-notation, then request plain notation\r
+        // Otherwise act as though add(0,DEFAULT) and request scientific notation\r
+        // [form is already PLAIN]\r
+        if (mant[0] == 0) {\r
+            ind = iszero; // force to show zero\r
+            // negative exponent is significant (e.g., -3 for 0.000) if plain\r
+            if (exp > 0)\r
+                exp = 0; // positive exponent can be ignored\r
+            if (hadexp) { // zero becomes single digit from add\r
+                mant = ZERO.mant;\r
+                exp = 0;\r
+            }\r
+        } else { // non-zero\r
+            // [ind was set earlier]\r
+            // now determine form\r
+            if (hadexp) {\r
+                form = (byte) com.ibm.icu.math.MathContext.SCIENTIFIC;\r
+                // 1999.06.29 check for overflow\r
+                mag = (exp + mant.length) - 1; // true exponent in scientific notation\r
+                if ((mag < MinExp) | (mag > MaxExp))\r
+                    bad(inchars);\r
+            }\r
+        }\r
+        // say 'BD(c[]): mant[0] mantlen exp ind form:' mant[0] mant.length exp ind form\r
+        return;\r
+    }\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object directly from a <code>double</code>.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> which is the exact decimal representation of the 64-bit signed binary\r
+     * floating point parameter.\r
+     * <p>\r
+     * Note that this constructor it an exact conversion; it does not give the same result as converting <code>num\r
+     * </code> to a <code>String</code> using the <code>Double.toString()</code> method and then using the\r
+     * {@link #BigDecimal(java.lang.String)} constructor. To get that result, use the static {@link #valueOf(double)}\r
+     * method to construct a <code>BigDecimal</code> from a <code>double</code>.\r
+     * \r
+     * @param num The <code>double</code> to be converted.\r
+     * @throws NumberFormatException If the parameter is infinite or not a number.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(double num) {\r
+        // 1999.03.06: use exactly the old algorithm\r
+        // 2000.01.01: note that this constructor does give an exact result,\r
+        // so perhaps it should not be deprecated\r
+        // 2000.06.18: no longer deprecated\r
+        this((new java.math.BigDecimal(num)).toString());\r
+        return;\r
+    }\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object directly from a <code>int</code>.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> which is the exact decimal representation of the 32-bit signed binary\r
+     * integer parameter. The <code>BigDecimal</code> will contain only decimal digits, prefixed with a leading minus\r
+     * sign (hyphen) if the parameter is negative. A leading zero will be present only if the parameter is zero.\r
+     * \r
+     * @param num The <code>int</code> to be converted.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(int num) {\r
+        super();\r
+        int mun;\r
+        int i = 0;\r
+        // We fastpath commoners\r
+        if (num <= 9)\r
+            if (num >= (-9)) {\r
+                do {\r
+                    // very common single digit case\r
+                    {/* select */\r
+                        if (num == 0) {\r
+                            mant = ZERO.mant;\r
+                            ind = iszero;\r
+                        } else if (num == 1) {\r
+                            mant = ONE.mant;\r
+                            ind = ispos;\r
+                        } else if (num == (-1)) {\r
+                            mant = ONE.mant;\r
+                            ind = isneg;\r
+                        } else {\r
+                            {\r
+                                mant = new byte[1];\r
+                                if (num > 0) {\r
+                                    mant[0] = (byte) num;\r
+                                    ind = ispos;\r
+                                } else { // num<-1\r
+                                    mant[0] = (byte) -num;\r
+                                    ind = isneg;\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                    return;\r
+                } while (false);\r
+            }/* singledigit */\r
+\r
+        /* We work on negative numbers so we handle the most negative number */\r
+        if (num > 0) {\r
+            ind = ispos;\r
+            num = -num;\r
+        } else\r
+            ind = isneg;/* negative */// [0 case already handled]\r
+        // [it is quicker, here, to pre-calculate the length with\r
+        // one loop, then allocate exactly the right length of byte array,\r
+        // then re-fill it with another loop]\r
+        mun = num; // working copy\r
+        {\r
+            i = 9;\r
+            i: for (;; i--) {\r
+                mun = mun / 10;\r
+                if (mun == 0)\r
+                    break i;\r
+            }\r
+        }/* i */\r
+        // i is the position of the leftmost digit placed\r
+        mant = new byte[10 - i];\r
+        {\r
+            i = (10 - i) - 1;\r
+            i: for (;; i--) {\r
+                mant[i] = (byte) -(((byte) (num % 10)));\r
+                num = num / 10;\r
+                if (num == 0)\r
+                    break i;\r
+            }\r
+        }/* i */\r
+        return;\r
+    }\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object directly from a <code>long</code>.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> which is the exact decimal representation of the 64-bit signed binary\r
+     * integer parameter. The <code>BigDecimal</code> will contain only decimal digits, prefixed with a leading minus\r
+     * sign (hyphen) if the parameter is negative. A leading zero will be present only if the parameter is zero.\r
+     * \r
+     * @param num The <code>long</code> to be converted.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(long num) {\r
+        super();\r
+        long mun;\r
+        int i = 0;\r
+        // Not really worth fastpathing commoners in this constructor [also,\r
+        // we use this to construct the static constants].\r
+        // This is much faster than: this(String.valueOf(num).toCharArray())\r
+        /* We work on negative num so we handle the most negative number */\r
+        if (num > 0) {\r
+            ind = ispos;\r
+            num = -num;\r
+        } else if (num == 0)\r
+            ind = iszero;\r
+        else\r
+            ind = isneg;/* negative */\r
+        mun = num;\r
+        {\r
+            i = 18;\r
+            i: for (;; i--) {\r
+                mun = mun / 10;\r
+                if (mun == 0)\r
+                    break i;\r
+            }\r
+        }/* i */\r
+        // i is the position of the leftmost digit placed\r
+        mant = new byte[19 - i];\r
+        {\r
+            i = (19 - i) - 1;\r
+            i: for (;; i--) {\r
+                mant[i] = (byte) -(((byte) (num % 10)));\r
+                num = num / 10;\r
+                if (num == 0)\r
+                    break i;\r
+            }\r
+        }/* i */\r
+        return;\r
+    }\r
+\r
+    /**\r
+     * Constructs a <code>BigDecimal</code> object from a <code>String</code>.\r
+     * <p>\r
+     * Constructs a <code>BigDecimal</code> from the parameter, which must not be <code>null</code> and must represent a\r
+     * valid <i>number</i>, as described formally in the documentation referred to {@link BigDecimal above}.\r
+     * <p>\r
+     * In summary, numbers in <code>String</code> form must have at least one digit, may have a leading sign, may have a\r
+     * decimal point, and exponential notation may be used. They follow conventional syntax, and may not contain blanks.\r
+     * <p>\r
+     * Some valid strings from which a <code>BigDecimal</code> might be constructed are:\r
+     * \r
+     * <pre>\r
+     * \r
+     * "0" -- Zero "12" -- A whole number "-76" -- A signed whole number "12.70" -- Some decimal places "+0.003" -- Plus\r
+     * sign is allowed "17." -- The same as 17 ".5" -- The same as 0.5 "4E+9" -- Exponential notation "0.73e-7" --\r
+     * Exponential notation\r
+     * \r
+     * </pre>\r
+     * <p>\r
+     * (Exponential notation means that the number includes an optional sign and a power of ten following an\r
+     * '</code>E</code>' that indicates how the decimal point will be shifted. Thus the <code>"4E+9"</code> above is\r
+     * just a short way of writing <code>4000000000</code>, and the <code>"0.73e-7"</code> is short for <code>\r
+     * 0.000000073</code>.)\r
+     * <p>\r
+     * The <code>BigDecimal</code> constructed from the String is in a standard form, with no blanks, as though the\r
+     * {@link #add(BigDecimal)} method had been used to add zero to the number with unlimited precision. If the string\r
+     * uses exponential notation (that is, includes an <code>e</code> or an <code>E</code>), then the <code>BigDecimal\r
+     * </code> number will be expressed in scientific notation (where the power of ten is adjusted so there is a single\r
+     * non-zero digit to the left of the decimal point); in this case if the number is zero then it will be expressed as\r
+     * the single digit 0, and if non-zero it will have an exponent unless that exponent would be 0. The exponent must\r
+     * fit in nine digits both before and after it is expressed in scientific notation.\r
+     * <p>\r
+     * Any digits in the parameter must be decimal; that is, <code>Character.digit(c, 10)</code> (where </code>c</code>\r
+     * is the character in question) would not return -1.\r
+     * \r
+     * @param string The <code>String</code> to be converted.\r
+     * @throws NumberFormatException If the parameter is not a valid number.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public BigDecimal(java.lang.String string) {\r
+        this(string.toCharArray(), 0, string.length());\r
+        return;\r
+    }\r
+\r
+    /* <sgml> Make a default BigDecimal object for local use. </sgml> */\r
+\r
+    private BigDecimal() {\r
+        super();\r
+        return;\r
+    }\r
+\r
+    /* ---------------------------------------------------------------- */\r
+    /* Operator methods [methods which take a context parameter] */\r
+    /* ---------------------------------------------------------------- */\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is the absolute value of this <code>BigDecimal</code>.\r
+     * <p>\r
+     * The same as {@link #abs(MathContext)}, where the context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will be <code>this.scale()</code>\r
+     * \r
+     * @return A <code>BigDecimal</code> whose value is the absolute value of this <code>BigDecimal</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal abs() {\r
+        return this.abs(plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is the absolute value of this <code>BigDecimal</code>.\r
+     * <p>\r
+     * If the current object is zero or positive, then the same result as invoking the {@link #plus(MathContext)} method\r
+     * with the same parameter is returned. Otherwise, the same result as invoking the {@link #negate(MathContext)}\r
+     * method with the same parameter is returned.\r
+     * \r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is the absolute value of this <code>BigDecimal</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal abs(com.ibm.icu.math.MathContext set) {\r
+        if (this.ind == isneg)\r
+            return this.negate(set);\r
+        return this.plus(set);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>this+rhs</code>, using fixed point arithmetic.\r
+     * <p>\r
+     * The same as {@link #add(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>, and the\r
+     * context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will be the maximum of the scales of the two operands.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the addition.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this+rhs</code>, using fixed point arithmetic.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal add(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.add(rhs, plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is <code>this+rhs</code>.\r
+     * <p>\r
+     * Implements the addition (<b><code>+</code></b>) operator (as defined in the decimal documentation, see\r
+     * {@link BigDecimal class header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the addition.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this+rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal add(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        com.ibm.icu.math.BigDecimal lhs;\r
+        int reqdig;\r
+        com.ibm.icu.math.BigDecimal res;\r
+        byte usel[];\r
+        int usellen;\r
+        byte user[];\r
+        int userlen;\r
+        int newlen = 0;\r
+        int tlen = 0;\r
+        int mult = 0;\r
+        byte t[] = null;\r
+        int ia = 0;\r
+        int ib = 0;\r
+        int ea = 0;\r
+        int eb = 0;\r
+        byte ca = 0;\r
+        byte cb = 0;\r
+        /* determine requested digits and form */\r
+        if (set.lostDigits)\r
+            checkdigits(rhs, set.digits);\r
+        lhs = this; // name for clarity and proxy\r
+\r
+        /* Quick exit for add floating 0 */\r
+        // plus() will optimize to return same object if possible\r
+        if (lhs.ind == 0)\r
+            if (set.form != com.ibm.icu.math.MathContext.PLAIN)\r
+                return rhs.plus(set);\r
+        if (rhs.ind == 0)\r
+            if (set.form != com.ibm.icu.math.MathContext.PLAIN)\r
+                return lhs.plus(set);\r
+\r
+        /* Prepare numbers (round, unless unlimited precision) */\r
+        reqdig = set.digits; // local copy (heavily used)\r
+        if (reqdig > 0) {\r
+            if (lhs.mant.length > reqdig)\r
+                lhs = clone(lhs).round(set);\r
+            if (rhs.mant.length > reqdig)\r
+                rhs = clone(rhs).round(set);\r
+            // [we could reuse the new LHS for result in this case]\r
+        }\r
+\r
+        res = new com.ibm.icu.math.BigDecimal(); // build result here\r
+\r
+        /*\r
+         * Now see how much we have to pad or truncate lhs or rhs in order to align the numbers. If one number is much\r
+         * larger than the other, then the smaller cannot affect the answer [but we may still need to pad with up to\r
+         * DIGITS trailing zeros].\r
+         */\r
+        // Note sign may be 0 if digits (reqdig) is 0\r
+        // usel and user will be the byte arrays passed to the adder; we'll\r
+        // use them on all paths except quick exits\r
+        usel = lhs.mant;\r
+        usellen = lhs.mant.length;\r
+        user = rhs.mant;\r
+        userlen = rhs.mant.length;\r
+        {\r
+            do {/* select */\r
+                if (lhs.exp == rhs.exp) {/* no padding needed */\r
+                    // This is the most common, and fastest, path\r
+                    res.exp = lhs.exp;\r
+                } else if (lhs.exp > rhs.exp) { // need to pad lhs and/or truncate rhs\r
+                    newlen = (usellen + lhs.exp) - rhs.exp;\r
+                    /*\r
+                     * If, after pad, lhs would be longer than rhs by digits+1 or more (and digits>0) then rhs cannot\r
+                     * affect answer, so we only need to pad up to a length of DIGITS+1.\r
+                     */\r
+                    if (newlen >= ((userlen + reqdig) + 1))\r
+                        if (reqdig > 0) {\r
+                            // LHS is sufficient\r
+                            res.mant = usel;\r
+                            res.exp = lhs.exp;\r
+                            res.ind = lhs.ind;\r
+                            if (usellen < reqdig) { // need 0 padding\r
+                                res.mant = extend(lhs.mant, reqdig);\r
+                                res.exp = res.exp - ((reqdig - usellen));\r
+                            }\r
+                            return res.finish(set, false);\r
+                        }\r
+                    // RHS may affect result\r
+                    res.exp = rhs.exp; // expected final exponent\r
+                    if (newlen > (reqdig + 1))\r
+                        if (reqdig > 0) {\r
+                            // LHS will be max; RHS truncated\r
+                            tlen = (newlen - reqdig) - 1; // truncation length\r
+                            userlen = userlen - tlen;\r
+                            res.exp = res.exp + tlen;\r
+                            newlen = reqdig + 1;\r
+                        }\r
+                    if (newlen > usellen)\r
+                        usellen = newlen; // need to pad LHS\r
+                } else { // need to pad rhs and/or truncate lhs\r
+                    newlen = (userlen + rhs.exp) - lhs.exp;\r
+                    if (newlen >= ((usellen + reqdig) + 1))\r
+                        if (reqdig > 0) {\r
+                            // RHS is sufficient\r
+                            res.mant = user;\r
+                            res.exp = rhs.exp;\r
+                            res.ind = rhs.ind;\r
+                            if (userlen < reqdig) { // need 0 padding\r
+                                res.mant = extend(rhs.mant, reqdig);\r
+                                res.exp = res.exp - ((reqdig - userlen));\r
+                            }\r
+                            return res.finish(set, false);\r
+                        }\r
+                    // LHS may affect result\r
+                    res.exp = lhs.exp; // expected final exponent\r
+                    if (newlen > (reqdig + 1))\r
+                        if (reqdig > 0) {\r
+                            // RHS will be max; LHS truncated\r
+                            tlen = (newlen - reqdig) - 1; // truncation length\r
+                            usellen = usellen - tlen;\r
+                            res.exp = res.exp + tlen;\r
+                            newlen = reqdig + 1;\r
+                        }\r
+                    if (newlen > userlen)\r
+                        userlen = newlen; // need to pad RHS\r
+                }\r
+            } while (false);\r
+        }/* padder */\r
+\r
+        /* OK, we have aligned mantissas. Now add or subtract. */\r
+        // 1998.06.27 Sign may now be 0 [e.g., 0.000] .. treat as positive\r
+        // 1999.05.27 Allow for 00 on lhs [is not larger than 2 on rhs]\r
+        // 1999.07.10 Allow for 00 on rhs [is not larger than 2 on rhs]\r
+        if (lhs.ind == iszero)\r
+            res.ind = ispos;\r
+        else\r
+            res.ind = lhs.ind; // likely sign, all paths\r
+        if (((lhs.ind == isneg) ? 1 : 0) == ((rhs.ind == isneg) ? 1 : 0)) // same sign, 0 non-negative\r
+            mult = 1;\r
+        else {\r
+            do { // different signs, so subtraction is needed\r
+                mult = -1; // will cause subtract\r
+                /*\r
+                 * Before we can subtract we must determine which is the larger, as our add/subtract routine only\r
+                 * handles non-negative results so we may need to swap the operands.\r
+                 */\r
+                {\r
+                    do {/* select */\r
+                        if (rhs.ind == iszero) {\r
+                            // original A bigger\r
+                        } else if ((usellen < userlen) | (lhs.ind == iszero)) { // original B bigger\r
+                            t = usel;\r
+                            usel = user;\r
+                            user = t; // swap\r
+                            tlen = usellen;\r
+                            usellen = userlen;\r
+                            userlen = tlen; // ..\r
+                            res.ind = (byte) -res.ind; // and set sign\r
+                        } else if (usellen > userlen) {\r
+                            // original A bigger\r
+                        } else {\r
+                            {/* logical lengths the same */// need compare\r
+                                /* may still need to swap: compare the strings */\r
+                                ia = 0;\r
+                                ib = 0;\r
+                                ea = usel.length - 1;\r
+                                eb = user.length - 1;\r
+                                {\r
+                                    compare: for (;;) {\r
+                                        if (ia <= ea)\r
+                                            ca = usel[ia];\r
+                                        else {\r
+                                            if (ib > eb) {/* identical */\r
+                                                if (set.form != com.ibm.icu.math.MathContext.PLAIN)\r
+                                                    return ZERO;\r
+                                                // [if PLAIN we must do the subtract, in case of 0.000 results]\r
+                                                break compare;\r
+                                            }\r
+                                            ca = (byte) 0;\r
+                                        }\r
+                                        if (ib <= eb)\r
+                                            cb = user[ib];\r
+                                        else\r
+                                            cb = (byte) 0;\r
+                                        if (ca != cb) {\r
+                                            if (ca < cb) {/* swap needed */\r
+                                                t = usel;\r
+                                                usel = user;\r
+                                                user = t; // swap\r
+                                                tlen = usellen;\r
+                                                usellen = userlen;\r
+                                                userlen = tlen; // ..\r
+                                                res.ind = (byte) -res.ind;\r
+                                            }\r
+                                            break compare;\r
+                                        }\r
+                                        /* mantissas the same, so far */\r
+                                        ia++;\r
+                                        ib++;\r
+                                    }\r
+                                }/* compare */\r
+                            } // lengths the same\r
+                        }\r
+                    } while (false);\r
+                }/* swaptest */\r
+            } while (false);\r
+        }/* signdiff */\r
+\r
+        /* here, A is > B if subtracting */\r
+        // add [A+B*1] or subtract [A+(B*-1)]\r
+        res.mant = byteaddsub(usel, usellen, user, userlen, mult, false);\r
+        // [reuse possible only after chop; accounting makes not worthwhile]\r
+\r
+        // Finish() rounds before stripping leading 0's, then sets form, etc.\r
+        return res.finish(set, false);\r
+    }\r
+\r
+    /**\r
+     * Compares this <code>BigDecimal</code> to another, using unlimited precision.\r
+     * <p>\r
+     * The same as {@link #compareTo(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>,\r
+     * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the comparison.\r
+     * @return An <code>int</code> whose value is -1, 0, or 1 as <code>this</code> is numerically less than, equal to,\r
+     *         or greater than <code>rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public int compareTo(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.compareTo(rhs, plainMC);\r
+    }\r
+\r
+    /**\r
+     * Compares this <code>BigDecimal</code> to another.\r
+     * <p>\r
+     * Implements numeric comparison, (as defined in the decimal documentation, see {@link BigDecimal class header}),\r
+     * and returns a result of type <code>int</code>.\r
+     * <p>\r
+     * The result will be:\r
+     * <table cellpadding=2>\r
+     * <tr>\r
+     * <td align=right><b>-1</b></td> <td>if the current object is less than the first parameter</td>\r
+     * </tr>\r
+     * <tr>\r
+     * <td align=right><b>0</b></td> <td>if the current object is equal to the first parameter</td>\r
+     * </tr>\r
+     * <tr>\r
+     * <td align=right><b>1</b></td> <td>if the current object is greater than the first parameter.</td>\r
+     * </tr>\r
+     * </table>\r
+     * <p>\r
+     * A {@link #compareTo(BigDecimal)} method is also provided.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the comparison.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return An <code>int</code> whose value is -1, 0, or 1 as <code>this</code> is numerically less than, equal to,\r
+     *         or greater than <code>rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public int compareTo(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        int thislength = 0;\r
+        int i = 0;\r
+        com.ibm.icu.math.BigDecimal newrhs;\r
+        // rhs=null will raise NullPointerException, as per Comparable interface\r
+        if (set.lostDigits)\r
+            checkdigits(rhs, set.digits);\r
+        // [add will recheck in slowpath cases .. but would report -rhs]\r
+        if ((this.ind == rhs.ind) & (this.exp == rhs.exp)) {\r
+            /* sign & exponent the same [very common] */\r
+            thislength = this.mant.length;\r
+            if (thislength < rhs.mant.length)\r
+                return (byte) -this.ind;\r
+            if (thislength > rhs.mant.length)\r
+                return this.ind;\r
+            /*\r
+             * lengths are the same; we can do a straight mantissa compare unless maybe rounding [rounding is very\r
+             * unusual]\r
+             */\r
+            if ((thislength <= set.digits) | (set.digits == 0)) {\r
+                {\r
+                    int $6 = thislength;\r
+                    i = 0;\r
+                    for (; $6 > 0; $6--, i++) {\r
+                        if (this.mant[i] < rhs.mant[i])\r
+                            return (byte) -this.ind;\r
+                        if (this.mant[i] > rhs.mant[i])\r
+                            return this.ind;\r
+                    }\r
+                }/* i */\r
+                return 0; // identical\r
+            }\r
+            /* drop through for full comparison */\r
+        } else {\r
+            /* More fastpaths possible */\r
+            if (this.ind < rhs.ind)\r
+                return -1;\r
+            if (this.ind > rhs.ind)\r
+                return 1;\r
+        }\r
+        /* carry out a subtract to make the comparison */\r
+        newrhs = clone(rhs); // safe copy\r
+        newrhs.ind = (byte) -newrhs.ind; // prepare to subtract\r
+        return this.add(newrhs, set).ind; // add, and return sign of result\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>this/rhs</code>, using fixed point arithmetic.\r
+     * <p>\r
+     * The same as {@link #divide(BigDecimal, int)}, where the <code>BigDecimal</code> is <code>rhs</code>, and the\r
+     * rounding mode is {@link MathContext#ROUND_HALF_UP}.\r
+     * \r
+     * The length of the decimal part (the scale) of the result will be the same as the scale of the current object, if\r
+     * the latter were formatted without exponential notation.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the division.\r
+     * @return A plain <code>BigDecimal</code> whose value is <code>this/rhs</code>, using fixed point arithmetic.\r
+     * @throws ArithmeticException If <code>rhs</code> is zero.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.dodivide('D', rhs, plainMC, -1);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>this/rhs</code>, using fixed point arithmetic and a\r
+     * rounding mode.\r
+     * <p>\r
+     * The same as {@link #divide(BigDecimal, int, int)}, where the <code>BigDecimal</code> is <code>rhs</code>, and the\r
+     * second parameter is <code>this.scale()</code>, and the third is <code>round</code>.\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will therefore be the same as the scale of the current\r
+     * object, if the latter were formatted without exponential notation.\r
+     * <p>\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the division.\r
+     * @param round The <code>int</code> rounding mode to be used for the division (see the {@link MathContext} class).\r
+     * @return A plain <code>BigDecimal</code> whose value is <code>this/rhs</code>, using fixed point arithmetic and\r
+     *         the specified rounding mode.\r
+     * @throws IllegalArgumentException if <code>round</code> is not a valid rounding mode.\r
+     * @throws ArithmeticException if <code>rhs</code> is zero.\r
+     * @throws ArithmeticException if <code>round</code> is {@link MathContext#ROUND_UNNECESSARY} and <code>this.scale()</code> is insufficient to represent the result exactly.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs, int round) {\r
+        com.ibm.icu.math.MathContext set;\r
+        set = new com.ibm.icu.math.MathContext(0, com.ibm.icu.math.MathContext.PLAIN, false, round); // [checks round,\r
+                                                                                                     // too]\r
+        return this.dodivide('D', rhs, set, -1); // take scale from LHS\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>this/rhs</code>, using fixed point arithmetic and a\r
+     * given scale and rounding mode.\r
+     * <p>\r
+     * The same as {@link #divide(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>,\r
+     * <code>new MathContext(0, MathContext.PLAIN, false, round)</code>, except that the length of the decimal part (the\r
+     * scale) to be used for the result is explicit rather than being taken from <code>this</code>.\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will be the same as the scale of the current object, if\r
+     * the latter were formatted without exponential notation.\r
+     * <p>\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the division.\r
+     * @param scale The <code>int</code> scale to be used for the result.\r
+     * @param round The <code>int</code> rounding mode to be used for the division (see the {@link MathContext} class).\r
+     * @return A plain <code>BigDecimal</code> whose value is <code>this/rhs</code>, using fixed point arithmetic and\r
+     *         the specified rounding mode.\r
+     * @throws IllegalArgumentException if <code>round</code> is not a valid rounding mode.\r
+     * @throws ArithmeticException if <code>rhs</code> is zero.\r
+     * @throws ArithmeticException if <code>scale</code> is negative.\r
+     * @throws ArithmeticException if <code>round</code> is {@link MathContext#ROUND_UNNECESSARY} and <code>scale</code> is insufficient\r
+     *             to represent the result exactly.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs, int scale, int round) {\r
+        com.ibm.icu.math.MathContext set;\r
+        if (scale < 0)\r
+            throw new java.lang.ArithmeticException("Negative scale:" + " " + scale);\r
+        set = new com.ibm.icu.math.MathContext(0, com.ibm.icu.math.MathContext.PLAIN, false, round); // [checks round]\r
+        return this.dodivide('D', rhs, set, scale);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is <code>this/rhs</code>.\r
+     * <p>\r
+     * Implements the division (<b><code>/</code></b>) operator (as defined in the decimal documentation, see\r
+     * {@link BigDecimal class header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the division.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this/rhs</code>.\r
+     * @throws ArithmeticException if <code>rhs</code> is zero.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        return this.dodivide('D', rhs, set, -1);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is the integer part of <code>this/rhs</code>.\r
+     * <p>\r
+     * The same as {@link #divideInteger(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs\r
+     * </code>, and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the integer division.\r
+     * @return A <code>BigDecimal</code> whose value is the integer part of <code>this/rhs</code>.\r
+     * @throws ArithmeticException if <code>rhs</code> is zero.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal divideInteger(com.ibm.icu.math.BigDecimal rhs) {\r
+        // scale 0 to drop .000 when plain\r
+        return this.dodivide('I', rhs, plainMC, 0);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is the integer part of <code>this/rhs</code>.\r
+     * <p>\r
+     * Implements the integer division operator (as defined in the decimal documentation, see {@link BigDecimal class\r
+     * header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the integer division.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is the integer part of <code>this/rhs</code>.\r
+     * @throws ArithmeticException if <code>rhs</code> is zero.\r
+     * @throws ArithmeticException if the result will not fit in the number of digits specified for the context.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal divideInteger(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        // scale 0 to drop .000 when plain\r
+        return this.dodivide('I', rhs, set, 0);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is the maximum of <code>this</code> and <code>rhs</code>.\r
+     * <p>\r
+     * The same as {@link #max(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>, and the\r
+     * context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the comparison.\r
+     * @return A <code>BigDecimal</code> whose value is the maximum of <code>this</code> and <code>rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal max(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.max(rhs, plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is the maximum of <code>this</code> and <code>rhs</code>.\r
+     * <p>\r
+     * Returns the larger of the current object and the first parameter.\r
+     * <p>\r
+     * If calling the {@link #compareTo(BigDecimal, MathContext)} method with the same parameters would return <code>1\r
+     * </code> or <code>0</code>, then the result of calling the {@link #plus(MathContext)} method on the current object\r
+     * (using the same <code>MathContext</code> parameter) is returned. Otherwise, the result of calling the\r
+     * {@link #plus(MathContext)} method on the first parameter object (using the same <code>MathContext</code>\r
+     * parameter) is returned.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the comparison.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is the maximum of <code>this</code> and <code>rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal max(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        if ((this.compareTo(rhs, set)) >= 0)\r
+            return this.plus(set);\r
+        else\r
+            return rhs.plus(set);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is the minimum of <code>this</code> and <code>rhs</code>.\r
+     * <p>\r
+     * The same as {@link #min(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>, and the\r
+     * context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the comparison.\r
+     * @return A <code>BigDecimal</code> whose value is the minimum of <code>this</code> and <code>rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal min(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.min(rhs, plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is the minimum of <code>this</code> and <code>rhs</code>.\r
+     * <p>\r
+     * Returns the smaller of the current object and the first parameter.\r
+     * <p>\r
+     * If calling the {@link #compareTo(BigDecimal, MathContext)} method with the same parameters would return <code>-1\r
+     * </code> or <code>0</code>, then the result of calling the {@link #plus(MathContext)} method on the current object\r
+     * (using the same <code>MathContext</code> parameter) is returned. Otherwise, the result of calling the\r
+     * {@link #plus(MathContext)} method on the first parameter object (using the same <code>MathContext</code>\r
+     * parameter) is returned.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the comparison.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is the minimum of <code>this</code> and <code>rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal min(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        if ((this.compareTo(rhs, set)) <= 0)\r
+            return this.plus(set);\r
+        else\r
+            return rhs.plus(set);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>this*rhs</code>, using fixed point arithmetic.\r
+     * <p>\r
+     * The same as {@link #add(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>, and the\r
+     * context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will be the sum of the scales of the operands, if they\r
+     * were formatted without exponential notation.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the multiplication.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this*rhs</code>, using fixed point arithmetic.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal multiply(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.multiply(rhs, plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is <code>this*rhs</code>.\r
+     * <p>\r
+     * Implements the multiplication (<b><code> </code></b>) operator (as defined in the decimal documentation, see\r
+     * {@link BigDecimal class header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the multiplication.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this*rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal multiply(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        com.ibm.icu.math.BigDecimal lhs;\r
+        int padding;\r
+        int reqdig;\r
+        byte multer[] = null;\r
+        byte multand[] = null;\r
+        int multandlen;\r
+        int acclen = 0;\r
+        com.ibm.icu.math.BigDecimal res;\r
+        byte acc[];\r
+        int n = 0;\r
+        byte mult = 0;\r
+        if (set.lostDigits)\r
+            checkdigits(rhs, set.digits);\r
+        lhs = this; // name for clarity and proxy\r
+\r
+        /* Prepare numbers (truncate, unless unlimited precision) */\r
+        padding = 0; // trailing 0's to add\r
+        reqdig = set.digits; // local copy\r
+        if (reqdig > 0) {\r
+            if (lhs.mant.length > reqdig)\r
+                lhs = clone(lhs).round(set);\r
+            if (rhs.mant.length > reqdig)\r
+                rhs = clone(rhs).round(set);\r
+            // [we could reuse the new LHS for result in this case]\r
+        } else {/* unlimited */\r
+            // fixed point arithmetic will want every trailing 0; we add these\r
+            // after the calculation rather than before, for speed.\r
+            if (lhs.exp > 0)\r
+                padding = padding + lhs.exp;\r
+            if (rhs.exp > 0)\r
+                padding = padding + rhs.exp;\r
+        }\r
+\r
+        // For best speed, as in DMSRCN, we use the shorter number as the\r
+        // multiplier and the longer as the multiplicand.\r
+        // 1999.12.22: We used to special case when the result would fit in\r
+        // a long, but with Java 1.3 this gave no advantage.\r
+        if (lhs.mant.length < rhs.mant.length) {\r
+            multer = lhs.mant;\r
+            multand = rhs.mant;\r
+        } else {\r
+            multer = rhs.mant;\r
+            multand = lhs.mant;\r
+        }\r
+\r
+        /* Calculate how long result byte array will be */\r
+        multandlen = (multer.length + multand.length) - 1; // effective length\r
+        // optimize for 75% of the cases where a carry is expected...\r
+        if ((multer[0] * multand[0]) > 9)\r
+            acclen = multandlen + 1;\r
+        else\r
+            acclen = multandlen;\r
+\r
+        /* Now the main long multiplication loop */\r
+        res = new com.ibm.icu.math.BigDecimal(); // where we'll build result\r
+        acc = new byte[acclen]; // accumulator, all zeros\r
+        // 1998.07.01: calculate from left to right so that accumulator goes\r
+        // to likely final length on first addition; this avoids a one-digit\r
+        // extension (and object allocation) each time around the loop.\r
+        // Initial number therefore has virtual zeros added to right.\r
+        {\r
+            int $7 = multer.length;\r
+            n = 0;\r
+            for (; $7 > 0; $7--, n++) {\r
+                mult = multer[n];\r
+                if (mult != 0) { // [optimization]\r
+                    // accumulate [accumulator is reusable array]\r
+                    acc = byteaddsub(acc, acc.length, multand, multandlen, mult, true);\r
+                }\r
+                // divide multiplicand by 10 for next digit to right\r
+                multandlen--; // 'virtual length'\r
+            }\r
+        }/* n */\r
+\r
+        res.ind = (byte) (lhs.ind * rhs.ind); // final sign\r
+        res.exp = (lhs.exp + rhs.exp) - padding; // final exponent\r
+        // [overflow is checked by finish]\r
+\r
+        /* add trailing zeros to the result, if necessary */\r
+        if (padding == 0)\r
+            res.mant = acc;\r
+        else\r
+            res.mant = extend(acc, acc.length + padding); // add trailing 0s\r
+        return res.finish(set, false);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>-this</code>.\r
+     * <p>\r
+     * The same as {@link #negate(MathContext)}, where the context is <code>new MathContext(0, MathContext.PLAIN)</code>\r
+     * .\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will be be <code>this.scale()</code>\r
+     * \r
+     * \r
+     * @return A <code>BigDecimal</code> whose value is <code>-this</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal negate() {\r
+        return this.negate(plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is <code>-this</code>.\r
+     * <p>\r
+     * Implements the negation (Prefix <b><code>-</code></b>) operator (as defined in the decimal documentation, see\r
+     * {@link BigDecimal class header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * \r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is <code>-this</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal negate(com.ibm.icu.math.MathContext set) {\r
+        com.ibm.icu.math.BigDecimal res;\r
+        // Originally called minus(), changed to matched Java precedents\r
+        // This simply clones, flips the sign, and possibly rounds\r
+        if (set.lostDigits)\r
+            checkdigits((com.ibm.icu.math.BigDecimal) null, set.digits);\r
+        res = clone(this); // safe copy\r
+        res.ind = (byte) -res.ind;\r
+        return res.finish(set, false);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>+this</code>. Note that <code>this</code> is not\r
+     * necessarily a plain <code>BigDecimal</code>, but the result will always be.\r
+     * <p>\r
+     * The same as {@link #plus(MathContext)}, where the context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will be be <code>this.scale()</code>\r
+     * \r
+     * @return A <code>BigDecimal</code> whose value is <code>+this</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal plus() {\r
+        return this.plus(plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is <code>+this</code>.\r
+     * <p>\r
+     * Implements the plus (Prefix <b><code>+</code></b>) operator (as defined in the decimal documentation, see\r
+     * {@link BigDecimal class header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * <p>\r
+     * This method is useful for rounding or otherwise applying a context to a decimal value.\r
+     * \r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is <code>+this</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal plus(com.ibm.icu.math.MathContext set) {\r
+        // This clones and forces the result to the new settings\r
+        // May return same object\r
+        if (set.lostDigits)\r
+            checkdigits((com.ibm.icu.math.BigDecimal) null, set.digits);\r
+        // Optimization: returns same object for some common cases\r
+        if (set.form == com.ibm.icu.math.MathContext.PLAIN)\r
+            if (this.form == com.ibm.icu.math.MathContext.PLAIN) {\r
+                if (this.mant.length <= set.digits)\r
+                    return this;\r
+                if (set.digits == 0)\r
+                    return this;\r
+            }\r
+        return clone(this).finish(set, false);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>this**rhs</code>, using fixed point arithmetic.\r
+     * <p>\r
+     * The same as {@link #pow(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>, and the\r
+     * context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * <p>\r
+     * The parameter is the power to which the <code>this</code> will be raised; it must be in the range 0 through\r
+     * 999999999, and must have a decimal part of zero. Note that these restrictions may be removed in the future, so\r
+     * they should not be used as a test for a whole number.\r
+     * <p>\r
+     * In addition, the power must not be negative, as no <code>MathContext</code> is used and so the result would then\r
+     * always be 0.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the operation (the power).\r
+     * @return A <code>BigDecimal</code> whose value is <code>this**rhs</code>, using fixed point arithmetic.\r
+     * @throws ArithmeticException if <code>rhs</code> is out of range or is not a whole number.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal pow(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.pow(rhs, plainMC);\r
+    }\r
+\r
+    // The name for this method is inherited from the precedent set by the\r
+    // BigInteger and Math classes.\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is <code>this**rhs</code>.\r
+     * <p>\r
+     * Implements the power (<b><code> </code></b>) operator (as defined in the decimal documentation, see\r
+     * {@link BigDecimal class header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * <p>\r
+     * The first parameter is the power to which the <code>this</code> will be raised; it must be in the range\r
+     * -999999999 through 999999999, and must have a decimal part of zero. Note that these restrictions may be removed\r
+     * in the future, so they should not be used as a test for a whole number.\r
+     * <p>\r
+     * If the <code>digits</code> setting of the <code>MathContext</code> parameter is 0, the power must be zero or\r
+     * positive.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the operation (the power).\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this**rhs</code>.\r
+     * @throws ArithmeticException if <code>rhs</code> is out of range or is not a whole number.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal pow(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        int n;\r
+        com.ibm.icu.math.BigDecimal lhs;\r
+        int reqdig;\r
+        int workdigits = 0;\r
+        int L = 0;\r
+        com.ibm.icu.math.MathContext workset;\r
+        com.ibm.icu.math.BigDecimal res;\r
+        boolean seenbit;\r
+        int i = 0;\r
+        if (set.lostDigits)\r
+            checkdigits(rhs, set.digits);\r
+        n = rhs.intcheck(MinArg, MaxArg); // check RHS by the rules\r
+        lhs = this; // clarified name\r
+\r
+        reqdig = set.digits; // local copy (heavily used)\r
+        if (reqdig == 0) {\r
+            if (rhs.ind == isneg)\r
+                throw new java.lang.ArithmeticException("Negative power:" + " " + rhs.toString());\r
+            workdigits = 0;\r
+        } else {/* non-0 digits */\r
+            if ((rhs.mant.length + rhs.exp) > reqdig)\r
+                throw new java.lang.ArithmeticException("Too many digits:" + " " + rhs.toString());\r
+\r
+            /* Round the lhs to DIGITS if need be */\r
+            if (lhs.mant.length > reqdig)\r
+                lhs = clone(lhs).round(set);\r
+\r
+            /* L for precision calculation [see ANSI X3.274-1996] */\r
+            L = rhs.mant.length + rhs.exp; // length without decimal zeros/exp\r
+            workdigits = (reqdig + L) + 1; // calculate the working DIGITS\r
+        }\r
+\r
+        /* Create a copy of set for working settings */\r
+        // Note: no need to check for lostDigits again.\r
+        // 1999.07.17 Note: this construction must follow RHS check\r
+        workset = new com.ibm.icu.math.MathContext(workdigits, set.form, false, set.roundingMode);\r
+\r
+        res = ONE; // accumulator\r
+        if (n == 0)\r
+            return res; // x**0 == 1\r
+        if (n < 0)\r
+            n = -n; // [rhs.ind records the sign]\r
+        seenbit = false; // set once we've seen a 1-bit\r
+        {\r
+            i = 1;\r
+            i: for (;; i++) { // for each bit [top bit ignored]\r
+                n = n + n; // shift left 1 bit\r
+                if (n < 0) { // top bit is set\r
+                    seenbit = true; // OK, we're off\r
+                    res = res.multiply(lhs, workset); // acc=acc*x\r
+                }\r
+                if (i == 31)\r
+                    break i; // that was the last bit\r
+                if ((!seenbit))\r
+                    continue i; // we don't have to square 1\r
+                res = res.multiply(res, workset); // acc=acc*acc [square]\r
+            }\r
+        }/* i */// 32 bits\r
+        if (rhs.ind < 0) // was a **-n [hence digits>0]\r
+            res = ONE.divide(res, workset); // .. so acc=1/acc\r
+        return res.finish(set, true); // round and strip [original digits]\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is the remainder of <code>this/rhs</code>, using fixed point\r
+     * arithmetic.\r
+     * <p>\r
+     * The same as {@link #remainder(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>,\r
+     * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * <p>\r
+     * This is not the modulo operator -- the result may be negative.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the remainder operation.\r
+     * @return A <code>BigDecimal</code> whose value is the remainder of <code>this/rhs</code>, using fixed point\r
+     *         arithmetic.\r
+     * @throws ArithmeticException if <code>rhs</code> is zero.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal remainder(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.dodivide('R', rhs, plainMC, -1);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is the remainder of <code>this/rhs</code>.\r
+     * <p>\r
+     * Implements the remainder operator (as defined in the decimal documentation, see {@link BigDecimal class header}),\r
+     * and returns the result as a <code>BigDecimal</code> object.\r
+     * <p>\r
+     * This is not the modulo operator -- the result may be negative.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the remainder operation.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is the remainder of <code>this+rhs</code>.\r
+     * @throws ArithmeticException if <code>rhs</code> is zero.\r
+     * @throws ArithmeticException  if the integer part of the result will not fit in the number of digits specified for the context.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal remainder(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        return this.dodivide('R', rhs, set, -1);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose value is <code>this-rhs</code>, using fixed point arithmetic.\r
+     * <p>\r
+     * The same as {@link #subtract(BigDecimal, MathContext)}, where the <code>BigDecimal</code> is <code>rhs</code>,\r
+     * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.\r
+     * <p>\r
+     * The length of the decimal part (the scale) of the result will be the maximum of the scales of the two operands.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the subtraction.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this-rhs</code>, using fixed point arithmetic.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal subtract(com.ibm.icu.math.BigDecimal rhs) {\r
+        return this.subtract(rhs, plainMC);\r
+    }\r
+\r
+    /**\r
+     * Returns a <code>BigDecimal</code> whose value is <code>this-rhs</code>.\r
+     * <p>\r
+     * Implements the subtraction (<b><code>-</code></b>) operator (as defined in the decimal documentation, see\r
+     * {@link BigDecimal class header}), and returns the result as a <code>BigDecimal</code> object.\r
+     * \r
+     * @param rhs The <code>BigDecimal</code> for the right hand side of the subtraction.\r
+     * @param set The <code>MathContext</code> arithmetic settings.\r
+     * @return A <code>BigDecimal</code> whose value is <code>this-rhs</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal subtract(com.ibm.icu.math.BigDecimal rhs, com.ibm.icu.math.MathContext set) {\r
+        com.ibm.icu.math.BigDecimal newrhs;\r
+        if (set.lostDigits)\r
+            checkdigits(rhs, set.digits);\r
+        // [add will recheck .. but would report -rhs]\r
+        /* carry out the subtraction */\r
+        // we could fastpath -0, but it is too rare.\r
+        newrhs = clone(rhs); // safe copy\r
+        newrhs.ind = (byte) -newrhs.ind; // prepare to subtract\r
+        return this.add(newrhs, set); // arithmetic\r
+    }\r
+\r
+    /* ---------------------------------------------------------------- */\r
+    /* Other methods */\r
+    /* ---------------------------------------------------------------- */\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>byte</code>. If the <code>BigDecimal</code> has a non-zero\r
+     * decimal part or is out of the possible range for a <code>byte</code> (8-bit signed integer) result then an <code>\r
+     * ArithmeticException</code> is thrown.\r
+     * \r
+     * @return A <code>byte</code> equal in value to <code>this</code>.\r
+     * @throws ArithmeticException if <code>this</code> has a non-zero decimal part, or will not fit in a <code>byte</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public byte byteValueExact() {\r
+        int num;\r
+        num = this.intValueExact(); // will check decimal part too\r
+        if ((num > 127) | (num < (-128)))\r
+            throw new java.lang.ArithmeticException("Conversion overflow:" + " " + this.toString());\r
+        return (byte) num;\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>double</code>. If the <code>BigDecimal</code> is out of the\r
+     * possible range for a <code>double</code> (64-bit signed floating point) result then an <code>ArithmeticException\r
+     * </code> is thrown.\r
+     * <p>\r
+     * The double produced is identical to result of expressing the <code>BigDecimal</code> as a <code>String</code> and\r
+     * then converting it using the <code>Double(String)</code> constructor; this can result in values of <code>\r
+     * Double.NEGATIVE_INFINITY</code> or <code>Double.POSITIVE_INFINITY</code>.\r
+     * \r
+     * @return A <code>double</code> corresponding to <code>this</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public double doubleValue() {\r
+        // We go via a String [as does BigDecimal in JDK 1.2]\r
+        // Next line could possibly raise NumberFormatException\r
+        return java.lang.Double.valueOf(this.toString()).doubleValue();\r
+    }\r
+\r
+    /**\r
+     * Compares this <code>BigDecimal</code> with <code>rhs</code> for equality.\r
+     * <p>\r
+     * If the parameter is <code>null</code>, or is not an instance of the BigDecimal type, or is not exactly equal to\r
+     * the current <code>BigDecimal</code> object, then <i>false</i> is returned. Otherwise, <i>true</i> is returned.\r
+     * <p>\r
+     * "Exactly equal", here, means that the <code>String</code> representations of the <code>BigDecimal</code> numbers\r
+     * are identical (they have the same characters in the same sequence).\r
+     * <p>\r
+     * The {@link #compareTo(BigDecimal, MathContext)} method should be used for more general comparisons.\r
+     * \r
+     * @param obj The <code>Object</code> for the right hand side of the comparison.\r
+     * @return A <code>boolean</code> whose value <i>true</i> if and only if the operands have identical string\r
+     *         representations.\r
+     * @throws ClassCastException if <code>rhs</code> cannot be cast to a <code>BigDecimal</code> object.\r
+     * @stable ICU 2.0\r
+     * @see #compareTo(BigDecimal)\r
+     * @see #compareTo(BigDecimal, MathContext)\r
+     */\r
+\r
+    public boolean equals(java.lang.Object obj) {\r
+        com.ibm.icu.math.BigDecimal rhs;\r
+        int i = 0;\r
+        char lca[] = null;\r
+        char rca[] = null;\r
+        // We are equal iff toString of both are exactly the same\r
+        if (obj == null)\r
+            return false; // not equal\r
+        if ((!(((obj instanceof com.ibm.icu.math.BigDecimal)))))\r
+            return false; // not a decimal\r
+        rhs = (com.ibm.icu.math.BigDecimal) obj; // cast; we know it will work\r
+        if (this.ind != rhs.ind)\r
+            return false; // different signs never match\r
+        if (((this.mant.length == rhs.mant.length) & (this.exp == rhs.exp)) & (this.form == rhs.form))\r
+\r
+        { // mantissas say all\r
+            // here with equal-length byte arrays to compare\r
+            {\r
+                int $8 = this.mant.length;\r
+                i = 0;\r
+                for (; $8 > 0; $8--, i++) {\r
+                    if (this.mant[i] != rhs.mant[i])\r
+                        return false;\r
+                }\r
+            }/* i */\r
+        } else { // need proper layout\r
+            lca = this.layout(); // layout to character array\r
+            rca = rhs.layout();\r
+            if (lca.length != rca.length)\r
+                return false; // mismatch\r
+            // here with equal-length character arrays to compare\r
+            {\r
+                int $9 = lca.length;\r
+                i = 0;\r
+                for (; $9 > 0; $9--, i++) {\r
+                    if (lca[i] != rca[i])\r
+                        return false;\r
+                }\r
+            }/* i */\r
+        }\r
+        return true; // arrays have identical content\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>float</code>. If the <code>BigDecimal</code> is out of the\r
+     * possible range for a <code>float</code> (32-bit signed floating point) result then an <code>ArithmeticException\r
+     * </code> is thrown.\r
+     * <p>\r
+     * The float produced is identical to result of expressing the <code>BigDecimal</code> as a <code>String</code> and\r
+     * then converting it using the <code>Float(String)</code> constructor; this can result in values of <code>\r
+     * Float.NEGATIVE_INFINITY</code> or <code>Float.POSITIVE_INFINITY</code>.\r
+     * \r
+     * @return A <code>float</code> corresponding to <code>this</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public float floatValue() {\r
+        return java.lang.Float.valueOf(this.toString()).floatValue();\r
+    }\r
+\r
+    /**\r
+     * Returns the <code>String</code> representation of this <code>BigDecimal</code>, modified by layout parameters.\r
+     * <p>\r
+     * <i>This method is provided as a primitive for use by more sophisticated classes, such as <code>DecimalFormat\r
+     * </code>, that can apply locale-sensitive editing of the result. The level of formatting that it provides is a\r
+     * necessary part of the BigDecimal class as it is sensitive to and must follow the calculation and rounding rules\r
+     * for BigDecimal arithmetic. However, if the function is provided elsewhere, it may be removed from this class.\r
+     * </i>\r
+     * <p>\r
+     * The parameters, for both forms of the <code>format</code> method are all of type <code>int</code>. A value of -1\r
+     * for any parameter indicates that the default action or value for that parameter should be used.\r
+     * <p>\r
+     * The parameters, <code>before</code> and <code>after</code>, specify the number of characters to be used for the\r
+     * integer part and decimal part of the result respectively. Exponential notation is not used. If either parameter\r
+     * is -1 (which indicates the default action), the number of characters used will be exactly as many as are needed\r
+     * for that part.\r
+     * <p>\r
+     * <code>before</code> must be a positive number; if it is larger than is needed to contain the integer part, that\r
+     * part is padded on the left with blanks to the requested length. If <code>before</code> is not large enough to\r
+     * contain the integer part of the number (including the sign, for negative numbers) an exception is thrown.\r
+     * <p>\r
+     * <code>after</code> must be a non-negative number; if it is not the same size as the decimal part of the number,\r
+     * the number will be rounded (or extended with zeros) to fit. Specifying 0 for <code>after</code> will cause the\r
+     * number to be rounded to an integer (that is, it will have no decimal part or decimal point). The rounding method\r
+     * will be the default, <code>MathContext.ROUND_HALF_UP</code>.\r
+     * <p>\r
+     * Other rounding methods, and the use of exponential notation, can be selected by using\r
+     * {@link #format(int,int,int,int,int,int)}. Using the two-parameter form of the method has exactly the same effect\r
+     * as using the six-parameter form with the final four parameters all being -1.\r
+     * \r
+     * @param before The <code>int</code> specifying the number of places before the decimal point. Use -1 for 'as many as are needed'.\r
+     * @param after The <code>int</code> specifying the number of places after the decimal point. Use -1 for 'as many as are needed'.\r
+     * @return A <code>String</code> representing this <code>BigDecimal</code>, laid out according to the specified parameters\r
+     * @throws ArithmeticException if the number cannot be laid out as requested.\r
+     * @throws IllegalArgumentException if a parameter is out of range.\r
+     * @stable ICU 2.0\r
+     * @see #toString\r
+     * @see #toCharArray\r
+     */\r
+\r
+    public java.lang.String format(int before, int after) {\r
+        return format(before, after, -1, -1, com.ibm.icu.math.MathContext.SCIENTIFIC, ROUND_HALF_UP);\r
+    }\r
+\r
+    /**\r
+     * Returns the <code>String</code> representation of this <code>BigDecimal</code>, modified by layout parameters and\r
+     * allowing exponential notation.\r
+     * <p>\r
+     * <i>This method is provided as a primitive for use by more sophisticated classes, such as <code>DecimalFormat\r
+     * </code>, that can apply locale-sensitive editing of the result. The level of formatting that it provides is a\r
+     * necessary part of the BigDecimal class as it is sensitive to and must follow the calculation and rounding rules\r
+     * for BigDecimal arithmetic. However, if the function is provided elsewhere, it may be removed from this class.\r
+     * </i>\r
+     * <p>\r
+     * The parameters are all of type <code>int</code>. A value of -1 for any parameter indicates that the default\r
+     * action or value for that parameter should be used.\r
+     * <p>\r
+     * The first two parameters (<code>before</code> and <code>after</code>) specify the number of characters to be used\r
+     * for the integer part and decimal part of the result respectively, as defined for {@link #format(int,int)}. If\r
+     * either of these is -1 (which indicates the default action), the number of characters used will be exactly as many\r
+     * as are needed for that part.\r
+     * <p>\r
+     * The remaining parameters control the use of exponential notation and rounding. Three (<code>explaces</code>,\r
+     * <code>exdigits</code>, and <code>exform</code>) control the exponent part of the result. As before, the default\r
+     * action for any of these parameters may be selected by using the value -1.\r
+     * <p>\r
+     * <code>explaces</code> must be a positive number; it sets the number of places (digits after the sign of the\r
+     * exponent) to be used for any exponent part, the default (when <code>explaces</code> is -1) being to use as many\r
+     * as are needed. If <code>explaces</code> is not -1, space is always reserved for an exponent; if one is not needed\r
+     * (for example, if the exponent will be 0) then <code>explaces</code>+2 blanks are appended to the result. <!--\r
+     * (This preserves vertical alignment of similarly formatted numbers in a monospace font.) --> If <code>explaces\r
+     * </code> is not -1 and is not large enough to contain the exponent, an exception is thrown.\r
+     * <p>\r
+     * <code>exdigits</code> sets the trigger point for use of exponential notation. If, before any rounding, the number\r
+     * of places needed before the decimal point exceeds <code>exdigits</code>, or if the absolute value of the result\r
+     * is less than <code>0.000001</code>, then exponential form will be used, provided that <code>exdigits</code> was\r
+     * specified. When <code>exdigits</code> is -1, exponential notation will never be used. If 0 is specified for\r
+     * <code>exdigits</code>, exponential notation is always used unless the exponent would be 0.\r
+     * <p>\r
+     * <code>exform</code> sets the form for exponential notation (if needed). It may be either\r
+     * {@link MathContext#SCIENTIFIC} or {@link MathContext#ENGINEERING}. If the latter, engineering, form is requested,\r
+     * up to three digits (plus sign, if negative) may be needed for the integer part of the result (<code>before</code>\r
+     * ). Otherwise, only one digit (plus sign, if negative) is needed.\r
+     * <p>\r
+     * Finally, the sixth argument, <code>exround</code>, selects the rounding algorithm to be used, and must be one of\r
+     * the values indicated by a public constant in the {@link MathContext} class whose name starts with <code>ROUND_\r
+     * </code>. The default (<code>ROUND_HALF_UP</code>) may also be selected by using the value -1, as before.\r
+     * <p>\r
+     * The special value <code>MathContext.ROUND_UNNECESSARY</code> may be used to detect whether non-zero digits are\r
+     * discarded -- if <code>exround</code> has this value than if non-zero digits would be discarded (rounded) during\r
+     * formatting then an <code>ArithmeticException</code> is thrown.\r
+     * \r
+     * @param before The <code>int</code> specifying the number of places before the decimal point. Use -1 for 'as many as\r
+     *            are needed'.\r
+     * @param after The <code>int</code> specifying the number of places after the decimal point. Use -1 for 'as many as\r
+     *            are needed'.\r
+     * @param explaces The <code>int</code> specifying the number of places to be used for any exponent. Use -1 for 'as many\r
+     *            as are needed'.\r
+     * @param exdigits The <code>int</code> specifying the trigger (digits before the decimal point) which if exceeded causes\r
+     *            exponential notation to be used. Use 0 to force exponential notation. Use -1 to force plain notation\r
+     *            (no exponential notation).\r
+     * @param exformint The <code>int</code> specifying the form of exponential notation to be used (\r
+     *            {@link MathContext#SCIENTIFIC} or {@link MathContext#ENGINEERING}).\r
+     * @param exround The <code>int</code> specifying the rounding mode to use. Use -1 for the default,\r
+     *            {@link MathContext#ROUND_HALF_UP}.\r
+     * @return A <code>String</code> representing this <code>BigDecimal</code>, laid out according to the specified\r
+     *         parameters\r
+     * @throws ArithmeticException if the number cannot be laid out as requested.\r
+     * @throws IllegalArgumentException if a parameter is out of range.\r
+     * @see #toString\r
+     * @see #toCharArray\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public java.lang.String format(int before, int after, int explaces, int exdigits, int exformint, int exround) {\r
+        com.ibm.icu.math.BigDecimal num;\r
+        int mag = 0;\r
+        int thisafter = 0;\r
+        int lead = 0;\r
+        byte newmant[] = null;\r
+        int chop = 0;\r
+        int need = 0;\r
+        int oldexp = 0;\r
+        char a[];\r
+        int p = 0;\r
+        char newa[] = null;\r
+        int i = 0;\r
+        int places = 0;\r
+\r
+        /* Check arguments */\r
+        if ((before < (-1)) | (before == 0))\r
+            badarg("format", 1, java.lang.String.valueOf(before));\r
+        if (after < (-1))\r
+            badarg("format", 2, java.lang.String.valueOf(after));\r
+        if ((explaces < (-1)) | (explaces == 0))\r
+            badarg("format", 3, java.lang.String.valueOf(explaces));\r
+        if (exdigits < (-1))\r
+            badarg("format", 4, java.lang.String.valueOf(explaces));\r
+        {/* select */\r
+            if (exformint == com.ibm.icu.math.MathContext.SCIENTIFIC) {\r
+            } else if (exformint == com.ibm.icu.math.MathContext.ENGINEERING) {\r
+            } else if (exformint == (-1))\r
+                exformint = com.ibm.icu.math.MathContext.SCIENTIFIC;\r
+            // note PLAIN isn't allowed\r
+            else {\r
+                badarg("format", 5, java.lang.String.valueOf(exformint));\r
+            }\r
+        }\r
+        // checking the rounding mode is done by trying to construct a\r
+        // MathContext object with that mode; it will fail if bad\r
+        if (exround != ROUND_HALF_UP) {\r
+            try { // if non-default...\r
+                if (exround == (-1))\r
+                    exround = ROUND_HALF_UP;\r
+                else\r
+                    new com.ibm.icu.math.MathContext(9, com.ibm.icu.math.MathContext.SCIENTIFIC, false, exround);\r
+            } catch (java.lang.IllegalArgumentException $10) {\r
+                badarg("format", 6, java.lang.String.valueOf(exround));\r
+            }\r
+        }\r
+\r
+        num = clone(this); // make private copy\r
+\r
+        /*\r
+         * Here: num is BigDecimal to format before is places before point [>0] after is places after point [>=0]\r
+         * explaces is exponent places [>0] exdigits is exponent digits [>=0] exformint is exponent form [one of two]\r
+         * exround is rounding mode [one of eight] 'before' through 'exdigits' are -1 if not specified\r
+         */\r
+\r
+        /* determine form */\r
+        {\r
+            do {/* select */\r
+                if (exdigits == (-1))\r
+                    num.form = (byte) com.ibm.icu.math.MathContext.PLAIN;\r
+                else if (num.ind == iszero)\r
+                    num.form = (byte) com.ibm.icu.math.MathContext.PLAIN;\r
+                else {\r
+                    // determine whether triggers\r
+                    mag = num.exp + num.mant.length;\r
+                    if (mag > exdigits)\r
+                        num.form = (byte) exformint;\r
+                    else if (mag < (-5))\r
+                        num.form = (byte) exformint;\r
+                    else\r
+                        num.form = (byte) com.ibm.icu.math.MathContext.PLAIN;\r
+                }\r
+            } while (false);\r
+        }/* setform */\r
+\r
+        /*\r
+         * If 'after' was specified then we may need to adjust the mantissa. This is a little tricky, as we must conform\r
+         * to the rules of exponential layout if necessary (e.g., we cannot end up with 10.0 if scientific).\r
+         */\r
+        if (after >= 0) {\r
+            setafter: for (;;) {\r
+                // calculate the current after-length\r
+                {/* select */\r
+                    if (num.form == com.ibm.icu.math.MathContext.PLAIN)\r
+                        thisafter = -num.exp; // has decimal part\r
+                    else if (num.form == com.ibm.icu.math.MathContext.SCIENTIFIC)\r
+                        thisafter = num.mant.length - 1;\r
+                    else { // engineering\r
+                        lead = (((num.exp + num.mant.length) - 1)) % 3; // exponent to use\r
+                        if (lead < 0)\r
+                            lead = 3 + lead; // negative exponent case\r
+                        lead++; // number of leading digits\r
+                        if (lead >= num.mant.length)\r
+                            thisafter = 0;\r
+                        else\r
+                            thisafter = num.mant.length - lead;\r
+                    }\r
+                }\r
+                if (thisafter == after)\r
+                    break setafter; // we're in luck\r
+                if (thisafter < after) { // need added trailing zeros\r
+                    // [thisafter can be negative]\r
+                    newmant = extend(num.mant, (num.mant.length + after) - thisafter);\r
+                    num.mant = newmant;\r
+                    num.exp = num.exp - ((after - thisafter)); // adjust exponent\r
+                    if (num.exp < MinExp)\r
+                        throw new java.lang.ArithmeticException("Exponent Overflow:" + " " + num.exp);\r
+                    break setafter;\r
+                }\r
+                // We have too many digits after the decimal point; this could\r
+                // cause a carry, which could change the mantissa...\r
+                // Watch out for implied leading zeros in PLAIN case\r
+                chop = thisafter - after; // digits to lop [is >0]\r
+                if (chop > num.mant.length) { // all digits go, no chance of carry\r
+                    // carry on with zero\r
+                    num.mant = ZERO.mant;\r
+                    num.ind = iszero;\r
+                    num.exp = 0;\r
+                    continue setafter; // recheck: we may need trailing zeros\r
+                }\r
+                // we have a digit to inspect from existing mantissa\r
+                // round the number as required\r
+                need = num.mant.length - chop; // digits to end up with [may be 0]\r
+                oldexp = num.exp; // save old exponent\r
+                num.round(need, exround);\r
+                // if the exponent grew by more than the digits we chopped, then\r
+                // we must have had a carry, so will need to recheck the layout\r
+                if ((num.exp - oldexp) == chop)\r
+                    break setafter; // number did not have carry\r
+                // mantissa got extended .. so go around and check again\r
+            }\r
+        }/* setafter */\r
+\r
+        a = num.layout(); // lay out, with exponent if required, etc.\r
+\r
+        /* Here we have laid-out number in 'a' */\r
+        // now apply 'before' and 'explaces' as needed\r
+        if (before > 0) {\r
+            // look for '.' or 'E'\r
+            {\r
+                int $11 = a.length;\r
+                p = 0;\r
+                p: for (; $11 > 0; $11--, p++) {\r
+                    if (a[p] == '.')\r
+                        break p;\r
+                    if (a[p] == 'E')\r
+                        break p;\r
+                }\r
+            }/* p */\r
+            // p is now offset of '.', 'E', or character after end of array\r
+            // that is, the current length of before part\r
+            if (p > before)\r
+                badarg("format", 1, java.lang.String.valueOf(before)); // won't fit\r
+            if (p < before) { // need leading blanks\r
+                newa = new char[(a.length + before) - p];\r
+                {\r
+                    int $12 = before - p;\r
+                    i = 0;\r
+                    for (; $12 > 0; $12--, i++) {\r
+                        newa[i] = ' ';\r
+                    }\r
+                }/* i */\r
+                java.lang.System.arraycopy((java.lang.Object) a, 0, (java.lang.Object) newa, i, a.length);\r
+                a = newa;\r
+            }\r
+            // [if p=before then it's just the right length]\r
+        }\r
+\r
+        if (explaces > 0) {\r
+            // look for 'E' [cannot be at offset 0]\r
+            {\r
+                int $13 = a.length - 1;\r
+                p = a.length - 1;\r
+                p: for (; $13 > 0; $13--, p--) {\r
+                    if (a[p] == 'E')\r
+                        break p;\r
+                }\r
+            }/* p */\r
+            // p is now offset of 'E', or 0\r
+            if (p == 0) { // no E part; add trailing blanks\r
+                newa = new char[(a.length + explaces) + 2];\r
+                java.lang.System.arraycopy((java.lang.Object) a, 0, (java.lang.Object) newa, 0, a.length);\r
+                {\r
+                    int $14 = explaces + 2;\r
+                    i = a.length;\r
+                    for (; $14 > 0; $14--, i++) {\r
+                        newa[i] = ' ';\r
+                    }\r
+                }/* i */\r
+                a = newa;\r
+            } else {/* found E */// may need to insert zeros\r
+                places = (a.length - p) - 2; // number so far\r
+                if (places > explaces)\r
+                    badarg("format", 3, java.lang.String.valueOf(explaces));\r
+                if (places < explaces) { // need to insert zeros\r
+                    newa = new char[(a.length + explaces) - places];\r
+                    java.lang.System.arraycopy((java.lang.Object) a, 0, (java.lang.Object) newa, 0, p + 2); // through E\r
+                                                                                                            // and sign\r
+                    {\r
+                        int $15 = explaces - places;\r
+                        i = p + 2;\r
+                        for (; $15 > 0; $15--, i++) {\r
+                            newa[i] = '0';\r
+                        }\r
+                    }/* i */\r
+                    java.lang.System.arraycopy((java.lang.Object) a, p + 2, (java.lang.Object) newa, i, places); // remainder\r
+                                                                                                                 // of\r
+                                                                                                                 // exponent\r
+                    a = newa;\r
+                }\r
+                // [if places=explaces then it's just the right length]\r
+            }\r
+        }\r
+        return new java.lang.String(a);\r
+    }\r
+\r
+    /**\r
+     * Returns the hashcode for this <code>BigDecimal</code>. This hashcode is suitable for use by the <code>\r
+     * java.util.Hashtable</code> class.\r
+     * <p>\r
+     * Note that two <code>BigDecimal</code> objects are only guaranteed to produce the same hashcode if they are\r
+     * exactly equal (that is, the <code>String</code> representations of the <code>BigDecimal</code> numbers are\r
+     * identical -- they have the same characters in the same sequence).\r
+     * \r
+     * @return An <code>int</code> that is the hashcode for <code>this</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public int hashCode() {\r
+        // Maybe calculate ourselves, later. If so, note that there can be\r
+        // more than one internal representation for a given toString() result.\r
+        return this.toString().hashCode();\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to an <code>int</code>. If the <code>BigDecimal</code> has a non-zero\r
+     * decimal part it is discarded. If the <code>BigDecimal</code> is out of the possible range for an <code>int</code>\r
+     * (32-bit signed integer) result then only the low-order 32 bits are used. (That is, the number may be\r
+     * <i>decapitated</i>.) To avoid unexpected errors when these conditions occur, use the {@link #intValueExact}\r
+     * method.\r
+     * \r
+     * @return An <code>int</code> converted from <code>this</code>, truncated and decapitated if necessary.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public int intValue() {\r
+        return toBigInteger().intValue();\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to an <code>int</code>. If the <code>BigDecimal</code> has a non-zero\r
+     * decimal part or is out of the possible range for an <code>int</code> (32-bit signed integer) result then an\r
+     * <code>ArithmeticException</code> is thrown.\r
+     * \r
+     * @return An <code>int</code> equal in value to <code>this</code>.\r
+     * @throws ArithmeticException if <code>this</code> has a non-zero decimal part, or will not fit in an <code>int</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public int intValueExact() {\r
+        int lodigit;\r
+        int useexp = 0;\r
+        int result;\r
+        int i = 0;\r
+        int topdig = 0;\r
+        // This does not use longValueExact() as the latter can be much\r
+        // slower.\r
+        // intcheck (from pow) relies on this to check decimal part\r
+        if (ind == iszero)\r
+            return 0; // easy, and quite common\r
+        /* test and drop any trailing decimal part */\r
+        lodigit = mant.length - 1;\r
+        if (exp < 0) {\r
+            lodigit = lodigit + exp; // reduces by -(-exp)\r
+            /* all decimal places must be 0 */\r
+            if ((!(allzero(mant, lodigit + 1))))\r
+                throw new java.lang.ArithmeticException("Decimal part non-zero:" + " " + this.toString());\r
+            if (lodigit < 0)\r
+                return 0; // -1<this<1\r
+            useexp = 0;\r
+        } else {/* >=0 */\r
+            if ((exp + lodigit) > 9) // early exit\r
+                throw new java.lang.ArithmeticException("Conversion overflow:" + " " + this.toString());\r
+            useexp = exp;\r
+        }\r
+        /* convert the mantissa to binary, inline for speed */\r
+        result = 0;\r
+        {\r
+            int $16 = lodigit + useexp;\r
+            i = 0;\r
+            for (; i <= $16; i++) {\r
+                result = result * 10;\r
+                if (i <= lodigit)\r
+                    result = result + mant[i];\r
+            }\r
+        }/* i */\r
+\r
+        /* Now, if the risky length, check for overflow */\r
+        if ((lodigit + useexp) == 9) {\r
+            // note we cannot just test for -ve result, as overflow can move a\r
+            // zero into the top bit [consider 5555555555]\r
+            topdig = result / 1000000000; // get top digit, preserving sign\r
+            if (topdig != mant[0]) { // digit must match and be positive\r
+                // except in the special case ...\r
+                if (result == java.lang.Integer.MIN_VALUE) // looks like the special\r
+                    if (ind == isneg) // really was negative\r
+                        if (mant[0] == 2)\r
+                            return result; // really had top digit 2\r
+                throw new java.lang.ArithmeticException("Conversion overflow:" + " " + this.toString());\r
+            }\r
+        }\r
+\r
+        /* Looks good */\r
+        if (ind == ispos)\r
+            return result;\r
+        return -result;\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>long</code>. If the <code>BigDecimal</code> has a non-zero\r
+     * decimal part it is discarded. If the <code>BigDecimal</code> is out of the possible range for a <code>long</code>\r
+     * (64-bit signed integer) result then only the low-order 64 bits are used. (That is, the number may be\r
+     * <i>decapitated</i>.) To avoid unexpected errors when these conditions occur, use the {@link #longValueExact}\r
+     * method.\r
+     * \r
+     * @return A <code>long</code> converted from <code>this</code>, truncated and decapitated if necessary.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public long longValue() {\r
+        return toBigInteger().longValue();\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>long</code>. If the <code>BigDecimal</code> has a non-zero\r
+     * decimal part or is out of the possible range for a <code>long</code> (64-bit signed integer) result then an\r
+     * <code>ArithmeticException</code> is thrown.\r
+     * \r
+     * @return A <code>long</code> equal in value to <code>this</code>.\r
+     * @throws ArithmeticException if <code>this</code> has a non-zero decimal part, or will not fit in a <code>long</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public long longValueExact() {\r
+        int lodigit;\r
+        int cstart = 0;\r
+        int useexp = 0;\r
+        long result;\r
+        int i = 0;\r
+        long topdig = 0;\r
+        // Identical to intValueExact except for result=long, and exp>=20 test\r
+        if (ind == 0)\r
+            return 0; // easy, and quite common\r
+        lodigit = mant.length - 1; // last included digit\r
+        if (exp < 0) {\r
+            lodigit = lodigit + exp; // -(-exp)\r
+            /* all decimal places must be 0 */\r
+            if (lodigit < 0)\r
+                cstart = 0;\r
+            else\r
+                cstart = lodigit + 1;\r
+            if ((!(allzero(mant, cstart))))\r
+                throw new java.lang.ArithmeticException("Decimal part non-zero:" + " " + this.toString());\r
+            if (lodigit < 0)\r
+                return 0; // -1<this<1\r
+            useexp = 0;\r
+        } else {/* >=0 */\r
+            if ((exp + mant.length) > 18) // early exit\r
+                throw new java.lang.ArithmeticException("Conversion overflow:" + " " + this.toString());\r
+            useexp = exp;\r
+        }\r
+\r
+        /* convert the mantissa to binary, inline for speed */\r
+        // note that we could safely use the 'test for wrap to negative'\r
+        // algorithm here, but instead we parallel the intValueExact\r
+        // algorithm for ease of checking and maintenance.\r
+        result = (long) 0;\r
+        {\r
+            int $17 = lodigit + useexp;\r
+            i = 0;\r
+            for (; i <= $17; i++) {\r
+                result = result * 10;\r
+                if (i <= lodigit)\r
+                    result = result + mant[i];\r
+            }\r
+        }/* i */\r
+\r
+        /* Now, if the risky length, check for overflow */\r
+        if ((lodigit + useexp) == 18) {\r
+            topdig = result / 1000000000000000000L; // get top digit, preserving sign\r
+            if (topdig != mant[0]) { // digit must match and be positive\r
+                // except in the special case ...\r
+                if (result == java.lang.Long.MIN_VALUE) // looks like the special\r
+                    if (ind == isneg) // really was negative\r
+                        if (mant[0] == 9)\r
+                            return result; // really had top digit 9\r
+                throw new java.lang.ArithmeticException("Conversion overflow:" + " " + this.toString());\r
+            }\r
+        }\r
+\r
+        /* Looks good */\r
+        if (ind == ispos)\r
+            return result;\r
+        return -result;\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose decimal point has been moved to the left by a specified number of\r
+     * positions. The parameter, <code>n</code>, specifies the number of positions to move the decimal point. That is,\r
+     * if <code>n</code> is 0 or positive, the number returned is given by:\r
+     * <p>\r
+     * <code> this.multiply(TEN.pow(new BigDecimal(-n))) </code>\r
+     * <p>\r
+     * <code>n</code> may be negative, in which case the method returns the same result as <code>movePointRight(-n)\r
+     * </code>.\r
+     * \r
+     * @param n The <code>int</code> specifying the number of places to move the decimal point leftwards.\r
+     * @return A <code>BigDecimal</code> derived from <code>this</code>, with the decimal point moved <code>n</code>\r
+     *         places to the left.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal movePointLeft(int n) {\r
+        com.ibm.icu.math.BigDecimal res;\r
+        // very little point in optimizing for shift of 0\r
+        res = clone(this);\r
+        res.exp = res.exp - n;\r
+        return res.finish(plainMC, false); // finish sets form and checks exponent\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> whose decimal point has been moved to the right by a specified number of\r
+     * positions. The parameter, <code>n</code>, specifies the number of positions to move the decimal point. That is,\r
+     * if <code>n</code> is 0 or positive, the number returned is given by:\r
+     * <p>\r
+     * <code> this.multiply(TEN.pow(new BigDecimal(n))) </code>\r
+     * <p>\r
+     * <code>n</code> may be negative, in which case the method returns the same result as <code>movePointLeft(-n)\r
+     * </code>.\r
+     * \r
+     * @param n The <code>int</code> specifying the number of places to move the decimal point rightwards.\r
+     * @return A <code>BigDecimal</code> derived from <code>this</code>, with the decimal point moved <code>n</code>\r
+     *         places to the right.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal movePointRight(int n) {\r
+        com.ibm.icu.math.BigDecimal res;\r
+        res = clone(this);\r
+        res.exp = res.exp + n;\r
+        return res.finish(plainMC, false);\r
+    }\r
+\r
+    /**\r
+     * Returns the scale of this <code>BigDecimal</code>. Returns a non-negative <code>int</code> which is the scale of\r
+     * the number. The scale is the number of digits in the decimal part of the number if the number were formatted\r
+     * without exponential notation.\r
+     * \r
+     * @return An <code>int</code> whose value is the scale of this <code>BigDecimal</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public int scale() {\r
+        if (exp >= 0)\r
+            return 0; // scale can never be negative\r
+        return -exp;\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> with a given scale.\r
+     * <p>\r
+     * If the given scale (which must be zero or positive) is the same as or greater than the length of the decimal part\r
+     * (the scale) of this <code>BigDecimal</code> then trailing zeros will be added to the decimal part as necessary.\r
+     * <p>\r
+     * If the given scale is less than the length of the decimal part (the scale) of this <code>BigDecimal</code> then\r
+     * trailing digits will be removed, and in this case an <code>ArithmeticException</code> is thrown if any discarded\r
+     * digits are non-zero.\r
+     * <p>\r
+     * The same as {@link #setScale(int, int)}, where the first parameter is the scale, and the second is <code>\r
+     * MathContext.ROUND_UNNECESSARY</code>.\r
+     * \r
+     * @param scale The <code>int</code> specifying the scale of the resulting <code>BigDecimal</code>.\r
+     * @return A plain <code>BigDecimal</code> with the given scale.\r
+     * @throws ArithmeticException if <code>scale</code> is negative.\r
+     * @throws ArithmeticException if reducing scale would discard non-zero digits.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal setScale(int scale) {\r
+        return setScale(scale, ROUND_UNNECESSARY);\r
+    }\r
+\r
+    /**\r
+     * Returns a plain <code>BigDecimal</code> with a given scale.\r
+     * <p>\r
+     * If the given scale (which must be zero or positive) is the same as or greater than the length of the decimal part\r
+     * (the scale) of this <code>BigDecimal</code> then trailing zeros will be added to the decimal part as necessary.\r
+     * <p>\r
+     * If the given scale is less than the length of the decimal part (the scale) of this <code>BigDecimal</code> then\r
+     * trailing digits will be removed, and the rounding mode given by the second parameter is used to determine if the\r
+     * remaining digits are affected by a carry. In this case, an <code>IllegalArgumentException</code> is thrown if\r
+     * <code>round</code> is not a valid rounding mode.\r
+     * <p>\r
+     * If <code>round</code> is <code>MathContext.ROUND_UNNECESSARY</code>, an <code>ArithmeticException</code> is\r
+     * thrown if any discarded digits are non-zero.\r
+     * \r
+     * @param scale The <code>int</code> specifying the scale of the resulting <code>BigDecimal</code>.\r
+     * @param round The <code>int</code> rounding mode to be used for the division (see the {@link MathContext} class).\r
+     * @return A plain <code>BigDecimal</code> with the given scale.\r
+     * @throws IllegalArgumentException if <code>round</code> is not a valid rounding mode.\r
+     * @throws ArithmeticException if <code>scale</code> is negative.\r
+     * @throws ArithmeticException if <code>round</code> is <code>MathContext.ROUND_UNNECESSARY</code>, and reducing scale would discard\r
+     *             non-zero digits.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public com.ibm.icu.math.BigDecimal setScale(int scale, int round) {\r
+        int ourscale;\r
+        com.ibm.icu.math.BigDecimal res;\r
+        int padding = 0;\r
+        int newlen = 0;\r
+        // at present this naughtily only checks the round value if it is\r
+        // needed (used), for speed\r
+        ourscale = this.scale();\r
+        if (ourscale == scale) // already correct scale\r
+            if (this.form == com.ibm.icu.math.MathContext.PLAIN) // .. and form\r
+                return this;\r
+        res = clone(this); // need copy\r
+        if (ourscale <= scale) { // simply zero-padding/changing form\r
+            // if ourscale is 0 we may have lots of 0s to add\r
+            if (ourscale == 0)\r
+                padding = res.exp + scale;\r
+            else\r
+                padding = scale - ourscale;\r
+            res.mant = extend(res.mant, res.mant.length + padding);\r
+            res.exp = -scale; // as requested\r
+        } else {/* ourscale>scale: shortening, probably */\r
+            if (scale < 0)\r
+                throw new java.lang.ArithmeticException("Negative scale:" + " " + scale);\r
+            // [round() will raise exception if invalid round]\r
+            newlen = res.mant.length - ((ourscale - scale)); // [<=0 is OK]\r
+            res = res.round(newlen, round); // round to required length\r
+            // This could have shifted left if round (say) 0.9->1[.0]\r
+            // Repair if so by adding a zero and reducing exponent\r
+            if (res.exp != -scale) {\r
+                res.mant = extend(res.mant, res.mant.length + 1);\r
+                res.exp = res.exp - 1;\r
+            }\r
+        }\r
+        res.form = (byte) com.ibm.icu.math.MathContext.PLAIN; // by definition\r
+        return res;\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>short</code>. If the <code>BigDecimal</code> has a non-zero\r
+     * decimal part or is out of the possible range for a <code>short</code> (16-bit signed integer) result then an\r
+     * <code>ArithmeticException</code> is thrown.\r
+     * \r
+     * @return A <code>short</code> equal in value to <code>this</code>.\r
+     * @throws ArithmeticException if <code>this</code> has a non-zero decimal part, or will not fit in a <code>short</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public short shortValueExact() {\r
+        int num;\r
+        num = this.intValueExact(); // will check decimal part too\r
+        if ((num > 32767) | (num < (-32768)))\r
+            throw new java.lang.ArithmeticException("Conversion overflow:" + " " + this.toString());\r
+        return (short) num;\r
+    }\r
+\r
+    /**\r
+     * Returns the sign of this <code>BigDecimal</code>, as an <code>int</code>. This returns the <i>signum</i> function\r
+     * value that represents the sign of this <code>BigDecimal</code>. That is, -1 if the <code>BigDecimal</code> is\r
+     * negative, 0 if it is numerically equal to zero, or 1 if it is positive.\r
+     * \r
+     * @return An <code>int</code> which is -1 if the <code>BigDecimal</code> is negative, 0 if it is numerically equal\r
+     *         to zero, or 1 if it is positive.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public int signum() {\r
+        return (int) this.ind; // [note this assumes values for ind.]\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>java.math.BigDecimal</code>.\r
+     * <p>\r
+     * This is an exact conversion; the result is the same as if the <code>BigDecimal</code> were formatted as a plain\r
+     * number without any rounding or exponent and then the <code>java.math.BigDecimal(java.lang.String)</code>\r
+     * constructor were used to construct the result.\r
+     * <p>\r
+     * <i>(Note: this method is provided only in the <code>com.ibm.icu.math</code> version of the BigDecimal class. It\r
+     * would not be present in a <code>java.math</code> version.)</i>\r
+     * \r
+     * @return The <code>java.math.BigDecimal</code> equal in value to this <code>BigDecimal</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public java.math.BigDecimal toBigDecimal() {\r
+        return new java.math.BigDecimal(this.unscaledValue(), this.scale());\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>java.math.BigInteger</code>.\r
+     * <p>\r
+     * Any decimal part is truncated (discarded). If an exception is desired should the decimal part be non-zero, use\r
+     * {@link #toBigIntegerExact()}.\r
+     * \r
+     * @return The <code>java.math.BigInteger</code> equal in value to the integer part of this <code>BigDecimal</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public java.math.BigInteger toBigInteger() {\r
+        com.ibm.icu.math.BigDecimal res = null;\r
+        int newlen = 0;\r
+        byte newmant[] = null;\r
+        {/* select */\r
+            if ((exp >= 0) & (form == com.ibm.icu.math.MathContext.PLAIN))\r
+                res = this; // can layout simply\r
+            else if (exp >= 0) {\r
+                res = clone(this); // safe copy\r
+                res.form = (byte) com.ibm.icu.math.MathContext.PLAIN; // .. and request PLAIN\r
+            } else {\r
+                { // exp<0; scale to be truncated\r
+                    // we could use divideInteger, but we may as well be quicker\r
+                    if (-this.exp >= this.mant.length)\r
+                        res = ZERO; // all blows away\r
+                    else {\r
+                        res = clone(this); // safe copy\r
+                        newlen = res.mant.length + res.exp;\r
+                        newmant = new byte[newlen]; // [shorter]\r
+                        java.lang.System.arraycopy((java.lang.Object) res.mant, 0, (java.lang.Object) newmant, 0,\r
+                                newlen);\r
+                        res.mant = newmant;\r
+                        res.form = (byte) com.ibm.icu.math.MathContext.PLAIN;\r
+                        res.exp = 0;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return new BigInteger(new java.lang.String(res.layout()));\r
+    }\r
+\r
+    /**\r
+     * Converts this <code>BigDecimal</code> to a <code>java.math.BigInteger</code>.\r
+     * <p>\r
+     * An exception is thrown if the decimal part (if any) is non-zero.\r
+     * \r
+     * @return The <code>java.math.BigInteger</code> equal in value to the integer part of this <code>BigDecimal</code>.\r
+     * @throws ArithmeticException if <code>this</code> has a non-zero decimal part.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public java.math.BigInteger toBigIntegerExact() {\r
+        /* test any trailing decimal part */\r
+        if (exp < 0) { // possible decimal part\r
+            /* all decimal places must be 0; note exp<0 */\r
+            if ((!(allzero(mant, mant.length + exp))))\r
+                throw new java.lang.ArithmeticException("Decimal part non-zero:" + " " + this.toString());\r
+        }\r
+        return toBigInteger();\r
+    }\r
+\r
+    /**\r
+     * Returns the <code>BigDecimal</code> as a character array. The result of this method is the same as using the\r
+     * sequence <code>toString().toCharArray()</code>, but avoids creating the intermediate <code>String</code> and\r
+     * <code>char[]</code> objects.\r
+     * \r
+     * @return The <code>char[]</code> array corresponding to this <code>BigDecimal</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public char[] toCharArray() {\r
+        return layout();\r
+    }\r
+\r
+    /**\r
+     * Returns the <code>BigDecimal</code> as a <code>String</code>. This returns a <code>String</code> that exactly\r
+     * represents this <code>BigDecimal</code>, as defined in the decimal documentation (see {@link BigDecimal class\r
+     * header}).\r
+     * <p>\r
+     * By definition, using the {@link #BigDecimal(String)} constructor on the result <code>String</code> will create a\r
+     * <code>BigDecimal</code> that is exactly equal to the original <code>BigDecimal</code>.\r
+     * \r
+     * @return The <code>String</code> exactly corresponding to this <code>BigDecimal</code>.\r
+     * @see #format(int, int)\r
+     * @see #format(int, int, int, int, int, int)\r
+     * @see #toCharArray()\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public java.lang.String toString() {\r
+        return new java.lang.String(layout());\r
+    }\r
+\r
+    /**\r
+     * Returns the number as a <code>BigInteger</code> after removing the scale. That is, the number is expressed as a\r
+     * plain number, any decimal point is then removed (retaining the digits of any decimal part), and the result is\r
+     * then converted to a <code>BigInteger</code>.\r
+     * \r
+     * @return The <code>java.math.BigInteger</code> equal in value to this <code>BigDecimal</code> multiplied by ten to\r
+     *         the power of <code>this.scale()</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public java.math.BigInteger unscaledValue() {\r
+        com.ibm.icu.math.BigDecimal res = null;\r
+        if (exp >= 0)\r
+            res = this;\r
+        else {\r
+            res = clone(this); // safe copy\r
+            res.exp = 0; // drop scale\r
+        }\r
+        return res.toBigInteger();\r
+    }\r
+\r
+    /**\r
+     * Translates a <code>double</code> to a <code>BigDecimal</code>.\r
+     * <p>\r
+     * Returns a <code>BigDecimal</code> which is the decimal representation of the 64-bit signed binary floating point\r
+     * parameter. If the parameter is infinite, or is not a number (NaN), a <code>NumberFormatException</code> is\r
+     * thrown.\r
+     * <p>\r
+     * The number is constructed as though <code>num</code> had been converted to a <code>String</code> using the <code>\r
+     * Double.toString()</code> method and the {@link #BigDecimal(java.lang.String)} constructor had then been used.\r
+     * This is typically not an exact conversion.\r
+     * \r
+     * @param dub The <code>double</code> to be translated.\r
+     * @return The <code>BigDecimal</code> equal in value to <code>dub</code>.\r
+     * @throws NumberFormatException if the parameter is infinite or not a number.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public static com.ibm.icu.math.BigDecimal valueOf(double dub) {\r
+        // Reminder: a zero double returns '0.0', so we cannot fastpath to\r
+        // use the constant ZERO. This might be important enough to justify\r
+        // a factory approach, a cache, or a few private constants, later.\r
+        return new com.ibm.icu.math.BigDecimal((new java.lang.Double(dub)).toString());\r
+    }\r
+\r
+    /**\r
+     * Translates a <code>long</code> to a <code>BigDecimal</code>. That is, returns a plain <code>BigDecimal</code>\r
+     * whose value is equal to the given <code>long</code>.\r
+     * \r
+     * @param lint The <code>long</code> to be translated.\r
+     * @return The <code>BigDecimal</code> equal in value to <code>lint</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public static com.ibm.icu.math.BigDecimal valueOf(long lint) {\r
+        return valueOf(lint, 0);\r
+    }\r
+\r
+    /**\r
+     * Translates a <code>long</code> to a <code>BigDecimal</code> with a given scale. That is, returns a plain <code>\r
+     * BigDecimal</code> whose unscaled value is equal to the given <code>long</code>, adjusted by the second parameter,\r
+     * <code>scale</code>.\r
+     * <p>\r
+     * The result is given by:\r
+     * <p>\r
+     * <code> (new BigDecimal(lint)).divide(TEN.pow(new BigDecimal(scale))) </code>\r
+     * <p>\r
+     * A <code>NumberFormatException</code> is thrown if <code>scale</code> is negative.\r
+     * \r
+     * @param lint The <code>long</code> to be translated.\r
+     * @param scale The <code>int</code> scale to be applied.\r
+     * @return The <code>BigDecimal</code> equal in value to <code>lint</code>.\r
+     * @throws NumberFormatException if the scale is negative.\r
+     * @stable ICU 2.0\r
+     */\r
+\r
+    public static com.ibm.icu.math.BigDecimal valueOf(long lint, int scale) {\r
+        com.ibm.icu.math.BigDecimal res = null;\r
+        {/* select */\r
+            if (lint == 0)\r
+                res = ZERO;\r
+            else if (lint == 1)\r
+                res = ONE;\r
+            else if (lint == 10)\r
+                res = TEN;\r
+            else {\r
+                res = new com.ibm.icu.math.BigDecimal(lint);\r
+            }\r
+        }\r
+        if (scale == 0)\r
+            return res;\r
+        if (scale < 0)\r
+            throw new java.lang.NumberFormatException("Negative scale:" + " " + scale);\r
+        res = clone(res); // safe copy [do not mutate]\r
+        res.exp = -scale; // exponent is -scale\r
+        return res;\r
+    }\r
+\r
+    /* ---------------------------------------------------------------- */\r
+    /* Private methods */\r
+    /* ---------------------------------------------------------------- */\r
+\r
+    /*\r
+     * <sgml> Return char array value of a BigDecimal (conversion from BigDecimal to laid-out canonical char array).\r
+     * <p>The mantissa will either already have been rounded (following an operation) or will be of length appropriate\r
+     * (in the case of construction from an int, for example). <p>We must not alter the mantissa, here. <p>'form'\r
+     * describes whether we are to use exponential notation (and if so, which), or if we are to lay out as a plain/pure\r
+     * numeric. </sgml>\r
+     */\r
+\r
+    private char[] layout() {\r
+        char cmant[];\r
+        int i = 0;\r
+        StringBuilder sb = null;\r
+        int euse = 0;\r
+        int sig = 0;\r
+        char csign = 0;\r
+        char rec[] = null;\r
+        int needsign;\r
+        int mag;\r
+        int len = 0;\r
+        cmant = new char[mant.length]; // copy byte[] to a char[]\r
+        {\r
+            int $18 = mant.length;\r
+            i = 0;\r
+            for (; $18 > 0; $18--, i++) {\r
+                cmant[i] = (char) (mant[i] + ((int) ('0')));\r
+            }\r
+        }/* i */\r
+\r
+        if (form != com.ibm.icu.math.MathContext.PLAIN) {/* exponential notation needed */\r
+            sb = new StringBuilder(cmant.length + 15); // -x.xxxE+999999999\r
+            if (ind == isneg)\r
+                sb.append('-');\r
+            euse = (exp + cmant.length) - 1; // exponent to use\r
+            /* setup sig=significant digits and copy to result */\r
+            if (form == com.ibm.icu.math.MathContext.SCIENTIFIC) { // [default]\r
+                sb.append(cmant[0]); // significant character\r
+                if (cmant.length > 1) // have decimal part\r
+                    sb.append('.').append(cmant, 1, cmant.length - 1);\r
+            } else {\r
+                do {\r
+                    sig = euse % 3; // common\r
+                    if (sig < 0)\r
+                        sig = 3 + sig; // negative exponent\r
+                    euse = euse - sig;\r
+                    sig++;\r
+                    if (sig >= cmant.length) { // zero padding may be needed\r
+                        sb.append(cmant, 0, cmant.length);\r
+                        {\r
+                            int $19 = sig - cmant.length;\r
+                            for (; $19 > 0; $19--) {\r
+                                sb.append('0');\r
+                            }\r
+                        }\r
+                    } else { // decimal point needed\r
+                        sb.append(cmant, 0, sig).append('.').append(cmant, sig, cmant.length - sig);\r
+                    }\r
+                } while (false);\r
+            }/* engineering */\r
+            if (euse != 0) {\r
+                if (euse < 0) {\r
+                    csign = '-';\r
+                    euse = -euse;\r
+                } else\r
+                    csign = '+';\r
+                sb.append('E').append(csign).append(euse);\r
+            }\r
+            rec = new char[sb.length()];\r
+            int srcEnd = sb.length();\r
+            if (0 != srcEnd) {\r
+                sb.getChars(0, srcEnd, rec, 0);\r
+            }\r
+            return rec;\r
+        }\r
+\r
+        /* Here for non-exponential (plain) notation */\r
+        if (exp == 0) {/* easy */\r
+            if (ind >= 0)\r
+                return cmant; // non-negative integer\r
+            rec = new char[cmant.length + 1];\r
+            rec[0] = '-';\r
+            java.lang.System.arraycopy((java.lang.Object) cmant, 0, (java.lang.Object) rec, 1, cmant.length);\r
+            return rec;\r
+        }\r
+\r
+        /* Need a '.' and/or some zeros */\r
+        needsign = (ind == isneg) ? 1 : 0; // space for sign? 0 or 1\r
+\r
+        /*\r
+         * MAG is the position of the point in the mantissa (index of the character it follows)\r
+         */\r
+        mag = exp + cmant.length;\r
+\r
+        if (mag < 1) {/* 0.00xxxx form */\r
+            len = (needsign + 2) - exp; // needsign+2+(-mag)+cmant.length\r
+            rec = new char[len];\r
+            if (needsign != 0)\r
+                rec[0] = '-';\r
+            rec[needsign] = '0';\r
+            rec[needsign + 1] = '.';\r
+            {\r
+                int $20 = -mag;\r
+                i = needsign + 2;\r
+                for (; $20 > 0; $20--, i++) { // maybe none\r
+                    rec[i] = '0';\r
+                }\r
+            }/* i */\r
+            java.lang.System.arraycopy((java.lang.Object) cmant, 0, (java.lang.Object) rec, (needsign + 2) - mag,\r
+                    cmant.length);\r
+            return rec;\r
+        }\r
+\r
+        if (mag > cmant.length) {/* xxxx0000 form */\r
+            len = needsign + mag;\r
+            rec = new char[len];\r
+            if (needsign != 0)\r
+                rec[0] = '-';\r
+            java.lang.System.arraycopy((java.lang.Object) cmant, 0, (java.lang.Object) rec, needsign, cmant.length);\r
+            {\r
+                int $21 = mag - cmant.length;\r
+                i = needsign + cmant.length;\r
+                for (; $21 > 0; $21--, i++) { // never 0\r
+                    rec[i] = '0';\r
+                }\r
+            }/* i */\r
+            return rec;\r
+        }\r
+\r
+        /* decimal point is in the middle of the mantissa */\r
+        len = (needsign + 1) + cmant.length;\r
+        rec = new char[len];\r
+        if (needsign != 0)\r
+            rec[0] = '-';\r
+        java.lang.System.arraycopy((java.lang.Object) cmant, 0, (java.lang.Object) rec, needsign, mag);\r
+        rec[needsign + mag] = '.';\r
+        java.lang.System.arraycopy((java.lang.Object) cmant, mag, (java.lang.Object) rec, (needsign + mag) + 1,\r
+                cmant.length - mag);\r
+        return rec;\r
+    }\r
+\r
+    /*\r
+     * <sgml> Checks a BigDecimal argument to ensure it's a true integer in a given range. <p>If OK, returns it as an\r
+     * int. </sgml>\r
+     */\r
+    // [currently only used by pow]\r
+    private int intcheck(int min, int max) {\r
+        int i;\r
+        i = this.intValueExact(); // [checks for non-0 decimal part]\r
+        // Use same message as though intValueExact failed due to size\r
+        if ((i < min) | (i > max))\r
+            throw new java.lang.ArithmeticException("Conversion overflow:" + " " + i);\r
+        return i;\r
+    }\r
+\r
+    /* <sgml> Carry out division operations. </sgml> */\r
+    /*\r
+     * Arg1 is operation code: D=divide, I=integer divide, R=remainder Arg2 is the rhs. Arg3 is the context. Arg4 is\r
+     * explicit scale iff code='D' or 'I' (-1 if none).\r
+     * \r
+     * Underlying algorithm (complications for Remainder function and scaled division are omitted for clarity):\r
+     * \r
+     * Test for x/0 and then 0/x Exp =Exp1 - Exp2 Exp =Exp +len(var1) -len(var2) Sign=Sign1 Sign2 Pad accumulator (Var1)\r
+     * to double-length with 0's (pad1) Pad Var2 to same length as Var1 B2B=1st two digits of var2, +1 to allow for\r
+     * roundup have=0 Do until (have=digits+1 OR residue=0) if exp<0 then if integer divide/residue then leave\r
+     * this_digit=0 Do forever compare numbers if <0 then leave inner_loop if =0 then (- quick exit without subtract -)\r
+     * do this_digit=this_digit+1; output this_digit leave outer_loop; end Compare lengths of numbers (mantissae): If\r
+     * same then CA=first_digit_of_Var1 else CA=first_two_digits_of_Var1 mult=ca10/b2b -- Good and safe guess at divisor\r
+     * if mult=0 then mult=1 this_digit=this_digit+mult subtract end inner_loop if have\=0 | this_digit\=0 then do\r
+     * output this_digit have=have+1; end var2=var2/10 exp=exp-1 end outer_loop exp=exp+1 -- set the proper exponent if\r
+     * have=0 then generate answer=0 Return to FINISHED Result defined by MATHV1\r
+     * \r
+     * For extended commentary, see DMSRCN.\r
+     */\r
+\r
+    private com.ibm.icu.math.BigDecimal dodivide(char code, com.ibm.icu.math.BigDecimal rhs,\r
+            com.ibm.icu.math.MathContext set, int scale) {\r
+        com.ibm.icu.math.BigDecimal lhs;\r
+        int reqdig;\r
+        int newexp;\r
+        com.ibm.icu.math.BigDecimal res;\r
+        int newlen;\r
+        byte var1[];\r
+        int var1len;\r
+        byte var2[];\r
+        int var2len;\r
+        int b2b;\r
+        int have;\r
+        int thisdigit = 0;\r
+        int i = 0;\r
+        byte v2 = 0;\r
+        int ba = 0;\r
+        int mult = 0;\r
+        int start = 0;\r
+        int padding = 0;\r
+        int d = 0;\r
+        byte newvar1[] = null;\r
+        byte lasthave = 0;\r
+        int actdig = 0;\r
+        byte newmant[] = null;\r
+\r
+        if (set.lostDigits)\r
+            checkdigits(rhs, set.digits);\r
+        lhs = this; // name for clarity\r
+\r
+        // [note we must have checked lostDigits before the following checks]\r
+        if (rhs.ind == 0)\r
+            throw new java.lang.ArithmeticException("Divide by 0"); // includes 0/0\r
+        if (lhs.ind == 0) { // 0/x => 0 [possibly with .0s]\r
+            if (set.form != com.ibm.icu.math.MathContext.PLAIN)\r
+                return ZERO;\r
+            if (scale == (-1))\r
+                return lhs;\r
+            return lhs.setScale(scale);\r
+        }\r
+\r
+        /* Prepare numbers according to BigDecimal rules */\r
+        reqdig = set.digits; // local copy (heavily used)\r
+        if (reqdig > 0) {\r
+            if (lhs.mant.length > reqdig)\r
+                lhs = clone(lhs).round(set);\r
+            if (rhs.mant.length > reqdig)\r
+                rhs = clone(rhs).round(set);\r
+        } else {/* scaled divide */\r
+            if (scale == (-1))\r
+                scale = lhs.scale();\r
+            // set reqdig to be at least large enough for the computation\r
+            reqdig = lhs.mant.length; // base length\r
+            // next line handles both positive lhs.exp and also scale mismatch\r
+            if (scale != -lhs.exp)\r
+                reqdig = (reqdig + scale) + lhs.exp;\r
+            reqdig = (reqdig - ((rhs.mant.length - 1))) - rhs.exp; // reduce by RHS effect\r
+            if (reqdig < lhs.mant.length)\r
+                reqdig = lhs.mant.length; // clamp\r
+            if (reqdig < rhs.mant.length)\r
+                reqdig = rhs.mant.length; // ..\r
+        }\r
+\r
+        /* precalculate exponent */\r
+        newexp = ((lhs.exp - rhs.exp) + lhs.mant.length) - rhs.mant.length;\r
+        /* If new exponent -ve, then some quick exits are possible */\r
+        if (newexp < 0)\r
+            if (code != 'D') {\r
+                if (code == 'I')\r
+                    return ZERO; // easy - no integer part\r
+                /* Must be 'R'; remainder is [finished clone of] input value */\r
+                return clone(lhs).finish(set, false);\r
+            }\r
+\r
+        /* We need slow division */\r
+        res = new com.ibm.icu.math.BigDecimal(); // where we'll build result\r
+        res.ind = (byte) (lhs.ind * rhs.ind); // final sign (for D/I)\r
+        res.exp = newexp; // initial exponent (for D/I)\r
+        res.mant = new byte[reqdig + 1]; // where build the result\r
+\r
+        /* Now [virtually pad the mantissae with trailing zeros */\r
+        // Also copy the LHS, which will be our working array\r
+        newlen = (reqdig + reqdig) + 1;\r
+        var1 = extend(lhs.mant, newlen); // always makes longer, so new safe array\r
+        var1len = newlen; // [remaining digits are 0]\r
+\r
+        var2 = rhs.mant;\r
+        var2len = newlen;\r
+\r
+        /* Calculate first two digits of rhs (var2), +1 for later estimations */\r
+        b2b = (var2[0] * 10) + 1;\r
+        if (var2.length > 1)\r
+            b2b = b2b + var2[1];\r
+\r
+        /* start the long-division loops */\r
+        have = 0;\r
+        {\r
+            outer: for (;;) {\r
+                thisdigit = 0;\r
+                /* find the next digit */\r
+                {\r
+                    inner: for (;;) {\r
+                        if (var1len < var2len)\r
+                            break inner; // V1 too low\r
+                        if (var1len == var2len) { // compare needed\r
+                            {\r
+                                compare: do { // comparison\r
+                                    {\r
+                                        int $22 = var1len;\r
+                                        i = 0;\r
+                                        for (; $22 > 0; $22--, i++) {\r
+                                            // var1len is always <= var1.length\r
+                                            if (i < var2.length)\r
+                                                v2 = var2[i];\r
+                                            else\r
+                                                v2 = (byte) 0;\r
+                                            if (var1[i] < v2)\r
+                                                break inner; // V1 too low\r
+                                            if (var1[i] > v2)\r
+                                                break compare; // OK to subtract\r
+                                        }\r
+                                    }/* i */\r
+                                    /*\r
+                                     * reach here if lhs and rhs are identical; subtraction will increase digit by one,\r
+                                     * and the residue will be 0 so we are done; leave the loop with residue set to 0\r
+                                     * (in case code is 'R' or ROUND_UNNECESSARY or a ROUND_HALF_xxxx is being checked)\r
+                                     */\r
+                                    thisdigit++;\r
+                                    res.mant[have] = (byte) thisdigit;\r
+                                    have++;\r
+                                    var1[0] = (byte) 0; // residue to 0 [this is all we'll test]\r
+                                    // var1len=1 -- [optimized out]\r
+                                    break outer;\r
+                                } while (false);\r
+                            }/* compare */\r
+                            /* prepare for subtraction. Estimate BA (lengths the same) */\r
+                            ba = (int) var1[0]; // use only first digit\r
+                        } // lengths the same\r
+                        else {/* lhs longer than rhs */\r
+                            /* use first two digits for estimate */\r
+                            ba = var1[0] * 10;\r
+                            if (var1len > 1)\r
+                                ba = ba + var1[1];\r
+                        }\r
+                        /* subtraction needed; V1>=V2 */\r
+                        mult = (ba * 10) / b2b;\r
+                        if (mult == 0)\r
+                            mult = 1;\r
+                        thisdigit = thisdigit + mult;\r
+                        // subtract; var1 reusable\r
+                        var1 = byteaddsub(var1, var1len, var2, var2len, -mult, true);\r
+                        if (var1[0] != 0)\r
+                            continue inner; // maybe another subtract needed\r
+                        /*\r
+                         * V1 now probably has leading zeros, remove leading 0's and try again. (It could be longer than\r
+                         * V2)\r
+                         */\r
+                        {\r
+                            int $23 = var1len - 2;\r
+                            start = 0;\r
+                            start: for (; start <= $23; start++) {\r
+                                if (var1[start] != 0)\r
+                                    break start;\r
+                                var1len--;\r
+                            }\r
+                        }/* start */\r
+                        if (start == 0)\r
+                            continue inner;\r
+                        // shift left\r
+                        java.lang.System.arraycopy((java.lang.Object) var1, start, (java.lang.Object) var1, 0, var1len);\r
+                    }\r
+                }/* inner */\r
+\r
+                /* We have the next digit */\r
+                if ((have != 0) | (thisdigit != 0)) { // put the digit we got\r
+                    res.mant[have] = (byte) thisdigit;\r
+                    have++;\r
+                    if (have == (reqdig + 1))\r
+                        break outer; // we have all we need\r
+                    if (var1[0] == 0)\r
+                        break outer; // residue now 0\r
+                }\r
+                /* can leave now if a scaled divide and exponent is small enough */\r
+                if (scale >= 0)\r
+                    if (-res.exp > scale)\r
+                        break outer;\r
+                /* can leave now if not Divide and no integer part left */\r
+                if (code != 'D')\r
+                    if (res.exp <= 0)\r
+                        break outer;\r
+                res.exp = res.exp - 1; // reduce the exponent\r
+                /*\r
+                 * to get here, V1 is less than V2, so divide V2 by 10 and go for the next digit\r
+                 */\r
+                var2len--;\r
+            }\r
+        }/* outer */\r
+\r
+        /* here when we have finished dividing, for some reason */\r
+        // have is the number of digits we collected in res.mant\r
+        if (have == 0)\r
+            have = 1; // res.mant[0] is 0; we always want a digit\r
+\r
+        if ((code == 'I') | (code == 'R')) {/* check for integer overflow needed */\r
+            if ((have + res.exp) > reqdig)\r
+                throw new java.lang.ArithmeticException("Integer overflow");\r
+\r
+            if (code == 'R') {\r
+                do {\r
+                    /* We were doing Remainder -- return the residue */\r
+                    if (res.mant[0] == 0) // no integer part was found\r
+                        return clone(lhs).finish(set, false); // .. so return lhs, canonical\r
+                    if (var1[0] == 0)\r
+                        return ZERO; // simple 0 residue\r
+                    res.ind = lhs.ind; // sign is always as LHS\r
+                    /*\r
+                     * Calculate the exponent by subtracting the number of padding zeros we added and adding the\r
+                     * original exponent\r
+                     */\r
+                    padding = ((reqdig + reqdig) + 1) - lhs.mant.length;\r
+                    res.exp = (res.exp - padding) + lhs.exp;\r
+\r
+                    /*\r
+                     * strip insignificant padding zeros from residue, and create/copy the resulting mantissa if need be\r
+                     */\r
+                    d = var1len;\r
+                    {\r
+                        i = d - 1;\r
+                        i: for (; i >= 1; i--) {\r
+                            if (!((res.exp < lhs.exp) & (res.exp < rhs.exp)))\r
+                                break;\r
+                            if (var1[i] != 0)\r
+                                break i;\r
+                            d--;\r
+                            res.exp = res.exp + 1;\r
+                        }\r
+                    }/* i */\r
+                    if (d < var1.length) {/* need to reduce */\r
+                        newvar1 = new byte[d];\r
+                        java.lang.System.arraycopy((java.lang.Object) var1, 0, (java.lang.Object) newvar1, 0, d); // shorten\r
+                        var1 = newvar1;\r
+                    }\r
+                    res.mant = var1;\r
+                    return res.finish(set, false);\r
+                } while (false);\r
+            }/* remainder */\r
+        }\r
+\r
+        else {/* 'D' -- no overflow check needed */\r
+            // If there was a residue then bump the final digit (iff 0 or 5)\r
+            // so that the residue is visible for ROUND_UP, ROUND_HALF_xxx and\r
+            // ROUND_UNNECESSARY checks (etc.) later.\r
+            // [if we finished early, the residue will be 0]\r
+            if (var1[0] != 0) { // residue not 0\r
+                lasthave = res.mant[have - 1];\r
+                if (((lasthave % 5)) == 0)\r
+                    res.mant[have - 1] = (byte) (lasthave + 1);\r
+            }\r
+        }\r
+\r
+        /* Here for Divide or Integer Divide */\r
+        // handle scaled results first ['I' always scale 0, optional for 'D']\r
+        if (scale >= 0) {\r
+            do {\r
+                // say 'scale have res.exp len' scale have res.exp res.mant.length\r
+                if (have != res.mant.length)\r
+                    // already padded with 0's, so just adjust exponent\r
+                    res.exp = res.exp - ((res.mant.length - have));\r
+                // calculate number of digits we really want [may be 0]\r
+                actdig = res.mant.length - (-res.exp - scale);\r
+                res.round(actdig, set.roundingMode); // round to desired length\r
+                // This could have shifted left if round (say) 0.9->1[.0]\r
+                // Repair if so by adding a zero and reducing exponent\r
+                if (res.exp != -scale) {\r
+                    res.mant = extend(res.mant, res.mant.length + 1);\r
+                    res.exp = res.exp - 1;\r
+                }\r
+                return res.finish(set, true); // [strip if not PLAIN]\r
+            } while (false);\r
+        }/* scaled */\r
+\r
+        // reach here only if a non-scaled\r
+        if (have == res.mant.length) { // got digits+1 digits\r
+            res.round(set);\r
+            have = reqdig;\r
+        } else {/* have<=reqdig */\r
+            if (res.mant[0] == 0)\r
+                return ZERO; // fastpath\r
+            // make the mantissa truly just 'have' long\r
+            // [we could let finish do this, during strip, if we adjusted\r
+            // the exponent; however, truncation avoids the strip loop]\r
+            newmant = new byte[have]; // shorten\r
+            java.lang.System.arraycopy((java.lang.Object) res.mant, 0, (java.lang.Object) newmant, 0, have);\r
+            res.mant = newmant;\r
+        }\r
+        return res.finish(set, true);\r
+    }\r
+\r
+    /* <sgml> Report a conversion exception. </sgml> */\r
+\r
+    private void bad(char s[]) {\r
+        throw new java.lang.NumberFormatException("Not a number:" + " " + java.lang.String.valueOf(s));\r
+    }\r
+\r
+    /*\r
+     * <sgml> Report a bad argument to a method. </sgml> Arg1 is method name Arg2 is argument position Arg3 is what was\r
+     * found\r
+     */\r
+\r
+    private void badarg(java.lang.String name, int pos, java.lang.String value) {\r
+        throw new java.lang.IllegalArgumentException("Bad argument" + " " + pos + " " + "to" + " " + name + ":" + " "\r
+                + value);\r
+    }\r
+\r
+    /*\r
+     * <sgml> Extend byte array to given length, padding with 0s. If no extension is required then return the same\r
+     * array. </sgml>\r
+     * \r
+     * Arg1 is the source byte array Arg2 is the new length (longer)\r
+     */\r
+\r
+    private static final byte[] extend(byte inarr[], int newlen) {\r
+        byte newarr[];\r
+        if (inarr.length == newlen)\r
+            return inarr;\r
+        newarr = new byte[newlen];\r
+        java.lang.System.arraycopy((java.lang.Object) inarr, 0, (java.lang.Object) newarr, 0, inarr.length);\r
+        // 0 padding is carried out by the JVM on allocation initialization\r
+        return newarr;\r
+    }\r
+\r
+    /*\r
+     * <sgml> Add or subtract two >=0 integers in byte arrays <p>This routine performs the calculation: <pre> C=A+(BM)\r
+     * </pre> Where M is in the range -9 through +9 <p> If M<0 then A>=B must be true, so the result is always\r
+     * non-negative.\r
+     * \r
+     * Leading zeros are not removed after a subtraction. The result is either the same length as the longer of A and B,\r
+     * or 1 longer than that (if a carry occurred).\r
+     * \r
+     * A is not altered unless Arg6 is 1. B is never altered.\r
+     * \r
+     * Arg1 is A Arg2 is A length to use (if longer than A, pad with 0's) Arg3 is B Arg4 is B length to use (if longer\r
+     * than B, pad with 0's) Arg5 is M, the multiplier Arg6 is 1 if A can be used to build the result (if it fits)\r
+     * \r
+     * This routine is severely performance-critical;any change here must be measured (timed) to assure no performance\r
+     * degradation.\r
+     */\r
+    // 1996.02.20 -- enhanced version of DMSRCN algorithm (1981)\r
+    // 1997.10.05 -- changed to byte arrays (from char arrays)\r
+    // 1998.07.01 -- changed to allow destructive reuse of LHS\r
+    // 1998.07.01 -- changed to allow virtual lengths for the arrays\r
+    // 1998.12.29 -- use lookaside for digit/carry calculation\r
+    // 1999.08.07 -- avoid multiply when mult=1, and make db an int\r
+    // 1999.12.22 -- special case m=-1, also drop 0 special case\r
+    private static final byte[] byteaddsub(byte a[], int avlen, byte b[], int bvlen, int m, boolean reuse) {\r
+        int alength;\r
+        int blength;\r
+        int ap;\r
+        int bp;\r
+        int maxarr;\r
+        byte reb[];\r
+        boolean quickm;\r
+        int digit;\r
+        int op = 0;\r
+        int dp90 = 0;\r
+        byte newarr[];\r
+        int i = 0;\r
+\r
+        // We'll usually be right if we assume no carry\r
+        alength = a.length; // physical lengths\r
+        blength = b.length; // ..\r
+        ap = avlen - 1; // -> final (rightmost) digit\r
+        bp = bvlen - 1; // ..\r
+        maxarr = bp;\r
+        if (maxarr < ap)\r
+            maxarr = ap;\r
+        reb = (byte[]) null; // result byte array\r
+        if (reuse)\r
+            if ((maxarr + 1) == alength)\r
+                reb = a; // OK to reuse A\r
+        if (reb == null)\r
+            reb = new byte[maxarr + 1]; // need new array\r
+\r
+        quickm = false; // 1 if no multiply needed\r
+        if (m == 1)\r
+            quickm = true; // most common\r
+        else if (m == (-1))\r
+            quickm = true; // also common\r
+\r
+        digit = 0; // digit, with carry or borrow\r
+        {\r
+            op = maxarr;\r
+            op: for (; op >= 0; op--) {\r
+                if (ap >= 0) {\r
+                    if (ap < alength)\r
+                        digit = digit + a[ap]; // within A\r
+                    ap--;\r
+                }\r
+                if (bp >= 0) {\r
+                    if (bp < blength) { // within B\r
+                        if (quickm) {\r
+                            if (m > 0)\r
+                                digit = digit + b[bp]; // most common\r
+                            else\r
+                                digit = digit - b[bp]; // also common\r
+                        } else\r
+                            digit = digit + (b[bp] * m);\r
+                    }\r
+                    bp--;\r
+                }\r
+                /* result so far (digit) could be -90 through 99 */\r
+                if (digit < 10)\r
+                    if (digit >= 0) {\r
+                        do { // 0-9\r
+                            reb[op] = (byte) digit;\r
+                            digit = 0; // no carry\r
+                            continue op;\r
+                        } while (false);\r
+                    }/* quick */\r
+                dp90 = digit + 90;\r
+                reb[op] = bytedig[dp90]; // this digit\r
+                digit = bytecar[dp90]; // carry or borrow\r
+            }\r
+        }/* op */\r
+\r
+        if (digit == 0)\r
+            return reb; // no carry\r
+        // following line will become an Assert, later\r
+        // if digit<0 then signal ArithmeticException("internal.error ["digit"]")\r
+\r
+        /* We have carry -- need to make space for the extra digit */\r
+        newarr = (byte[]) null;\r
+        if (reuse)\r
+            if ((maxarr + 2) == a.length)\r
+                newarr = a; // OK to reuse A\r
+        if (newarr == null)\r
+            newarr = new byte[maxarr + 2];\r
+        newarr[0] = (byte) digit; // the carried digit ..\r
+        // .. and all the rest [use local loop for short numbers]\r
+        if (maxarr < 10) {\r
+            int $24 = maxarr + 1;\r
+            i = 0;\r
+            for (; $24 > 0; $24--, i++) {\r
+                newarr[i + 1] = reb[i];\r
+            }\r
+        }/* i */\r
+        else\r
+            java.lang.System.arraycopy((java.lang.Object) reb, 0, (java.lang.Object) newarr, 1, maxarr + 1);\r
+        return newarr;\r
+    }\r
+\r
+    /*\r
+     * <sgml> Initializer for digit array properties (lookaside). </sgml> Returns the digit array, and initializes the\r
+     * carry array.\r
+     */\r
+\r
+    private static final byte[] diginit() {\r
+        byte work[];\r
+        int op = 0;\r
+        int digit = 0;\r
+        work = new byte[(90 + 99) + 1];\r
+        {\r
+            op = 0;\r
+            op: for (; op <= (90 + 99); op++) {\r
+                digit = op - 90;\r
+                if (digit >= 0) {\r
+                    work[op] = (byte) (digit % 10);\r
+                    bytecar[op] = (byte) (digit / 10); // calculate carry\r
+                    continue op;\r
+                }\r
+                // borrowing...\r
+                digit = digit + 100; // yes, this is right [consider -50]\r
+                work[op] = (byte) (digit % 10);\r
+                bytecar[op] = (byte) ((digit / 10) - 10); // calculate borrow [NB: - after %]\r
+            }\r
+        }/* op */\r
+        return work;\r
+    }\r
+\r
+    /*\r
+     * <sgml> Create a copy of BigDecimal object for local use. <p>This does NOT make a copy of the mantissa array.\r
+     * </sgml> Arg1 is the BigDecimal to clone (non-null)\r
+     */\r
+\r
+    private static final com.ibm.icu.math.BigDecimal clone(com.ibm.icu.math.BigDecimal dec) {\r
+        com.ibm.icu.math.BigDecimal copy;\r
+        copy = new com.ibm.icu.math.BigDecimal();\r
+        copy.ind = dec.ind;\r
+        copy.exp = dec.exp;\r
+        copy.form = dec.form;\r
+        copy.mant = dec.mant;\r
+        return copy;\r
+    }\r
+\r
+    /*\r
+     * <sgml> Check one or two numbers for lost digits. </sgml> Arg1 is RHS (or null, if none) Arg2 is current DIGITS\r
+     * setting returns quietly or throws an exception\r
+     */\r
+\r
+    private void checkdigits(com.ibm.icu.math.BigDecimal rhs, int dig) {\r
+        if (dig == 0)\r
+            return; // don't check if digits=0\r
+        // first check lhs...\r
+        if (this.mant.length > dig)\r
+            if ((!(allzero(this.mant, dig))))\r
+                throw new java.lang.ArithmeticException("Too many digits:" + " " + this.toString());\r
+        if (rhs == null)\r
+            return; // monadic\r
+        if (rhs.mant.length > dig)\r
+            if ((!(allzero(rhs.mant, dig))))\r
+                throw new java.lang.ArithmeticException("Too many digits:" + " " + rhs.toString());\r
+    }\r
+\r
+    /*\r
+     * <sgml> Round to specified digits, if necessary. </sgml> Arg1 is requested MathContext [with length and rounding\r
+     * mode] returns this, for convenience\r
+     */\r
+\r
+    private com.ibm.icu.math.BigDecimal round(com.ibm.icu.math.MathContext set) {\r
+        return round(set.digits, set.roundingMode);\r
+    }\r
+\r
+    /*\r
+     * <sgml> Round to specified digits, if necessary. Arg1 is requested length (digits to round to) [may be <=0 when\r
+     * called from format, dodivide, etc.] Arg2 is rounding mode returns this, for convenience\r
+     * \r
+     * ind and exp are adjusted, but not cleared for a mantissa of zero\r
+     * \r
+     * The length of the mantissa returned will be Arg1, except when Arg1 is 0, in which case the returned mantissa\r
+     * length will be 1. </sgml>\r
+     */\r
+\r
+    private com.ibm.icu.math.BigDecimal round(int len, int mode) {\r
+        int adjust;\r
+        int sign;\r
+        byte oldmant[];\r
+        boolean reuse = false;\r
+        byte first = 0;\r
+        int increment;\r
+        byte newmant[] = null;\r
+        adjust = mant.length - len;\r
+        if (adjust <= 0)\r
+            return this; // nowt to do\r
+\r
+        exp = exp + adjust; // exponent of result\r
+        sign = (int) ind; // save [assumes -1, 0, 1]\r
+        oldmant = mant; // save\r
+        if (len > 0) {\r
+            // remove the unwanted digits\r
+            mant = new byte[len];\r
+            java.lang.System.arraycopy((java.lang.Object) oldmant, 0, (java.lang.Object) mant, 0, len);\r
+            reuse = true; // can reuse mantissa\r
+            first = oldmant[len]; // first of discarded digits\r
+        } else {/* len<=0 */\r
+            mant = ZERO.mant;\r
+            ind = iszero;\r
+            reuse = false; // cannot reuse mantissa\r
+            if (len == 0)\r
+                first = oldmant[0];\r
+            else\r
+                first = (byte) 0; // [virtual digit]\r
+        }\r
+\r
+        // decide rounding adjustment depending on mode, sign, and discarded digits\r
+        increment = 0; // bumper\r
+        {\r
+            do {/* select */\r
+                if (mode == ROUND_HALF_UP) { // default first [most common]\r
+                    if (first >= 5)\r
+                        increment = sign;\r
+                } else if (mode == ROUND_UNNECESSARY) { // default for setScale()\r
+                    // discarding any non-zero digits is an error\r
+                    if ((!(allzero(oldmant, len))))\r
+                        throw new java.lang.ArithmeticException("Rounding necessary");\r
+                } else if (mode == ROUND_HALF_DOWN) { // 0.5000 goes down\r
+                    if (first > 5)\r
+                        increment = sign;\r
+                    else if (first == 5)\r
+                        if ((!(allzero(oldmant, len + 1))))\r
+                            increment = sign;\r
+                } else if (mode == ROUND_HALF_EVEN) { // 0.5000 goes down if left digit even\r
+                    if (first > 5)\r
+                        increment = sign;\r
+                    else if (first == 5) {\r
+                        if ((!(allzero(oldmant, len + 1))))\r
+                            increment = sign;\r
+                        else /* 0.5000 */\r
+                        if ((((mant[mant.length - 1]) % 2)) == 1)\r
+                            increment = sign;\r
+                    }\r
+                } else if (mode == ROUND_DOWN) {\r
+                    // never increment\r
+                } else if (mode == ROUND_UP) { // increment if discarded non-zero\r
+                    if ((!(allzero(oldmant, len))))\r
+                        increment = sign;\r
+                } else if (mode == ROUND_CEILING) { // more positive\r
+                    if (sign > 0)\r
+                        if ((!(allzero(oldmant, len))))\r
+                            increment = sign;\r
+                } else if (mode == ROUND_FLOOR) { // more negative\r
+                    if (sign < 0)\r
+                        if ((!(allzero(oldmant, len))))\r
+                            increment = sign;\r
+                } else {\r
+                    throw new java.lang.IllegalArgumentException("Bad round value:" + " " + mode);\r
+                }\r
+            } while (false);\r
+        }/* modes */\r
+\r
+        if (increment != 0) {\r
+            do {\r
+                if (ind == iszero) {\r
+                    // we must not subtract from 0, but result is trivial anyway\r
+                    mant = ONE.mant;\r
+                    ind = (byte) increment;\r
+                } else {\r
+                    // mantissa is non-0; we can safely add or subtract 1\r
+                    if (ind == isneg)\r
+                        increment = -increment;\r
+                    newmant = byteaddsub(mant, mant.length, ONE.mant, 1, increment, reuse);\r
+                    if (newmant.length > mant.length) { // had a carry\r
+                        // drop rightmost digit and raise exponent\r
+                        exp++;\r
+                        // mant is already the correct length\r
+                        java.lang.System.arraycopy((java.lang.Object) newmant, 0, (java.lang.Object) mant, 0,\r
+                                mant.length);\r
+                    } else\r
+                        mant = newmant;\r
+                }\r
+            } while (false);\r
+        }/* bump */\r
+        // rounding can increase exponent significantly\r
+        if (exp > MaxExp)\r
+            throw new java.lang.ArithmeticException("Exponent Overflow:" + " " + exp);\r
+        return this;\r
+    }\r
+\r
+    /*\r
+     * <sgml> Test if rightmost digits are all 0. Arg1 is a mantissa array to test Arg2 is the offset of first digit to\r
+     * check [may be negative; if so, digits to left are 0's] returns 1 if all the digits starting at Arg2 are 0\r
+     * \r
+     * Arg2 may be beyond array bounds, in which case 1 is returned </sgml>\r
+     */\r
+\r
+    private static final boolean allzero(byte array[], int start) {\r
+        int i = 0;\r
+        if (start < 0)\r
+            start = 0;\r
+        {\r
+            int $25 = array.length - 1;\r
+            i = start;\r
+            for (; i <= $25; i++) {\r
+                if (array[i] != 0)\r
+                    return false;\r
+            }\r
+        }/* i */\r
+        return true;\r
+    }\r
+\r
+    /*\r
+     * <sgml> Carry out final checks and canonicalization <p> This finishes off the current number by: 1. Rounding if\r
+     * necessary (NB: length includes leading zeros) 2. Stripping trailing zeros (if requested and \PLAIN) 3. Stripping\r
+     * leading zeros (always) 4. Selecting exponential notation (if required) 5. Converting a zero result to just '0'\r
+     * (if \PLAIN) In practice, these operations overlap and share code. It always sets form. </sgml> Arg1 is requested\r
+     * MathContext (length to round to, trigger, and FORM) Arg2 is 1 if trailing insignificant zeros should be removed\r
+     * after round (for division, etc.), provided that set.form isn't PLAIN. returns this, for convenience\r
+     */\r
+\r
+    private com.ibm.icu.math.BigDecimal finish(com.ibm.icu.math.MathContext set, boolean strip) {\r
+        int d = 0;\r
+        int i = 0;\r
+        byte newmant[] = null;\r
+        int mag = 0;\r
+        int sig = 0;\r
+        /* Round if mantissa too long and digits requested */\r
+        if (set.digits != 0)\r
+            if (this.mant.length > set.digits)\r
+                this.round(set);\r
+\r
+        /*\r
+         * If strip requested (and standard formatting), remove insignificant trailing zeros.\r
+         */\r
+        if (strip)\r
+            if (set.form != com.ibm.icu.math.MathContext.PLAIN) {\r
+                d = this.mant.length;\r
+                /* see if we need to drop any trailing zeros */\r
+                {\r
+                    i = d - 1;\r
+                    i: for (; i >= 1; i--) {\r
+                        if (this.mant[i] != 0)\r
+                            break i;\r
+                        d--;\r
+                        exp++;\r
+                    }\r
+                }/* i */\r
+                if (d < this.mant.length) {/* need to reduce */\r
+                    newmant = new byte[d];\r
+                    java.lang.System.arraycopy((java.lang.Object) this.mant, 0, (java.lang.Object) newmant, 0, d);\r
+                    this.mant = newmant;\r
+                }\r
+            }\r
+\r
+        form = (byte) com.ibm.icu.math.MathContext.PLAIN; // preset\r
+\r
+        /* Now check for leading- and all- zeros in mantissa */\r
+        {\r
+            int $26 = this.mant.length;\r
+            i = 0;\r
+            for (; $26 > 0; $26--, i++) {\r
+                if (this.mant[i] != 0) {\r
+                    // non-0 result; ind will be correct\r
+                    // remove leading zeros [e.g., after subtract]\r
+                    if (i > 0) {\r
+                        do {\r
+                            newmant = new byte[this.mant.length - i];\r
+                            java.lang.System.arraycopy((java.lang.Object) this.mant, i, (java.lang.Object) newmant, 0,\r
+                                    this.mant.length - i);\r
+                            this.mant = newmant;\r
+                        } while (false);\r
+                    }/* delead */\r
+                    // now determine form if not PLAIN\r
+                    mag = exp + mant.length;\r
+                    if (mag > 0) { // most common path\r
+                        if (mag > set.digits)\r
+                            if (set.digits != 0)\r
+                                form = (byte) set.form;\r
+                        if ((mag - 1) <= MaxExp)\r
+                            return this; // no overflow; quick return\r
+                    } else if (mag < (-5))\r
+                        form = (byte) set.form;\r
+                    /* check for overflow */\r
+                    mag--;\r
+                    if ((mag < MinExp) | (mag > MaxExp)) {\r
+                        overflow: do {\r
+                            // possible reprieve if form is engineering\r
+                            if (form == com.ibm.icu.math.MathContext.ENGINEERING) {\r
+                                sig = mag % 3; // leftover\r
+                                if (sig < 0)\r
+                                    sig = 3 + sig; // negative exponent\r
+                                mag = mag - sig; // exponent to use\r
+                                // 1999.06.29: second test here must be MaxExp\r
+                                if (mag >= MinExp)\r
+                                    if (mag <= MaxExp)\r
+                                        break overflow;\r
+                            }\r
+                            throw new java.lang.ArithmeticException("Exponent Overflow:" + " " + mag);\r
+                        } while (false);\r
+                    }/* overflow */\r
+                    return this;\r
+                }\r
+            }\r
+        }/* i */\r
+\r
+        // Drop through to here only if mantissa is all zeros\r
+        ind = iszero;\r
+        {/* select */\r
+            if (set.form != com.ibm.icu.math.MathContext.PLAIN)\r
+                exp = 0; // standard result; go to '0'\r
+            else if (exp > 0)\r
+                exp = 0; // +ve exponent also goes to '0'\r
+            else {\r
+                // a plain number with -ve exponent; preserve and check exponent\r
+                if (exp < MinExp)\r
+                    throw new java.lang.ArithmeticException("Exponent Overflow:" + " " + exp);\r
+            }\r
+        }\r
+        mant = ZERO.mant; // canonical mantissa\r
+        return this;\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/MathContext.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/math/MathContext.java
new file mode 100644 (file)
index 0000000..f7d2032
--- /dev/null
@@ -0,0 +1,601 @@
+/* Generated from 'MathContext.nrx' 8 Sep 2000 11:07:48 [v2.00] */\r
+/* Options: Binary Comments Crossref Format Java Logo Strictargs Strictcase Trace2 Verbose3 */\r
+package com.ibm.icu.math;\r
+\r
+/* ------------------------------------------------------------------ */\r
+/* MathContext -- Math context settings                               */\r
+/* ------------------------------------------------------------------ */\r
+/* Copyright IBM Corporation, 1997-2011.  All Rights Reserved.        */\r
+/*                                                                    */\r
+/*   The MathContext object encapsulates the settings used by the     */\r
+/*   BigDecimal class; it could also be used by other arithmetics.    */\r
+/* ------------------------------------------------------------------ */\r
+/* Notes:                                                             */\r
+/*                                                                    */\r
+/* 1. The properties are checked for validity on construction, so     */\r
+/*    the BigDecimal class may assume that they are correct.          */\r
+/* ------------------------------------------------------------------ */\r
+/* Author:    Mike Cowlishaw                                          */\r
+/* 1997.09.03 Initial version (edited from netrexx.lang.RexxSet)      */\r
+/* 1997.09.12 Add lostDigits property                                 */\r
+/* 1998.05.02 Make the class immutable and final; drop set methods    */\r
+/* 1998.06.05 Add Round (rounding modes) property                     */\r
+/* 1998.06.25 Rename from DecimalContext; allow digits=0              */\r
+/* 1998.10.12 change to com.ibm.icu.math package                          */\r
+/* 1999.02.06 add javadoc comments                                    */\r
+/* 1999.03.05 simplify; changes from discussion with J. Bloch         */\r
+/* 1999.03.13 1.00 release to IBM Centre for Java Technology          */\r
+/* 1999.07.10 1.04 flag serialization unused                          */\r
+/* 2000.01.01 1.06 copyright update                                   */\r
+/* ------------------------------------------------------------------ */\r
+\r
+\r
+\r
+\r
+/**\r
+ * The <code>MathContext</code> immutable class encapsulates the\r
+ * settings understood by the operator methods of the {@link BigDecimal}\r
+ * class (and potentially other classes).  Operator methods are those\r
+ * that effect an operation on a number or a pair of numbers.\r
+ * <p>\r
+ * The settings, which are not base-dependent, comprise:\r
+ * <ol>\r
+ * <li><code>digits</code>:\r
+ * the number of digits (precision) to be used for an operation\r
+ * <li><code>form</code>:\r
+ * the form of any exponent that results from the operation\r
+ * <li><code>lostDigits</code>:\r
+ * whether checking for lost digits is enabled\r
+ * <li><code>roundingMode</code>:\r
+ * the algorithm to be used for rounding.\r
+ * </ol>\r
+ * <p>\r
+ * When provided, a <code>MathContext</code> object supplies the\r
+ * settings for an operation directly.\r
+ * <p>\r
+ * When <code>MathContext.DEFAULT</code> is provided for a\r
+ * <code>MathContext</code> parameter then the default settings are used\r
+ * (<code>9, SCIENTIFIC, false, ROUND_HALF_UP</code>).\r
+ * <p>\r
+ * In the <code>BigDecimal</code> class, all methods which accept a\r
+ * <code>MathContext</code> object defaults) also have a version of the\r
+ * method which does not accept a MathContext parameter.  These versions\r
+ * carry out unlimited precision fixed point arithmetic (as though the\r
+ * settings were (<code>0, PLAIN, false, ROUND_HALF_UP</code>).\r
+ * <p>\r
+ * The instance variables are shared with default access (so they are\r
+ * directly accessible to the <code>BigDecimal</code> class), but must\r
+ * never be changed.\r
+ * <p>\r
+ * The rounding mode constants have the same names and values as the\r
+ * constants of the same name in <code>java.math.BigDecimal</code>, to\r
+ * maintain compatibility with earlier versions of\r
+ * <code>BigDecimal</code>.\r
+ *\r
+ * @see     BigDecimal\r
+ * @author  Mike Cowlishaw\r
+ * @stable ICU 2.0\r
+ */\r
+\r
+public final class MathContext implements java.io.Serializable{\r
+ //private static final java.lang.String $0="MathContext.nrx";\r
\r
+ /* ----- Properties ----- */\r
+ /* properties public constant */\r
+ /**\r
+  * Plain (fixed point) notation, without any exponent.\r
+  * Used as a setting to control the form of the result of a\r
+  * <code>BigDecimal</code> operation.\r
+  * A zero result in plain form may have a decimal part of one or\r
+  * more zeros.\r
+  *\r
+  * @see #ENGINEERING\r
+  * @see #SCIENTIFIC\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int PLAIN=0; // [no exponent]\r
\r
+ /**\r
+  * Standard floating point notation (with scientific exponential\r
+  * format, where there is one digit before any decimal point).\r
+  * Used as a setting to control the form of the result of a\r
+  * <code>BigDecimal</code> operation.\r
+  * A zero result in plain form may have a decimal part of one or\r
+  * more zeros.\r
+  *\r
+  * @see #ENGINEERING\r
+  * @see #PLAIN\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int SCIENTIFIC=1; // 1 digit before .\r
\r
+ /**\r
+  * Standard floating point notation (with engineering exponential\r
+  * format, where the power of ten is a multiple of 3).\r
+  * Used as a setting to control the form of the result of a\r
+  * <code>BigDecimal</code> operation.\r
+  * A zero result in plain form may have a decimal part of one or\r
+  * more zeros.\r
+  *\r
+  * @see #PLAIN\r
+  * @see #SCIENTIFIC\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ENGINEERING=2; // 1-3 digits before .\r
\r
+ // The rounding modes match the original BigDecimal class values\r
+ /**\r
+  * Rounding mode to round to a more positive number.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * If any of the discarded digits are non-zero then the result\r
+  * should be rounded towards the next more positive digit.\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_CEILING=2;\r
\r
+ /**\r
+  * Rounding mode to round towards zero.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * All discarded digits are ignored (truncated).  The result is\r
+  * neither incremented nor decremented.\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_DOWN=1;\r
\r
+ /**\r
+  * Rounding mode to round to a more negative number.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * If any of the discarded digits are non-zero then the result\r
+  * should be rounded towards the next more negative digit.\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_FLOOR=3;\r
\r
+ /**\r
+  * Rounding mode to round to nearest neighbor, where an equidistant\r
+  * value is rounded down.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * If the discarded digits represent greater than half (0.5 times)\r
+  * the value of a one in the next position then the result should be\r
+  * rounded up (away from zero).  Otherwise the discarded digits are\r
+  * ignored.\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_HALF_DOWN=5;\r
\r
+ /**\r
+  * Rounding mode to round to nearest neighbor, where an equidistant\r
+  * value is rounded to the nearest even neighbor.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * If the discarded digits represent greater than half (0.5 times)\r
+  * the value of a one in the next position then the result should be\r
+  * rounded up (away from zero).  If they represent less than half,\r
+  * then the result should be rounded down.\r
+  * <p>\r
+  * Otherwise (they represent exactly half) the result is rounded\r
+  * down if its rightmost digit is even, or rounded up if its\r
+  * rightmost digit is odd (to make an even digit).\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_HALF_EVEN=6;\r
\r
+ /**\r
+  * Rounding mode to round to nearest neighbor, where an equidistant\r
+  * value is rounded up.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * If the discarded digits represent greater than or equal to half\r
+  * (0.5 times) the value of a one in the next position then the result\r
+  * should be rounded up (away from zero).  Otherwise the discarded\r
+  * digits are ignored.\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_HALF_UP=4;\r
\r
+ /**\r
+  * Rounding mode to assert that no rounding is necessary.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * Rounding (potential loss of information) is not permitted.\r
+  * If any of the discarded digits are non-zero then an\r
+  * <code>ArithmeticException</code> should be thrown.\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_UNNECESSARY=7;\r
\r
+ /**\r
+  * Rounding mode to round away from zero.\r
+  * Used as a setting to control the rounding mode used during a\r
+  * <code>BigDecimal</code> operation.\r
+  * <p>\r
+  * If any of the discarded digits are non-zero then the result will\r
+  * be rounded up (away from zero).\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final int ROUND_UP=0;\r
\r
\r
+ /* properties shared */\r
+ /**\r
+  * The number of digits (precision) to be used for an operation.\r
+  * A value of 0 indicates that unlimited precision (as many digits\r
+  * as are required) will be used.\r
+  * <p>\r
+  * The {@link BigDecimal} operator methods use this value to\r
+  * determine the precision of results.\r
+  * Note that leading zeros (in the integer part of a number) are\r
+  * never significant.\r
+  * <p>\r
+  * <code>digits</code> will always be non-negative.\r
+  *\r
+  * @serial\r
+  */\r
+ int digits;\r
\r
+ /**\r
+  * The form of results from an operation.\r
+  * <p>\r
+  * The {@link BigDecimal} operator methods use this value to\r
+  * determine the form of results, in particular whether and how\r
+  * exponential notation should be used.\r
+  *\r
+  * @see #ENGINEERING\r
+  * @see #PLAIN\r
+  * @see #SCIENTIFIC\r
+  * @serial\r
+  */\r
+ int form; // values for this must fit in a byte\r
\r
+ /**\r
+  * Controls whether lost digits checking is enabled for an\r
+  * operation.\r
+  * Set to <code>true</code> to enable checking, or\r
+  * to <code>false</code> to disable checking.\r
+  * <p>\r
+  * When enabled, the {@link BigDecimal} operator methods check\r
+  * the precision of their operand or operands, and throw an\r
+  * <code>ArithmeticException</code> if an operand is more precise\r
+  * than the digits setting (that is, digits would be lost).\r
+  * When disabled, operands are rounded to the specified digits.\r
+  *\r
+  * @serial\r
+  */\r
+ boolean lostDigits;\r
\r
+ /**\r
+  * The rounding algorithm to be used for an operation.\r
+  * <p>\r
+  * The {@link BigDecimal} operator methods use this value to\r
+  * determine the algorithm to be used when non-zero digits have to\r
+  * be discarded in order to reduce the precision of a result.\r
+  * The value must be one of the public constants whose name starts\r
+  * with <code>ROUND_</code>.\r
+  *\r
+  * @see #ROUND_CEILING\r
+  * @see #ROUND_DOWN\r
+  * @see #ROUND_FLOOR\r
+  * @see #ROUND_HALF_DOWN\r
+  * @see #ROUND_HALF_EVEN\r
+  * @see #ROUND_HALF_UP\r
+  * @see #ROUND_UNNECESSARY\r
+  * @see #ROUND_UP\r
+  * @serial\r
+  */\r
+ int roundingMode;\r
\r
+ /* properties private constant */\r
+ // default settings\r
+ private static final int DEFAULT_FORM=SCIENTIFIC;\r
+ private static final int DEFAULT_DIGITS=9;\r
+ private static final boolean DEFAULT_LOSTDIGITS=false;\r
+ private static final int DEFAULT_ROUNDINGMODE=ROUND_HALF_UP;\r
\r
+ /* properties private constant */\r
\r
+ private static final int MIN_DIGITS=0; // smallest value for DIGITS.\r
+ private static final int MAX_DIGITS=999999999; // largest value for DIGITS.  If increased,\r
+ // the BigDecimal class may need update.\r
+ // list of valid rounding mode values, most common two first\r
+ private static final int ROUNDS[]=new int[]{ROUND_HALF_UP,ROUND_UNNECESSARY,ROUND_CEILING,ROUND_DOWN,ROUND_FLOOR,ROUND_HALF_DOWN,ROUND_HALF_EVEN,ROUND_UP};\r
\r
\r
+ private static final java.lang.String ROUNDWORDS[]=new java.lang.String[]{"ROUND_HALF_UP","ROUND_UNNECESSARY","ROUND_CEILING","ROUND_DOWN","ROUND_FLOOR","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_UP"}; // matching names of the ROUNDS values\r
\r
\r
\r
\r
+ /* properties private constant unused */\r
\r
+ // Serialization version\r
+ private static final long serialVersionUID=7163376998892515376L;\r
\r
+ /* properties public constant */\r
+ /**\r
+  * A <code>MathContext</code> object initialized to the default\r
+  * settings for general-purpose arithmetic.  That is,\r
+  * <code>digits=9 form=SCIENTIFIC lostDigits=false\r
+  * roundingMode=ROUND_HALF_UP</code>.\r
+  *\r
+  * @see #SCIENTIFIC\r
+  * @see #ROUND_HALF_UP\r
+  * @stable ICU 2.0\r
+  */\r
+ public static final com.ibm.icu.math.MathContext DEFAULT=new com.ibm.icu.math.MathContext(DEFAULT_DIGITS,DEFAULT_FORM,DEFAULT_LOSTDIGITS,DEFAULT_ROUNDINGMODE);\r
+\r
\r
\r
\r
+ /* ----- Constructors ----- */\r
\r
+ /**\r
+  * Constructs a new <code>MathContext</code> with a specified\r
+  * precision.\r
+  * The other settings are set to the default values\r
+  * (see {@link #DEFAULT}).\r
+  *\r
+  * An <code>IllegalArgumentException</code> is thrown if the\r
+  * <code>setdigits</code> parameter is out of range\r
+  * (&lt;0 or &gt;999999999).\r
+  *\r
+  * @param setdigits     The <code>int</code> digits setting\r
+  *                      for this <code>MathContext</code>.\r
+  * @throws IllegalArgumentException parameter out of range.\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public MathContext(int setdigits){\r
+  this(setdigits,DEFAULT_FORM,DEFAULT_LOSTDIGITS,DEFAULT_ROUNDINGMODE);\r
+  return;}\r
+\r
\r
+ /**\r
+  * Constructs a new <code>MathContext</code> with a specified\r
+  * precision and form.\r
+  * The other settings are set to the default values\r
+  * (see {@link #DEFAULT}).\r
+  *\r
+  * An <code>IllegalArgumentException</code> is thrown if the\r
+  * <code>setdigits</code> parameter is out of range\r
+  * (&lt;0 or &gt;999999999), or if the value given for the\r
+  * <code>setform</code> parameter is not one of the appropriate\r
+  * constants.\r
+  *\r
+  * @param setdigits     The <code>int</code> digits setting\r
+  *                      for this <code>MathContext</code>.\r
+  * @param setform       The <code>int</code> form setting\r
+  *                      for this <code>MathContext</code>.\r
+  * @throws IllegalArgumentException parameter out of range.\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public MathContext(int setdigits,int setform){\r
+  this(setdigits,setform,DEFAULT_LOSTDIGITS,DEFAULT_ROUNDINGMODE);\r
+  return;}\r
+\r
+ /**\r
+  * Constructs a new <code>MathContext</code> with a specified\r
+  * precision, form, and lostDigits setting.\r
+  * The roundingMode setting is set to its default value\r
+  * (see {@link #DEFAULT}).\r
+  *\r
+  * An <code>IllegalArgumentException</code> is thrown if the\r
+  * <code>setdigits</code> parameter is out of range\r
+  * (&lt;0 or &gt;999999999), or if the value given for the\r
+  * <code>setform</code> parameter is not one of the appropriate\r
+  * constants.\r
+  *\r
+  * @param setdigits     The <code>int</code> digits setting\r
+  *                      for this <code>MathContext</code>.\r
+  * @param setform       The <code>int</code> form setting\r
+  *                      for this <code>MathContext</code>.\r
+  * @param setlostdigits The <code>boolean</code> lostDigits\r
+  *                      setting for this <code>MathContext</code>.\r
+  * @throws IllegalArgumentException parameter out of range.\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public MathContext(int setdigits,int setform,boolean setlostdigits){\r
+  this(setdigits,setform,setlostdigits,DEFAULT_ROUNDINGMODE);\r
+  return;}\r
+\r
+ /**\r
+  * Constructs a new <code>MathContext</code> with a specified\r
+  * precision, form, lostDigits, and roundingMode setting.\r
+  *\r
+  * An <code>IllegalArgumentException</code> is thrown if the\r
+  * <code>setdigits</code> parameter is out of range\r
+  * (&lt;0 or &gt;999999999), or if the value given for the\r
+  * <code>setform</code> or <code>setroundingmode</code> parameters is\r
+  * not one of the appropriate constants.\r
+  *\r
+  * @param setdigits       The <code>int</code> digits setting\r
+  *                        for this <code>MathContext</code>.\r
+  * @param setform         The <code>int</code> form setting\r
+  *                        for this <code>MathContext</code>.\r
+  * @param setlostdigits   The <code>boolean</code> lostDigits\r
+  *                        setting for this <code>MathContext</code>.\r
+  * @param setroundingmode The <code>int</code> roundingMode setting\r
+  *                        for this <code>MathContext</code>.\r
+  * @throws IllegalArgumentException parameter out of range.\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public MathContext(int setdigits,int setform,boolean setlostdigits,int setroundingmode){super();\r
+  \r
+  \r
+  // set values, after checking\r
+  if (setdigits!=DEFAULT_DIGITS) \r
+   {\r
+    if (setdigits<MIN_DIGITS) \r
+     throw new java.lang.IllegalArgumentException("Digits too small:"+" "+setdigits);\r
+    if (setdigits>MAX_DIGITS) \r
+     throw new java.lang.IllegalArgumentException("Digits too large:"+" "+setdigits);\r
+   }\r
+  {/*select*/\r
+  if (setform==SCIENTIFIC){\r
+   // [most common]\r
+  }else if (setform==ENGINEERING){\r
+  }else if (setform==PLAIN){\r
+  }else{\r
+   throw new java.lang.IllegalArgumentException("Bad form value:"+" "+setform);\r
+  }\r
+  }\r
+  if ((!(isValidRound(setroundingmode)))) \r
+   throw new java.lang.IllegalArgumentException("Bad roundingMode value:"+" "+setroundingmode);\r
+  digits=setdigits;\r
+  form=setform;\r
+  lostDigits=setlostdigits; // [no bad value possible]\r
+  roundingMode=setroundingmode;\r
+  return;}\r
+\r
+ /**\r
+  * Returns the digits setting.\r
+  * This value is always non-negative.\r
+  *\r
+  * @return an <code>int</code> which is the value of the digits\r
+  *         setting\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public int getDigits(){\r
+  return digits;\r
+  }\r
+\r
+ /**\r
+  * Returns the form setting.\r
+  * This will be one of\r
+  * {@link #ENGINEERING},\r
+  * {@link #PLAIN}, or\r
+  * {@link #SCIENTIFIC}.\r
+  *\r
+  * @return an <code>int</code> which is the value of the form setting\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public int getForm(){\r
+  return form;\r
+  }\r
+\r
+ /**\r
+  * Returns the lostDigits setting.\r
+  * This will be either <code>true</code> (enabled) or\r
+  * <code>false</code> (disabled).\r
+  *\r
+  * @return a <code>boolean</code> which is the value of the lostDigits\r
+  *           setting\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public boolean getLostDigits(){\r
+  return lostDigits;\r
+  }\r
+\r
+ /**\r
+  * Returns the roundingMode setting.\r
+  * This will be one of\r
+  * {@link  #ROUND_CEILING},\r
+  * {@link  #ROUND_DOWN},\r
+  * {@link  #ROUND_FLOOR},\r
+  * {@link  #ROUND_HALF_DOWN},\r
+  * {@link  #ROUND_HALF_EVEN},\r
+  * {@link  #ROUND_HALF_UP},\r
+  * {@link  #ROUND_UNNECESSARY}, or\r
+  * {@link  #ROUND_UP}.\r
+  *\r
+  * @return an <code>int</code> which is the value of the roundingMode\r
+  *         setting\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public int getRoundingMode(){\r
+  return roundingMode;\r
+  }\r
+\r
+ /** Returns the <code>MathContext</code> as a readable string.\r
+  * The <code>String</code> returned represents the settings of the\r
+  * <code>MathContext</code> object as four blank-delimited words\r
+  * separated by a single blank and with no leading or trailing blanks,\r
+  * as follows:\r
+  * <ol>\r
+  * <li>\r
+  * <code>digits=</code>, immediately followed by\r
+  * the value of the digits setting as a numeric word.\r
+  * <li>\r
+  * <code>form=</code>, immediately followed by\r
+  * the value of the form setting as an uppercase word\r
+  * (one of <code>SCIENTIFIC</code>, <code>PLAIN</code>, or\r
+  * <code>ENGINEERING</code>).\r
+  * <li>\r
+  * <code>lostDigits=</code>, immediately followed by\r
+  * the value of the lostDigits setting\r
+  * (<code>1</code> if enabled, <code>0</code> if disabled).\r
+  * <li>\r
+  * <code>roundingMode=</code>, immediately followed by\r
+  * the value of the roundingMode setting as a word.\r
+  * This word will be the same as the name of the corresponding public\r
+  * constant.\r
+  * </ol>\r
+  * <p>\r
+  * For example:\r
+  * <br><code>\r
+  * digits=9 form=SCIENTIFIC lostDigits=0 roundingMode=ROUND_HALF_UP\r
+  * </code>\r
+  * <p>\r
+  * Additional words may be appended to the result of\r
+  * <code>toString</code> in the future if more properties are added\r
+  * to the class.\r
+  *\r
+  * @return a <code>String</code> representing the context settings.\r
+  * @stable ICU 2.0\r
+  */\r
\r
+ public java.lang.String toString(){\r
+  java.lang.String formstr=null;\r
+  int r=0;\r
+  java.lang.String roundword=null;\r
+  {/*select*/\r
+  if (form==SCIENTIFIC)\r
+   formstr="SCIENTIFIC";\r
+  else if (form==ENGINEERING)\r
+   formstr="ENGINEERING";\r
+  else{\r
+   formstr="PLAIN";/* form=PLAIN */\r
+  }\r
+  }\r
+  {int $1=ROUNDS.length;r=0;r:for(;$1>0;$1--,r++){\r
+   if (roundingMode==ROUNDS[r]) \r
+    {\r
+     roundword=ROUNDWORDS[r];\r
+     break r;\r
+    }\r
+   }\r
+  }/*r*/\r
+  return "digits="+digits+" "+"form="+formstr+" "+"lostDigits="+(lostDigits?"1":"0")+" "+"roundingMode="+roundword;\r
+  }\r
+\r
\r
+ /* <sgml> Test whether round is valid. </sgml> */\r
+ // This could be made shared for use by BigDecimal for setScale.\r
\r
+ private static boolean isValidRound(int testround){\r
+  int r=0;\r
+  {int $2=ROUNDS.length;for(r=0;$2>0;$2--,r++){\r
+   if (testround==ROUNDS[r]) \r
+    return true;\r
+   }\r
+  }/*r*/\r
+  return false;\r
+  }\r
+ }\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Bidi.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Bidi.java
new file mode 100644 (file)
index 0000000..cb72af4
--- /dev/null
@@ -0,0 +1,2586 @@
+/*\r
+*******************************************************************************\r
+*   Copyright (C) 2001-2011, International Business Machines\r
+*   Corporation and others.  All Rights Reserved.\r
+*******************************************************************************\r
+*/\r
+\r
+/* FOOD FOR THOUGHT: currently the reordering modes are a mixture of\r
+ * algorithm for direct BiDi, algorithm for inverse Bidi and the bizarre\r
+ * concept of RUNS_ONLY which is a double operation.\r
+ * It could be advantageous to divide this into 3 concepts:\r
+ * a) Operation: direct / inverse / RUNS_ONLY\r
+ * b) Direct algorithm: default / NUMBERS_SPECIAL / GROUP_NUMBERS_WITH_L\r
+ * c) Inverse algorithm: default / INVERSE_LIKE_DIRECT / NUMBERS_SPECIAL\r
+ * This would allow combinations not possible today like RUNS_ONLY with\r
+ * NUMBERS_SPECIAL.\r
+ * Also allow to set INSERT_MARKS for the direct step of RUNS_ONLY and\r
+ * REMOVE_CONTROLS for the inverse step.\r
+ * Not all combinations would be supported, and probably not all do make sense.\r
+ * This would need to document which ones are supported and what are the\r
+ * fallbacks for unsupported combinations.\r
+ */\r
+\r
+//TODO: make sample program do something simple but real and complete\r
+\r
+package com.ibm.icu.text;\r
+\r
+import java.text.AttributedCharacterIterator;\r
+\r
+/**\r
+ *\r
+ * <h2>Bidi algorithm for ICU</h2>\r
+ *\r
+ * This is an implementation of the Unicode Bidirectional algorithm. The\r
+ * algorithm is defined in the <a\r
+ * href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,\r
+ * version 13, also described in The Unicode Standard, Version 4.0 .\r
+ * <p>\r
+ *\r
+ * Note: Libraries that perform a bidirectional algorithm and reorder strings\r
+ * accordingly are sometimes called "Storage Layout Engines". ICU's Bidi and\r
+ * shaping (ArabicShaping) classes can be used at the core of such "Storage\r
+ * Layout Engines".\r
+ *\r
+ * <h3>General remarks about the API:</h3>\r
+ *\r
+ * The &quot;limit&quot; of a sequence of characters is the position just after\r
+ * their last character, i.e., one more than that position.\r
+ * <p>\r
+ *\r
+ * Some of the API methods provide access to &quot;runs&quot;. Such a\r
+ * &quot;run&quot; is defined as a sequence of characters that are at the same\r
+ * embedding level after performing the Bidi algorithm.\r
+ * <p>\r
+ *\r
+ * <h3>Basic concept: paragraph</h3>\r
+ * A piece of text can be divided into several paragraphs by characters\r
+ * with the Bidi class <code>Block Separator</code>. For handling of\r
+ * paragraphs, see:\r
+ * <ul>\r
+ * <li>{@link #countParagraphs}\r
+ * <li>{@link #getParaLevel}\r
+ * <li>{@link #getParagraph}\r
+ * <li>{@link #getParagraphByIndex}\r
+ * </ul>\r
+ *\r
+ * <h3>Basic concept: text direction</h3>\r
+ * The direction of a piece of text may be:\r
+ * <ul>\r
+ * <li>{@link #LTR}\r
+ * <li>{@link #RTL}\r
+ * <li>{@link #MIXED}\r
+ * </ul>\r
+ *\r
+ * <h3>Basic concept: levels</h3>\r
+ *\r
+ * Levels in this API represent embedding levels according to the Unicode\r
+ * Bidirectional Algorithm.\r
+ * Their low-order bit (even/odd value) indicates the visual direction.<p>\r
+ *\r
+ * Levels can be abstract values when used for the\r
+ * <code>paraLevel</code> and <code>embeddingLevels</code>\r
+ * arguments of <code>setPara()</code>; there:\r
+ * <ul>\r
+ * <li>the high-order bit of an <code>embeddingLevels[]</code>\r
+ * value indicates whether the using application is\r
+ * specifying the level of a character to <i>override</i> whatever the\r
+ * Bidi implementation would resolve it to.</li>\r
+ * <li><code>paraLevel</code> can be set to the\r
+ * pseudo-level values <code>LEVEL_DEFAULT_LTR</code>\r
+ * and <code>LEVEL_DEFAULT_RTL</code>.</li>\r
+ * </ul>\r
+ *\r
+ * <p>The related constants are not real, valid level values.\r
+ * <code>DEFAULT_XXX</code> can be used to specify\r
+ * a default for the paragraph level for\r
+ * when the <code>setPara()</code> method\r
+ * shall determine it but there is no\r
+ * strongly typed character in the input.<p>\r
+ *\r
+ * Note that the value for <code>LEVEL_DEFAULT_LTR</code> is even\r
+ * and the one for <code>LEVEL_DEFAULT_RTL</code> is odd,\r
+ * just like with normal LTR and RTL level values -\r
+ * these special values are designed that way. Also, the implementation\r
+ * assumes that MAX_EXPLICIT_LEVEL is odd.\r
+ *\r
+ * <ul><b>See Also:</b>\r
+ * <li>{@link #LEVEL_DEFAULT_LTR}\r
+ * <li>{@link #LEVEL_DEFAULT_RTL}\r
+ * <li>{@link #LEVEL_OVERRIDE}\r
+ * <li>{@link #MAX_EXPLICIT_LEVEL}\r
+ * <li>{@link #setPara}\r
+ * </ul>\r
+ *\r
+ * <h3>Basic concept: Reordering Mode</h3>\r
+ * Reordering mode values indicate which variant of the Bidi algorithm to\r
+ * use.\r
+ *\r
+ * <ul><b>See Also:</b>\r
+ * <li>{@link #setReorderingMode}\r
+ * <li>{@link #REORDER_DEFAULT}\r
+ * <li>{@link #REORDER_NUMBERS_SPECIAL}\r
+ * <li>{@link #REORDER_GROUP_NUMBERS_WITH_R}\r
+ * <li>{@link #REORDER_RUNS_ONLY}\r
+ * <li>{@link #REORDER_INVERSE_NUMBERS_AS_L}\r
+ * <li>{@link #REORDER_INVERSE_LIKE_DIRECT}\r
+ * <li>{@link #REORDER_INVERSE_FOR_NUMBERS_SPECIAL}\r
+ * </ul>\r
+ *\r
+ * <h3>Basic concept: Reordering Options</h3>\r
+ * Reordering options can be applied during Bidi text transformations.\r
+ * <ul><b>See Also:</b>\r
+ * <li>{@link #setReorderingOptions}\r
+ * <li>{@link #OPTION_DEFAULT}\r
+ * <li>{@link #OPTION_INSERT_MARKS}\r
+ * <li>{@link #OPTION_REMOVE_CONTROLS}\r
+ * <li>{@link #OPTION_STREAMING}\r
+ * </ul>\r
+ *\r
+ *\r
+ * @author Simon Montagu, Matitiahu Allouche (ported from C code written by Markus W. Scherer)\r
+ * @stable ICU 3.8\r
+ *\r
+ *\r
+ * <h4> Sample code for the ICU Bidi API </h4>\r
+ *\r
+ * <h5>Rendering a paragraph with the ICU Bidi API</h5>\r
+ *\r
+ * This is (hypothetical) sample code that illustrates how the ICU Bidi API\r
+ * could be used to render a paragraph of text. Rendering code depends highly on\r
+ * the graphics system, therefore this sample code must make a lot of\r
+ * assumptions, which may or may not match any existing graphics system's\r
+ * properties.\r
+ *\r
+ * <p>\r
+ * The basic assumptions are:\r
+ * </p>\r
+ * <ul>\r
+ * <li>Rendering is done from left to right on a horizontal line.</li>\r
+ * <li>A run of single-style, unidirectional text can be rendered at once.\r
+ * </li>\r
+ * <li>Such a run of text is passed to the graphics system with characters\r
+ * (code units) in logical order.</li>\r
+ * <li>The line-breaking algorithm is very complicated and Locale-dependent -\r
+ * and therefore its implementation omitted from this sample code.</li>\r
+ * </ul>\r
+ *\r
+ * <pre>\r
+ *\r
+ *  package com.ibm.icu.dev.test.bidi;\r
+ *\r
+ *  import com.ibm.icu.text.Bidi;\r
+ *  import com.ibm.icu.text.BidiRun;\r
+ *\r
+ *  public class Sample {\r
+ *\r
+ *      static final int styleNormal = 0;\r
+ *      static final int styleSelected = 1;\r
+ *      static final int styleBold = 2;\r
+ *      static final int styleItalics = 4;\r
+ *      static final int styleSuper=8;\r
+ *      static final int styleSub = 16;\r
+ *\r
+ *      static class StyleRun {\r
+ *          int limit;\r
+ *          int style;\r
+ *\r
+ *          public StyleRun(int limit, int style) {\r
+ *              this.limit = limit;\r
+ *              this.style = style;\r
+ *          }\r
+ *      }\r
+ *\r
+ *      static class Bounds {\r
+ *          int start;\r
+ *          int limit;\r
+ *\r
+ *          public Bounds(int start, int limit) {\r
+ *              this.start = start;\r
+ *              this.limit = limit;\r
+ *          }\r
+ *      }\r
+ *\r
+ *      static int getTextWidth(String text, int start, int limit,\r
+ *                              StyleRun[] styleRuns, int styleRunCount) {\r
+ *          // simplistic way to compute the width\r
+ *          return limit - start;\r
+ *      }\r
+ *\r
+ *      // set limit and StyleRun limit for a line\r
+ *      // from text[start] and from styleRuns[styleRunStart]\r
+ *      // using Bidi.getLogicalRun(...)\r
+ *      // returns line width\r
+ *      static int getLineBreak(String text, Bounds line, Bidi para,\r
+ *                              StyleRun styleRuns[], Bounds styleRun) {\r
+ *          // dummy return\r
+ *          return 0;\r
+ *      }\r
+ *\r
+ *      // render runs on a line sequentially, always from left to right\r
+ *\r
+ *      // prepare rendering a new line\r
+ *      static void startLine(byte textDirection, int lineWidth) {\r
+ *          System.out.println();\r
+ *      }\r
+ *\r
+ *      // render a run of text and advance to the right by the run width\r
+ *      // the text[start..limit-1] is always in logical order\r
+ *      static void renderRun(String text, int start, int limit,\r
+ *                            byte textDirection, int style) {\r
+ *      }\r
+ *\r
+ *      // We could compute a cross-product\r
+ *      // from the style runs with the directional runs\r
+ *      // and then reorder it.\r
+ *      // Instead, here we iterate over each run type\r
+ *      // and render the intersections -\r
+ *      // with shortcuts in simple (and common) cases.\r
+ *      // renderParagraph() is the main function.\r
+ *\r
+ *      // render a directional run with\r
+ *      // (possibly) multiple style runs intersecting with it\r
+ *      static void renderDirectionalRun(String text, int start, int limit,\r
+ *                                       byte direction, StyleRun styleRuns[],\r
+ *                                       int styleRunCount) {\r
+ *          int i;\r
+ *\r
+ *          // iterate over style runs\r
+ *          if (direction == Bidi.LTR) {\r
+ *              int styleLimit;\r
+ *              for (i = 0; i < styleRunCount; ++i) {\r
+ *                  styleLimit = styleRuns[i].limit;\r
+ *                  if (start < styleLimit) {\r
+ *                      if (styleLimit > limit) {\r
+ *                          styleLimit = limit;\r
+ *                      }\r
+ *                      renderRun(text, start, styleLimit,\r
+ *                                direction, styleRuns[i].style);\r
+ *                      if (styleLimit == limit) {\r
+ *                          break;\r
+ *                      }\r
+ *                      start = styleLimit;\r
+ *                  }\r
+ *              }\r
+ *          } else {\r
+ *              int styleStart;\r
+ *\r
+ *              for (i = styleRunCount-1; i >= 0; --i) {\r
+ *                  if (i > 0) {\r
+ *                      styleStart = styleRuns[i-1].limit;\r
+ *                  } else {\r
+ *                      styleStart = 0;\r
+ *                  }\r
+ *                  if (limit >= styleStart) {\r
+ *                      if (styleStart < start) {\r
+ *                          styleStart = start;\r
+ *                      }\r
+ *                      renderRun(text, styleStart, limit, direction,\r
+ *                                styleRuns[i].style);\r
+ *                      if (styleStart == start) {\r
+ *                          break;\r
+ *                      }\r
+ *                      limit = styleStart;\r
+ *                  }\r
+ *              }\r
+ *          }\r
+ *      }\r
+ *\r
+ *      // the line object represents text[start..limit-1]\r
+ *      static void renderLine(Bidi line, String text, int start, int limit,\r
+ *                             StyleRun styleRuns[], int styleRunCount) {\r
+ *          byte direction = line.getDirection();\r
+ *          if (direction != Bidi.MIXED) {\r
+ *              // unidirectional\r
+ *              if (styleRunCount <= 1) {\r
+ *                  renderRun(text, start, limit, direction, styleRuns[0].style);\r
+ *              } else {\r
+ *                  renderDirectionalRun(text, start, limit, direction,\r
+ *                                       styleRuns, styleRunCount);\r
+ *              }\r
+ *          } else {\r
+ *              // mixed-directional\r
+ *              int count, i;\r
+ *              BidiRun run;\r
+ *\r
+ *              try {\r
+ *                  count = line.countRuns();\r
+ *              } catch (IllegalStateException e) {\r
+ *                  e.printStackTrace();\r
+ *                  return;\r
+ *              }\r
+ *              if (styleRunCount <= 1) {\r
+ *                  int style = styleRuns[0].style;\r
+ *\r
+ *                  // iterate over directional runs\r
+ *                  for (i = 0; i < count; ++i) {\r
+ *                      run = line.getVisualRun(i);\r
+ *                      renderRun(text, run.getStart(), run.getLimit(),\r
+ *                                run.getDirection(), style);\r
+ *                  }\r
+ *              } else {\r
+ *                  // iterate over both directional and style runs\r
+ *                  for (i = 0; i < count; ++i) {\r
+ *                      run = line.getVisualRun(i);\r
+ *                      renderDirectionalRun(text, run.getStart(),\r
+ *                                           run.getLimit(), run.getDirection(),\r
+ *                                           styleRuns, styleRunCount);\r
+ *                  }\r
+ *              }\r
+ *          }\r
+ *      }\r
+ *\r
+ *      static void renderParagraph(String text, byte textDirection,\r
+ *                                  StyleRun styleRuns[], int styleRunCount,\r
+ *                                  int lineWidth) {\r
+ *          int length = text.length();\r
+ *          Bidi para = new Bidi();\r
+ *          try {\r
+ *              para.setPara(text,\r
+ *                           textDirection != 0 ? Bidi.LEVEL_DEFAULT_RTL\r
+ *                                              : Bidi.LEVEL_DEFAULT_LTR,\r
+ *                           null);\r
+ *          } catch (Exception e) {\r
+ *              e.printStackTrace();\r
+ *              return;\r
+ *          }\r
+ *          byte paraLevel = (byte)(1 & para.getParaLevel());\r
+ *          StyleRun styleRun = new StyleRun(length, styleNormal);\r
+ *\r
+ *          if (styleRuns == null || styleRunCount <= 0) {\r
+ *              styleRuns = new StyleRun[1];\r
+ *              styleRunCount = 1;\r
+ *              styleRuns[0] = styleRun;\r
+ *          }\r
+ *          // assume styleRuns[styleRunCount-1].limit>=length\r
+ *\r
+ *          int width = getTextWidth(text, 0, length, styleRuns, styleRunCount);\r
+ *          if (width <= lineWidth) {\r
+ *              // everything fits onto one line\r
+ *\r
+ *              // prepare rendering a new line from either left or right\r
+ *              startLine(paraLevel, width);\r
+ *\r
+ *              renderLine(para, text, 0, length, styleRuns, styleRunCount);\r
+ *          } else {\r
+ *              // we need to render several lines\r
+ *              Bidi line = new Bidi(length, 0);\r
+ *              int start = 0, limit;\r
+ *              int styleRunStart = 0, styleRunLimit;\r
+ *\r
+ *              for (;;) {\r
+ *                  limit = length;\r
+ *                  styleRunLimit = styleRunCount;\r
+ *                  width = getLineBreak(text, new Bounds(start, limit),\r
+ *                                       para, styleRuns,\r
+ *                                       new Bounds(styleRunStart, styleRunLimit));\r
+ *                  try {\r
+ *                      line = para.setLine(start, limit);\r
+ *                  } catch (Exception e) {\r
+ *                      e.printStackTrace();\r
+ *                      return;\r
+ *                  }\r
+ *                  // prepare rendering a new line\r
+ *                  // from either left or right\r
+ *                  startLine(paraLevel, width);\r
+ *\r
+ *                  if (styleRunStart > 0) {\r
+ *                      int newRunCount = styleRuns.length - styleRunStart;\r
+ *                      StyleRun[] newRuns = new StyleRun[newRunCount];\r
+ *                      System.arraycopy(styleRuns, styleRunStart, newRuns, 0,\r
+ *                                       newRunCount);\r
+ *                      renderLine(line, text, start, limit, newRuns,\r
+ *                                 styleRunLimit - styleRunStart);\r
+ *                  } else {\r
+ *                      renderLine(line, text, start, limit, styleRuns,\r
+ *                                 styleRunLimit - styleRunStart);\r
+ *                  }\r
+ *                  if (limit == length) {\r
+ *                      break;\r
+ *                  }\r
+ *                  start = limit;\r
+ *                  styleRunStart = styleRunLimit - 1;\r
+ *                  if (start >= styleRuns[styleRunStart].limit) {\r
+ *                      ++styleRunStart;\r
+ *                  }\r
+ *              }\r
+ *          }\r
+ *      }\r
+ *\r
+ *      public static void main(String[] args)\r
+ *      {\r
+ *          renderParagraph("Some Latin text...", Bidi.LTR, null, 0, 80);\r
+ *          renderParagraph("Some Hebrew text...", Bidi.RTL, null, 0, 60);\r
+ *      }\r
+ *  }\r
+ *\r
+ * </pre>\r
+ */\r
+\r
+public class Bidi {\r
+\r
+    private java.text.Bidi bidi;\r
+\r
+    private Bidi(java.text.Bidi delegate) {\r
+        this.bidi = delegate;\r
+    }\r
+\r
+    /** Paragraph level setting<p>\r
+     *\r
+     * Constant indicating that the base direction depends on the first strong\r
+     * directional character in the text according to the Unicode Bidirectional\r
+     * Algorithm. If no strong directional character is present,\r
+     * then set the paragraph level to 0 (left-to-right).<p>\r
+     *\r
+     * If this value is used in conjunction with reordering modes\r
+     * <code>REORDER_INVERSE_LIKE_DIRECT</code> or\r
+     * <code>REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code>, the text to reorder\r
+     * is assumed to be visual LTR, and the text after reordering is required\r
+     * to be the corresponding logical string with appropriate contextual\r
+     * direction. The direction of the result string will be RTL if either\r
+     * the righmost or leftmost strong character of the source text is RTL\r
+     * or Arabic Letter, the direction will be LTR otherwise.<p>\r
+     *\r
+     * If reordering option <code>OPTION_INSERT_MARKS</code> is set, an RLM may\r
+     * be added at the beginning of the result string to ensure round trip\r
+     * (that the result string, when reordered back to visual, will produce\r
+     * the original source text).\r
+     * @see #REORDER_INVERSE_LIKE_DIRECT\r
+     * @see #REORDER_INVERSE_FOR_NUMBERS_SPECIAL\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final byte LEVEL_DEFAULT_LTR = (byte)0x7e;\r
+\r
+    /** Paragraph level setting<p>\r
+     *\r
+     * Constant indicating that the base direction depends on the first strong\r
+     * directional character in the text according to the Unicode Bidirectional\r
+     * Algorithm. If no strong directional character is present,\r
+     * then set the paragraph level to 1 (right-to-left).<p>\r
+     *\r
+     * If this value is used in conjunction with reordering modes\r
+     * <code>REORDER_INVERSE_LIKE_DIRECT</code> or\r
+     * <code>REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code>, the text to reorder\r
+     * is assumed to be visual LTR, and the text after reordering is required\r
+     * to be the corresponding logical string with appropriate contextual\r
+     * direction. The direction of the result string will be RTL if either\r
+     * the righmost or leftmost strong character of the source text is RTL\r
+     * or Arabic Letter, or if the text contains no strong character;\r
+     * the direction will be LTR otherwise.<p>\r
+     *\r
+     * If reordering option <code>OPTION_INSERT_MARKS</code> is set, an RLM may\r
+     * be added at the beginning of the result string to ensure round trip\r
+     * (that the result string, when reordered back to visual, will produce\r
+     * the original source text).\r
+     * @see #REORDER_INVERSE_LIKE_DIRECT\r
+     * @see #REORDER_INVERSE_FOR_NUMBERS_SPECIAL\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final byte LEVEL_DEFAULT_RTL = (byte)0x7f;\r
+\r
+    /**\r
+     * Maximum explicit embedding level.\r
+     * (The maximum resolved level can be up to <code>MAX_EXPLICIT_LEVEL+1</code>).\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final byte MAX_EXPLICIT_LEVEL = 61;\r
+\r
+    /**\r
+     * Bit flag for level input.\r
+     * Overrides directional properties.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final byte LEVEL_OVERRIDE = (byte)0x80;\r
+\r
+    /**\r
+     * Special value which can be returned by the mapping methods when a\r
+     * logical index has no corresponding visual index or vice-versa. This may\r
+     * happen for the logical-to-visual mapping of a Bidi control when option\r
+     * <code>OPTION_REMOVE_CONTROLS</code> is\r
+     * specified. This can also happen for the visual-to-logical mapping of a\r
+     * Bidi mark (LRM or RLM) inserted by option\r
+     * <code>OPTION_INSERT_MARKS</code>.\r
+     * @see #getVisualIndex\r
+     * @see #getVisualMap\r
+     * @see #getLogicalIndex\r
+     * @see #getLogicalMap\r
+     * @see #OPTION_INSERT_MARKS\r
+     * @see #OPTION_REMOVE_CONTROLS\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int MAP_NOWHERE = -1;\r
+\r
+    /**\r
+     * All left-to-right text.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final byte LTR = 0;\r
+\r
+    /**\r
+     * All right-to-left text.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final byte RTL = 1;\r
+\r
+    /**\r
+     * Mixed-directional text.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final byte MIXED = 2;\r
+\r
+    /**\r
+     * option bit for writeReordered():\r
+     * keep combining characters after their base characters in RTL runs\r
+     *\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short KEEP_BASE_COMBINING = 1;\r
+\r
+    /**\r
+     * option bit for writeReordered():\r
+     * replace characters with the "mirrored" property in RTL runs\r
+     * by their mirror-image mappings\r
+     *\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short DO_MIRRORING = 2;\r
+\r
+    /**\r
+     * option bit for writeReordered():\r
+     * surround the run with LRMs if necessary;\r
+     * this is part of the approximate "inverse Bidi" algorithm\r
+     *\r
+     * <p>This option does not imply corresponding adjustment of the index\r
+     * mappings.</p>\r
+     *\r
+     * @see #setInverse\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short INSERT_LRM_FOR_NUMERIC = 4;\r
+\r
+    /**\r
+     * option bit for writeReordered():\r
+     * remove Bidi control characters\r
+     * (this does not affect INSERT_LRM_FOR_NUMERIC)\r
+     *\r
+     * <p>This option does not imply corresponding adjustment of the index\r
+     * mappings.</p>\r
+     *\r
+     * @see #writeReordered\r
+     * @see #INSERT_LRM_FOR_NUMERIC\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REMOVE_BIDI_CONTROLS = 8;\r
+\r
+    /**\r
+     * option bit for writeReordered():\r
+     * write the output in reverse order\r
+     *\r
+     * <p>This has the same effect as calling <code>writeReordered()</code>\r
+     * first without this option, and then calling\r
+     * <code>writeReverse()</code> without mirroring.\r
+     * Doing this in the same step is faster and avoids a temporary buffer.\r
+     * An example for using this option is output to a character terminal that\r
+     * is designed for RTL scripts and stores text in reverse order.</p>\r
+     *\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short OUTPUT_REVERSE = 16;\r
+\r
+    /** Reordering mode: Regular Logical to Visual Bidi algorithm according to Unicode.\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REORDER_DEFAULT = 0;\r
+\r
+    /** Reordering mode: Logical to Visual algorithm which handles numbers in\r
+     * a way which mimicks the behavior of Windows XP.\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REORDER_NUMBERS_SPECIAL = 1;\r
+\r
+    /** Reordering mode: Logical to Visual algorithm grouping numbers with\r
+     * adjacent R characters (reversible algorithm).\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REORDER_GROUP_NUMBERS_WITH_R = 2;\r
+\r
+    /** Reordering mode: Reorder runs only to transform a Logical LTR string\r
+     * to the logical RTL string with the same display, or vice-versa.<br>\r
+     * If this mode is set together with option\r
+     * <code>OPTION_INSERT_MARKS</code>, some Bidi controls in the source\r
+     * text may be removed and other controls may be added to produce the\r
+     * minimum combination which has the required display.\r
+     * @see #OPTION_INSERT_MARKS\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REORDER_RUNS_ONLY = 3;\r
+\r
+    /** Reordering mode: Visual to Logical algorithm which handles numbers\r
+     * like L (same algorithm as selected by <code>setInverse(true)</code>.\r
+     * @see #setInverse\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REORDER_INVERSE_NUMBERS_AS_L = 4;\r
+\r
+    /** Reordering mode: Visual to Logical algorithm equivalent to the regular\r
+     * Logical to Visual algorithm.\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REORDER_INVERSE_LIKE_DIRECT = 5;\r
+\r
+    /** Reordering mode: Inverse Bidi (Visual to Logical) algorithm for the\r
+     * <code>REORDER_NUMBERS_SPECIAL</code> Bidi algorithm.\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final short REORDER_INVERSE_FOR_NUMBERS_SPECIAL = 6;\r
+\r
+    /**\r
+     * Option value for <code>setReorderingOptions</code>:\r
+     * disable all the options which can be set with this method\r
+     * @see #setReorderingOptions\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int OPTION_DEFAULT = 0;\r
+\r
+    /**\r
+     * Option bit for <code>setReorderingOptions</code>:\r
+     * insert Bidi marks (LRM or RLM) when needed to ensure correct result of\r
+     * a reordering to a Logical order\r
+     *\r
+     * <p>This option must be set or reset before calling\r
+     * <code>setPara</code>.</p>\r
+     *\r
+     * <p>This option is significant only with reordering modes which generate\r
+     * a result with Logical order, specifically.</p>\r
+     * <ul>\r
+     *   <li><code>REORDER_RUNS_ONLY</code></li>\r
+     *   <li><code>REORDER_INVERSE_NUMBERS_AS_L</code></li>\r
+     *   <li><code>REORDER_INVERSE_LIKE_DIRECT</code></li>\r
+     *   <li><code>REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code></li>\r
+     * </ul>\r
+     *\r
+     * <p>If this option is set in conjunction with reordering mode\r
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code> or with calling\r
+     * <code>setInverse(true)</code>, it implies option\r
+     * <code>INSERT_LRM_FOR_NUMERIC</code> in calls to method\r
+     * <code>writeReordered()</code>.</p>\r
+     *\r
+     * <p>For other reordering modes, a minimum number of LRM or RLM characters\r
+     * will be added to the source text after reordering it so as to ensure\r
+     * round trip, i.e. when applying the inverse reordering mode on the\r
+     * resulting logical text with removal of Bidi marks\r
+     * (option <code>OPTION_REMOVE_CONTROLS</code> set before calling\r
+     * <code>setPara()</code> or option\r
+     * <code>REMOVE_BIDI_CONTROLS</code> in\r
+     * <code>writeReordered</code>), the result will be identical to the\r
+     * source text in the first transformation.\r
+     *\r
+     * <p>This option will be ignored if specified together with option\r
+     * <code>OPTION_REMOVE_CONTROLS</code>. It inhibits option\r
+     * <code>REMOVE_BIDI_CONTROLS</code> in calls to method\r
+     * <code>writeReordered()</code> and it implies option\r
+     * <code>INSERT_LRM_FOR_NUMERIC</code> in calls to method\r
+     * <code>writeReordered()</code> if the reordering mode is\r
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code>.</p>\r
+     *\r
+     * @see #setReorderingMode\r
+     * @see #setReorderingOptions\r
+     * @see #INSERT_LRM_FOR_NUMERIC\r
+     * @see #REMOVE_BIDI_CONTROLS\r
+     * @see #OPTION_REMOVE_CONTROLS\r
+     * @see #REORDER_RUNS_ONLY\r
+     * @see #REORDER_INVERSE_NUMBERS_AS_L\r
+     * @see #REORDER_INVERSE_LIKE_DIRECT\r
+     * @see #REORDER_INVERSE_FOR_NUMBERS_SPECIAL\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int OPTION_INSERT_MARKS = 1;\r
+\r
+    /**\r
+     * Option bit for <code>setReorderingOptions</code>:\r
+     * remove Bidi control characters\r
+     *\r
+     * <p>This option must be set or reset before calling\r
+     * <code>setPara</code>.</p>\r
+     *\r
+     * <p>This option nullifies option\r
+     * <code>OPTION_INSERT_MARKS</code>. It inhibits option\r
+     * <code>INSERT_LRM_FOR_NUMERIC</code> in calls to method\r
+     * <code>writeReordered()</code> and it implies option\r
+     * <code>REMOVE_BIDI_CONTROLS</code> in calls to that method.</p>\r
+     *\r
+     * @see #setReorderingMode\r
+     * @see #setReorderingOptions\r
+     * @see #OPTION_INSERT_MARKS\r
+     * @see #INSERT_LRM_FOR_NUMERIC\r
+     * @see #REMOVE_BIDI_CONTROLS\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int OPTION_REMOVE_CONTROLS = 2;\r
+\r
+    /**\r
+     * Option bit for <code>setReorderingOptions</code>:\r
+     * process the output as part of a stream to be continued\r
+     *\r
+     * <p>This option must be set or reset before calling\r
+     * <code>setPara</code>.</p>\r
+     *\r
+     * <p>This option specifies that the caller is interested in processing\r
+     * large text object in parts. The results of the successive calls are\r
+     * expected to be concatenated by the caller. Only the call for the last\r
+     * part will have this option bit off.</p>\r
+     *\r
+     * <p>When this option bit is on, <code>setPara()</code> may process\r
+     * less than the full source text in order to truncate the text at a\r
+     * meaningful boundary. The caller should call\r
+     * <code>getProcessedLength()</code> immediately after calling\r
+     * <code>setPara()</code> in order to determine how much of the source\r
+     * text has been processed. Source text beyond that length should be\r
+     * resubmitted in following calls to <code>setPara</code>. The\r
+     * processed length may be less than the length of the source text if a\r
+     * character preceding the last character of the source text constitutes a\r
+     * reasonable boundary (like a block separator) for text to be continued.<br>\r
+     * If the last character of the source text constitutes a reasonable\r
+     * boundary, the whole text will be processed at once.<br>\r
+     * If nowhere in the source text there exists\r
+     * such a reasonable boundary, the processed length will be zero.<br>\r
+     * The caller should check for such an occurrence and do one of the following:\r
+     * <ul><li>submit a larger amount of text with a better chance to include\r
+     *         a reasonable boundary.</li>\r
+     *     <li>resubmit the same text after turning off option\r
+     *         <code>OPTION_STREAMING</code>.</li></ul>\r
+     * In all cases, this option should be turned off before processing the last\r
+     * part of the text.</p>\r
+     *\r
+     * <p>When the <code>OPTION_STREAMING</code> option is used, it is\r
+     * recommended to call <code>orderParagraphsLTR(true)</code> before calling\r
+     * <code>setPara()</code> so that later paragraphs may be concatenated to\r
+     * previous paragraphs on the right.\r
+     * </p>\r
+     *\r
+     * @see #setReorderingMode\r
+     * @see #setReorderingOptions\r
+     * @see #getProcessedLength\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int OPTION_STREAMING = 4;\r
+\r
+    /**\r
+     * Value returned by <code>BidiClassifier</code> when there is no need to\r
+     * override the standard Bidi class for a given code point.\r
+     * @see BidiClassifier\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int CLASS_DEFAULT = 19; //UCharacterDirection.CHAR_DIRECTION_COUNT;\r
+\r
+    /**\r
+     * Allocate a <code>Bidi</code> object.\r
+     * Such an object is initially empty. It is assigned\r
+     * the Bidi properties of a piece of text containing one or more paragraphs\r
+     * by <code>setPara()</code>\r
+     * or the Bidi properties of a line within a paragraph by\r
+     * <code>setLine()</code>.<p>\r
+     * This object can be reused.<p>\r
+     * <code>setPara()</code> and <code>setLine()</code> will allocate\r
+     * additional memory for internal structures as necessary.\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public Bidi()\r
+    {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Allocate a <code>Bidi</code> object with preallocated memory\r
+     * for internal structures.\r
+     * This method provides a <code>Bidi</code> object like the default constructor\r
+     * but it also preallocates memory for internal structures\r
+     * according to the sizings supplied by the caller.<p>\r
+     * The preallocation can be limited to some of the internal memory\r
+     * by setting some values to 0 here. That means that if, e.g.,\r
+     * <code>maxRunCount</code> cannot be reasonably predetermined and should not\r
+     * be set to <code>maxLength</code> (the only failproof value) to avoid\r
+     * wasting  memory, then <code>maxRunCount</code> could be set to 0 here\r
+     * and the internal structures that are associated with it will be allocated\r
+     * on demand, just like with the default constructor.\r
+     *\r
+     * @param maxLength is the maximum text or line length that internal memory\r
+     *        will be preallocated for. An attempt to associate this object with a\r
+     *        longer text will fail, unless this value is 0, which leaves the allocation\r
+     *        up to the implementation.\r
+     *\r
+     * @param maxRunCount is the maximum anticipated number of same-level runs\r
+     *        that internal memory will be preallocated for. An attempt to access\r
+     *        visual runs on an object that was not preallocated for as many runs\r
+     *        as the text was actually resolved to will fail,\r
+     *        unless this value is 0, which leaves the allocation up to the implementation.<br><br>\r
+     *        The number of runs depends on the actual text and maybe anywhere between\r
+     *        1 and <code>maxLength</code>. It is typically small.\r
+     *\r
+     * @throws IllegalArgumentException if maxLength or maxRunCount is less than 0\r
+     * @stable ICU 3.8\r
+     */\r
+    public Bidi(int maxLength, int maxRunCount)\r
+    {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Modify the operation of the Bidi algorithm such that it\r
+     * approximates an "inverse Bidi" algorithm. This method\r
+     * must be called before <code>setPara()</code>.\r
+     *\r
+     * <p>The normal operation of the Bidi algorithm as described\r
+     * in the Unicode Technical Report is to take text stored in logical\r
+     * (keyboard, typing) order and to determine the reordering of it for visual\r
+     * rendering.\r
+     * Some legacy systems store text in visual order, and for operations\r
+     * with standard, Unicode-based algorithms, the text needs to be transformed\r
+     * to logical order. This is effectively the inverse algorithm of the\r
+     * described Bidi algorithm. Note that there is no standard algorithm for\r
+     * this "inverse Bidi" and that the current implementation provides only an\r
+     * approximation of "inverse Bidi".</p>\r
+     *\r
+     * <p>With <code>isInversed</code> set to <code>true</code>,\r
+     * this method changes the behavior of some of the subsequent methods\r
+     * in a way that they can be used for the inverse Bidi algorithm.\r
+     * Specifically, runs of text with numeric characters will be treated in a\r
+     * special way and may need to be surrounded with LRM characters when they are\r
+     * written in reordered sequence.</p>\r
+     *\r
+     * <p>Output runs should be retrieved using <code>getVisualRun()</code>.\r
+     * Since the actual input for "inverse Bidi" is visually ordered text and\r
+     * <code>getVisualRun()</code> gets the reordered runs, these are actually\r
+     * the runs of the logically ordered output.</p>\r
+     *\r
+     * <p>Calling this method with argument <code>isInverse</code> set to\r
+     * <code>true</code> is equivalent to calling <code>setReorderingMode</code>\r
+     * with argument <code>reorderingMode</code>\r
+     * set to <code>REORDER_INVERSE_NUMBERS_AS_L</code>.<br>\r
+     * Calling this method with argument <code>isInverse</code> set to\r
+     * <code>false</code> is equivalent to calling <code>setReorderingMode</code>\r
+     * with argument <code>reorderingMode</code>\r
+     * set to <code>REORDER_DEFAULT</code>.\r
+     *\r
+     * @param isInverse specifies "forward" or "inverse" Bidi operation.\r
+     *\r
+     * @see #setPara\r
+     * @see #writeReordered\r
+     * @see #setReorderingMode\r
+     * @see #REORDER_INVERSE_NUMBERS_AS_L\r
+     * @see #REORDER_DEFAULT\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setInverse(boolean isInverse) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Is this <code>Bidi</code> object set to perform the inverse Bidi\r
+     * algorithm?\r
+     * <p>Note: calling this method after setting the reordering mode with\r
+     * <code>setReorderingMode</code> will return <code>true</code> if the\r
+     * reordering mode was set to\r
+     * <code>REORDER_INVERSE_NUMBERS_AS_L<code>, <code>false</code>\r
+     * for all other values.</p>\r
+     *\r
+     * @return <code>true</code> if the <code>Bidi</code> object is set to\r
+     * perform the inverse Bidi algorithm by handling numbers as L.\r
+     *\r
+     * @see #setInverse\r
+     * @see #setReorderingMode\r
+     * @see #REORDER_INVERSE_NUMBERS_AS_L\r
+     * @stable ICU 3.8\r
+     */\r
+    public boolean isInverse() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Modify the operation of the Bidi algorithm such that it implements some\r
+     * variant to the basic Bidi algorithm or approximates an "inverse Bidi"\r
+     * algorithm, depending on different values of the "reordering mode".\r
+     * This method must be called before <code>setPara()</code>, and stays in\r
+     * effect until called again with a different argument.\r
+     *\r
+     * <p>The normal operation of the Bidi algorithm as described in the Unicode\r
+     * Standard Annex #9 is to take text stored in logical (keyboard, typing)\r
+     * order and to determine how to reorder it for visual rendering.</p>\r
+     *\r
+     * <p>With the reordering mode set to a value other than\r
+     * <code>REORDER_DEFAULT</code>, this method changes the behavior of some of\r
+     * the subsequent methods in a way such that they implement an inverse Bidi\r
+     * algorithm or some other algorithm variants.</p>\r
+     *\r
+     * <p>Some legacy systems store text in visual order, and for operations\r
+     * with standard, Unicode-based algorithms, the text needs to be transformed\r
+     * into logical order. This is effectively the inverse algorithm of the\r
+     * described Bidi algorithm. Note that there is no standard algorithm for\r
+     * this "inverse Bidi", so a number of variants are implemented here.</p>\r
+     *\r
+     * <p>In other cases, it may be desirable to emulate some variant of the\r
+     * Logical to Visual algorithm (e.g. one used in MS Windows), or perform a\r
+     * Logical to Logical transformation.</p>\r
+     *\r
+     * <ul>\r
+     * <li>When the Reordering Mode is set to\r
+     * <code>REORDER_DEFAULT</code>,\r
+     * the standard Bidi Logical to Visual algorithm is applied.</li>\r
+     *\r
+     * <li>When the reordering mode is set to\r
+     * <code>REORDER_NUMBERS_SPECIAL</code>,\r
+     * the algorithm used to perform Bidi transformations when calling\r
+     * <code>setPara</code> should approximate the algorithm used in Microsoft\r
+     * Windows XP rather than strictly conform to the Unicode Bidi algorithm.\r
+     * <br>\r
+     * The differences between the basic algorithm and the algorithm addressed\r
+     * by this option are as follows:\r
+     * <ul>\r
+     *   <li>Within text at an even embedding level, the sequence "123AB"\r
+     *   (where AB represent R or AL letters) is transformed to "123BA" by the\r
+     *   Unicode algorithm and to "BA123" by the Windows algorithm.</li>\r
+     *\r
+     *   <li>Arabic-Indic numbers (AN) are handled by the Windows algorithm just\r
+     *   like regular numbers (EN).</li>\r
+     * </ul></li>\r
+     *\r
+     * <li>When the reordering mode is set to\r
+     * <code>REORDER_GROUP_NUMBERS_WITH_R</code>,\r
+     * numbers located between LTR text and RTL text are associated with the RTL\r
+     * text. For instance, an LTR paragraph with content "abc 123 DEF" (where\r
+     * upper case letters represent RTL characters) will be transformed to\r
+     * "abc FED 123" (and not "abc 123 FED"), "DEF 123 abc" will be transformed\r
+     * to "123 FED abc" and "123 FED abc" will be transformed to "DEF 123 abc".\r
+     * This makes the algorithm reversible and makes it useful when round trip\r
+     * (from visual to logical and back to visual) must be achieved without\r
+     * adding LRM characters. However, this is a variation from the standard\r
+     * Unicode Bidi algorithm.<br>\r
+     * The source text should not contain Bidi control characters other than LRM\r
+     * or RLM.</li>\r
+     *\r
+     * <li>When the reordering mode is set to\r
+     * <code>REORDER_RUNS_ONLY</code>,\r
+     * a "Logical to Logical" transformation must be performed:\r
+     * <ul>\r
+     * <li>If the default text level of the source text (argument\r
+     * <code>paraLevel</code> in <code>setPara</code>) is even, the source text\r
+     * will be handled as LTR logical text and will be transformed to the RTL\r
+     * logical text which has the same LTR visual display.</li>\r
+     * <li>If the default level of the source text is odd, the source text\r
+     * will be handled as RTL logical text and will be transformed to the\r
+     * LTR logical text which has the same LTR visual display.</li>\r
+     * </ul>\r
+     * This mode may be needed when logical text which is basically Arabic or\r
+     * Hebrew, with possible included numbers or phrases in English, has to be\r
+     * displayed as if it had an even embedding level (this can happen if the\r
+     * displaying application treats all text as if it was basically LTR).\r
+     * <br>\r
+     * This mode may also be needed in the reverse case, when logical text which\r
+     * is basically English, with possible included phrases in Arabic or Hebrew,\r
+     * has to be displayed as if it had an odd embedding level.\r
+     * <br>\r
+     * Both cases could be handled by adding LRE or RLE at the head of the\r
+     * text, if the display subsystem supports these formatting controls. If it\r
+     * does not, the problem may be handled by transforming the source text in\r
+     * this mode before displaying it, so that it will be displayed properly.\r
+     * <br>\r
+     * The source text should not contain Bidi control characters other than LRM\r
+     * or RLM.</li>\r
+     *\r
+     * <li>When the reordering mode is set to\r
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code>, an "inverse Bidi"\r
+     * algorithm is applied.\r
+     * Runs of text with numeric characters will be treated like LTR letters and\r
+     * may need to be surrounded with LRM characters when they are written in\r
+     * reordered sequence (the option <code>INSERT_LRM_FOR_NUMERIC</code> can\r
+     * be used with method <code>writeReordered</code> to this end. This mode\r
+     * is equivalent to calling <code>setInverse()</code> with\r
+     * argument <code>isInverse</code> set to <code>true</code>.</li>\r
+     *\r
+     * <li>When the reordering mode is set to\r
+     * <code>REORDER_INVERSE_LIKE_DIRECT</code>, the "direct" Logical to\r
+     * Visual Bidi algorithm is used as an approximation of an "inverse Bidi"\r
+     * algorithm. This mode is similar to mode\r
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code> but is closer to the\r
+     * regular Bidi algorithm.\r
+     * <br>\r
+     * For example, an LTR paragraph with the content "FED 123 456 CBA" (where\r
+     * upper case represents RTL characters) will be transformed to\r
+     * "ABC 456 123 DEF", as opposed to "DEF 123 456 ABC"\r
+     * with mode <code>REORDER_INVERSE_NUMBERS_AS_L</code>.<br>\r
+     * When used in conjunction with option\r
+     * <code>OPTION_INSERT_MARKS</code>, this mode generally\r
+     * adds Bidi marks to the output significantly more sparingly than mode\r
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code>.<br> with option\r
+     * <code>INSERT_LRM_FOR_NUMERIC</code> in calls to\r
+     * <code>writeReordered</code>.</li>\r
+     *\r
+     * <li>When the reordering mode is set to\r
+     * <code>REORDER_INVERSE_FOR_NUMBERS_SPECIAL</code>, the Logical to Visual\r
+     * Bidi algorithm used in Windows XP is used as an approximation of an "inverse\r
+     * Bidi" algorithm.\r
+     * <br>\r
+     * For example, an LTR paragraph with the content "abc FED123" (where\r
+     * upper case represents RTL characters) will be transformed to\r
+     * "abc 123DEF.</li>\r
+     * </ul>\r
+     *\r
+     * <p>In all the reordering modes specifying an "inverse Bidi" algorithm\r
+     * (i.e. those with a name starting with <code>REORDER_INVERSE</code>),\r
+     * output runs should be retrieved using <code>getVisualRun()</code>, and\r
+     * the output text with <code>writeReordered()</code>. The caller should\r
+     * keep in mind that in "inverse Bidi" modes the input is actually visually\r
+     * ordered text and reordered output returned by <code>getVisualRun()</code>\r
+     * or <code>writeReordered()</code> are actually runs or character string\r
+     * of logically ordered output.<br>\r
+     * For all the "inverse Bidi" modes, the source text should not contain\r
+     * Bidi control characters other than LRM or RLM.</p>\r
+     *\r
+     * <p>Note that option <code>OUTPUT_REVERSE</code> of\r
+     * <code>writeReordered</code> has no useful meaning and should not be used\r
+     * in conjunction with any value of the reordering mode specifying "inverse\r
+     * Bidi" or with value <code>REORDER_RUNS_ONLY</code>.\r
+     *\r
+     * @param reorderingMode specifies the required variant of the Bidi\r
+     *                       algorithm.\r
+     *\r
+     * @see #setInverse\r
+     * @see #setPara\r
+     * @see #writeReordered\r
+     * @see #INSERT_LRM_FOR_NUMERIC\r
+     * @see #OUTPUT_REVERSE\r
+     * @see #REORDER_DEFAULT\r
+     * @see #REORDER_NUMBERS_SPECIAL\r
+     * @see #REORDER_GROUP_NUMBERS_WITH_R\r
+     * @see #REORDER_RUNS_ONLY\r
+     * @see #REORDER_INVERSE_NUMBERS_AS_L\r
+     * @see #REORDER_INVERSE_LIKE_DIRECT\r
+     * @see #REORDER_INVERSE_FOR_NUMBERS_SPECIAL\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setReorderingMode(int reorderingMode) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * What is the requested reordering mode for a given Bidi object?\r
+     *\r
+     * @return the current reordering mode of the Bidi object\r
+     *\r
+     * @see #setReorderingMode\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getReorderingMode() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Specify which of the reordering options should be applied during Bidi\r
+     * transformations.\r
+     *\r
+     * @param options A combination of zero or more of the following\r
+     * reordering options:\r
+     * <code>OPTION_DEFAULT</code>, <code>OPTION_INSERT_MARKS</code>,\r
+     * <code>OPTION_REMOVE_CONTROLS</code>, <code>OPTION_STREAMING</code>.\r
+     *\r
+     * @see #getReorderingOptions\r
+     * @see #OPTION_DEFAULT\r
+     * @see #OPTION_INSERT_MARKS\r
+     * @see #OPTION_REMOVE_CONTROLS\r
+     * @see #OPTION_STREAMING\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setReorderingOptions(int options) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * What are the reordering options applied to a given Bidi object?\r
+     *\r
+     * @return the current reordering options of the Bidi object\r
+     *\r
+     * @see #setReorderingOptions\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getReorderingOptions() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Perform the Unicode Bidi algorithm. It is defined in the\r
+     * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,\r
+     * version 13,\r
+     * also described in The Unicode Standard, Version 4.0 .<p>\r
+     *\r
+     * This method takes a piece of plain text containing one or more paragraphs,\r
+     * with or without externally specified embedding levels from <i>styled</i>\r
+     * text and computes the left-right-directionality of each character.<p>\r
+     *\r
+     * If the entire text is all of the same directionality, then\r
+     * the method may not perform all the steps described by the algorithm,\r
+     * i.e., some levels may not be the same as if all steps were performed.\r
+     * This is not relevant for unidirectional text.<br>\r
+     * For example, in pure LTR text with numbers the numbers would get\r
+     * a resolved level of 2 higher than the surrounding text according to\r
+     * the algorithm. This implementation may set all resolved levels to\r
+     * the same value in such a case.<p>\r
+     *\r
+     * The text can be composed of multiple paragraphs. Occurrence of a block\r
+     * separator in the text terminates a paragraph, and whatever comes next starts\r
+     * a new paragraph. The exception to this rule is when a Carriage Return (CR)\r
+     * is followed by a Line Feed (LF). Both CR and LF are block separators, but\r
+     * in that case, the pair of characters is considered as terminating the\r
+     * preceding paragraph, and a new paragraph will be started by a character\r
+     * coming after the LF.\r
+     *\r
+     * Although the text is passed here as a <code>String</code>, it is\r
+     * stored internally as an array of characters. Therefore the\r
+     * documentation will refer to indexes of the characters in the text.\r
+     *\r
+     * @param text contains the text that the Bidi algorithm will be performed\r
+     *        on. This text can be retrieved with <code>getText()</code> or\r
+     *        <code>getTextAsString</code>.<br>\r
+     *\r
+     * @param paraLevel specifies the default level for the text;\r
+     *        it is typically 0 (LTR) or 1 (RTL).\r
+     *        If the method shall determine the paragraph level from the text,\r
+     *        then <code>paraLevel</code> can be set to\r
+     *        either <code>LEVEL_DEFAULT_LTR</code>\r
+     *        or <code>LEVEL_DEFAULT_RTL</code>; if the text contains multiple\r
+     *        paragraphs, the paragraph level shall be determined separately for\r
+     *        each paragraph; if a paragraph does not include any strongly typed\r
+     *        character, then the desired default is used (0 for LTR or 1 for RTL).\r
+     *        Any other value between 0 and <code>MAX_EXPLICIT_LEVEL</code>\r
+     *        is also valid, with odd levels indicating RTL.\r
+     *\r
+     * @param embeddingLevels (in) may be used to preset the embedding and override levels,\r
+     *        ignoring characters like LRE and PDF in the text.\r
+     *        A level overrides the directional property of its corresponding\r
+     *        (same index) character if the level has the\r
+     *        <code>LEVEL_OVERRIDE</code> bit set.<br><br>\r
+     *        Except for that bit, it must be\r
+     *        <code>paraLevel<=embeddingLevels[]<=MAX_EXPLICIT_LEVEL</code>,\r
+     *        with one exception: a level of zero may be specified for a\r
+     *        paragraph separator even if <code>paraLevel&gt;0</code> when multiple\r
+     *        paragraphs are submitted in the same call to <code>setPara()</code>.<br><br>\r
+     *        <strong>Caution: </strong>A reference to this array, not a copy\r
+     *        of the levels, will be stored in the <code>Bidi</code> object;\r
+     *        the <code>embeddingLevels</code>\r
+     *        should not be modified to avoid unexpected results on subsequent\r
+     *        Bidi operations. However, the <code>setPara()</code> and\r
+     *        <code>setLine()</code> methods may modify some or all of the\r
+     *        levels.<br><br>\r
+     *        <strong>Note:</strong> the <code>embeddingLevels</code> array must\r
+     *        have one entry for each character in <code>text</code>.\r
+     *\r
+     * @throws IllegalArgumentException if the values in embeddingLevels are\r
+     *         not within the allowed range\r
+     *\r
+     * @see #LEVEL_DEFAULT_LTR\r
+     * @see #LEVEL_DEFAULT_RTL\r
+     * @see #LEVEL_OVERRIDE\r
+     * @see #MAX_EXPLICIT_LEVEL\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setPara(String text, byte paraLevel, byte[] embeddingLevels)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Perform the Unicode Bidi algorithm. It is defined in the\r
+     * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,\r
+     * version 13,\r
+     * also described in The Unicode Standard, Version 4.0 .<p>\r
+     *\r
+     * This method takes a piece of plain text containing one or more paragraphs,\r
+     * with or without externally specified embedding levels from <i>styled</i>\r
+     * text and computes the left-right-directionality of each character.<p>\r
+     *\r
+     * If the entire text is all of the same directionality, then\r
+     * the method may not perform all the steps described by the algorithm,\r
+     * i.e., some levels may not be the same as if all steps were performed.\r
+     * This is not relevant for unidirectional text.<br>\r
+     * For example, in pure LTR text with numbers the numbers would get\r
+     * a resolved level of 2 higher than the surrounding text according to\r
+     * the algorithm. This implementation may set all resolved levels to\r
+     * the same value in such a case.<p>\r
+     *\r
+     * The text can be composed of multiple paragraphs. Occurrence of a block\r
+     * separator in the text terminates a paragraph, and whatever comes next starts\r
+     * a new paragraph. The exception to this rule is when a Carriage Return (CR)\r
+     * is followed by a Line Feed (LF). Both CR and LF are block separators, but\r
+     * in that case, the pair of characters is considered as terminating the\r
+     * preceding paragraph, and a new paragraph will be started by a character\r
+     * coming after the LF.\r
+     *\r
+     * The text is stored internally as an array of characters. Therefore the\r
+     * documentation will refer to indexes of the characters in the text.\r
+     *\r
+     * @param chars contains the text that the Bidi algorithm will be performed\r
+     *        on. This text can be retrieved with <code>getText()</code> or\r
+     *        <code>getTextAsString</code>.<br>\r
+     *\r
+     * @param paraLevel specifies the default level for the text;\r
+     *        it is typically 0 (LTR) or 1 (RTL).\r
+     *        If the method shall determine the paragraph level from the text,\r
+     *        then <code>paraLevel</code> can be set to\r
+     *        either <code>LEVEL_DEFAULT_LTR</code>\r
+     *        or <code>LEVEL_DEFAULT_RTL</code>; if the text contains multiple\r
+     *        paragraphs, the paragraph level shall be determined separately for\r
+     *        each paragraph; if a paragraph does not include any strongly typed\r
+     *        character, then the desired default is used (0 for LTR or 1 for RTL).\r
+     *        Any other value between 0 and <code>MAX_EXPLICIT_LEVEL</code>\r
+     *        is also valid, with odd levels indicating RTL.\r
+     *\r
+     * @param embeddingLevels (in) may be used to preset the embedding and\r
+     *        override levels, ignoring characters like LRE and PDF in the text.\r
+     *        A level overrides the directional property of its corresponding\r
+     *        (same index) character if the level has the\r
+     *        <code>LEVEL_OVERRIDE</code> bit set.<br><br>\r
+     *        Except for that bit, it must be\r
+     *        <code>paraLevel<=embeddingLevels[]<=MAX_EXPLICIT_LEVEL</code>,\r
+     *        with one exception: a level of zero may be specified for a\r
+     *        paragraph separator even if <code>paraLevel&gt;0</code> when multiple\r
+     *        paragraphs are submitted in the same call to <code>setPara()</code>.<br><br>\r
+     *        <strong>Caution: </strong>A reference to this array, not a copy\r
+     *        of the levels, will be stored in the <code>Bidi</code> object;\r
+     *        the <code>embeddingLevels</code>\r
+     *        should not be modified to avoid unexpected results on subsequent\r
+     *        Bidi operations. However, the <code>setPara()</code> and\r
+     *        <code>setLine()</code> methods may modify some or all of the\r
+     *        levels.<br><br>\r
+     *        <strong>Note:</strong> the <code>embeddingLevels</code> array must\r
+     *        have one entry for each character in <code>text</code>.\r
+     *\r
+     * @throws IllegalArgumentException if the values in embeddingLevels are\r
+     *         not within the allowed range\r
+     *\r
+     * @see #LEVEL_DEFAULT_LTR\r
+     * @see #LEVEL_DEFAULT_RTL\r
+     * @see #LEVEL_OVERRIDE\r
+     * @see #MAX_EXPLICIT_LEVEL\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setPara(char[] chars, byte paraLevel, byte[] embeddingLevels)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Perform the Unicode Bidi algorithm on a given paragraph, as defined in the\r
+     * <a href="http://www.unicode.org/unicode/reports/tr9/">Unicode Standard Annex #9</a>,\r
+     * version 13,\r
+     * also described in The Unicode Standard, Version 4.0 .<p>\r
+     *\r
+     * This method takes a paragraph of text and computes the\r
+     * left-right-directionality of each character. The text should not\r
+     * contain any Unicode block separators.<p>\r
+     *\r
+     * The RUN_DIRECTION attribute in the text, if present, determines the base\r
+     * direction (left-to-right or right-to-left). If not present, the base\r
+     * direction is computed using the Unicode Bidirectional Algorithm,\r
+     * defaulting to left-to-right if there are no strong directional characters\r
+     * in the text. This attribute, if present, must be applied to all the text\r
+     * in the paragraph.<p>\r
+     *\r
+     * The BIDI_EMBEDDING attribute in the text, if present, represents\r
+     * embedding level information. Negative values from -1 to -62 indicate\r
+     * overrides at the absolute value of the level. Positive values from 1 to\r
+     * 62 indicate embeddings. Where values are zero or not defined, the base\r
+     * embedding level as determined by the base direction is assumed.<p>\r
+     *\r
+     * The NUMERIC_SHAPING attribute in the text, if present, converts European\r
+     * digits to other decimal digits before running the bidi algorithm. This\r
+     * attribute, if present, must be applied to all the text in the paragraph.\r
+     *\r
+     * If the entire text is all of the same directionality, then\r
+     * the method may not perform all the steps described by the algorithm,\r
+     * i.e., some levels may not be the same as if all steps were performed.\r
+     * This is not relevant for unidirectional text.<br>\r
+     * For example, in pure LTR text with numbers the numbers would get\r
+     * a resolved level of 2 higher than the surrounding text according to\r
+     * the algorithm. This implementation may set all resolved levels to\r
+     * the same value in such a case.<p>\r
+     *\r
+     * @param paragraph a paragraph of text with optional character and\r
+     *        paragraph attribute information\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setPara(AttributedCharacterIterator paragraph)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Specify whether block separators must be allocated level zero,\r
+     * so that successive paragraphs will progress from left to right.\r
+     * This method must be called before <code>setPara()</code>.\r
+     * Paragraph separators (B) may appear in the text.  Setting them to level zero\r
+     * means that all paragraph separators (including one possibly appearing\r
+     * in the last text position) are kept in the reordered text after the text\r
+     * that they follow in the source text.\r
+     * When this feature is not enabled, a paragraph separator at the last\r
+     * position of the text before reordering will go to the first position\r
+     * of the reordered text when the paragraph level is odd.\r
+     *\r
+     * @param ordarParaLTR specifies whether paragraph separators (B) must\r
+     * receive level 0, so that successive paragraphs progress from left to right.\r
+     *\r
+     * @see #setPara\r
+     * @stable ICU 3.8\r
+     */\r
+    public void orderParagraphsLTR(boolean ordarParaLTR) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Is this <code>Bidi</code> object set to allocate level 0 to block\r
+     * separators so that successive paragraphs progress from left to right?\r
+     *\r
+     * @return <code>true</code> if the <code>Bidi</code> object is set to\r
+     *         allocate level 0 to block separators.\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public boolean isOrderParagraphsLTR() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the directionality of the text.\r
+     *\r
+     * @return a value of <code>LTR</code>, <code>RTL</code> or <code>MIXED</code>\r
+     *         that indicates if the entire text\r
+     *         represented by this object is unidirectional,\r
+     *         and which direction, or if it is mixed-directional.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #LTR\r
+     * @see #RTL\r
+     * @see #MIXED\r
+     * @stable ICU 3.8\r
+     */\r
+    public byte getDirection()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the text.\r
+     *\r
+     * @return A <code>String</code> containing the text that the\r
+     *         <code>Bidi</code> object was created for.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #setPara\r
+     * @see #setLine\r
+     * @stable ICU 3.8\r
+     */\r
+    public String getTextAsString()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the text.\r
+     *\r
+     * @return A <code>char</code> array containing the text that the\r
+     *         <code>Bidi</code> object was created for.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #setPara\r
+     * @see #setLine\r
+     * @stable ICU 3.8\r
+     */\r
+    public char[] getText()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the length of the text.\r
+     *\r
+     * @return The length of the text that the <code>Bidi</code> object was\r
+     *         created for.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getLength()\r
+    {\r
+        return bidi.getLength();\r
+    }\r
+\r
+    /**\r
+     * Get the length of the source text processed by the last call to\r
+     * <code>setPara()</code>. This length may be different from the length of\r
+     * the source text if option <code>OPTION_STREAMING</code> has been\r
+     * set.\r
+     * <br>\r
+     * Note that whenever the length of the text affects the execution or the\r
+     * result of a method, it is the processed length which must be considered,\r
+     * except for <code>setPara</code> (which receives unprocessed source text)\r
+     * and <code>getLength</code> (which returns the original length of the\r
+     * source text).<br>\r
+     * In particular, the processed length is the one to consider in the\r
+     * following cases:\r
+     * <ul>\r
+     * <li>maximum value of the <code>limit</code> argument of\r
+     * <code>setLine</code></li>\r
+     * <li>maximum value of the <code>charIndex</code> argument of\r
+     * <code>getParagraph</code></li>\r
+     * <li>maximum value of the <code>charIndex</code> argument of\r
+     * <code>getLevelAt</code></li>\r
+     * <li>number of elements in the array returned by <code>getLevels</code>\r
+     * </li>\r
+     * <li>maximum value of the <code>logicalStart</code> argument of\r
+     * <code>getLogicalRun</code></li>\r
+     * <li>maximum value of the <code>logicalIndex</code> argument of\r
+     * <code>getVisualIndex</code></li>\r
+     * <li>number of elements returned by <code>getLogicalMap</code></li>\r
+     * <li>length of text processed by <code>writeReordered</code></li>\r
+     * </ul>\r
+     *\r
+     * @return The length of the part of the source text processed by\r
+     *         the last call to <code>setPara</code>.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #setPara\r
+     * @see #OPTION_STREAMING\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getProcessedLength() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the length of the reordered text resulting from the last call to\r
+     * <code>setPara()</code>. This length may be different from the length\r
+     * of the source text if option <code>OPTION_INSERT_MARKS</code>\r
+     * or option <code>OPTION_REMOVE_CONTROLS</code> has been set.\r
+     * <br>\r
+     * This resulting length is the one to consider in the following cases:\r
+     * <ul>\r
+     * <li>maximum value of the <code>visualIndex</code> argument of\r
+     * <code>getLogicalIndex</code></li>\r
+     * <li>number of elements returned by <code>getVisualMap</code></li>\r
+     * </ul>\r
+     * Note that this length stays identical to the source text length if\r
+     * Bidi marks are inserted or removed using option bits of\r
+     * <code>writeReordered</code>, or if option\r
+     * <code>REORDER_INVERSE_NUMBERS_AS_L</code> has been set.\r
+     *\r
+     * @return The length of the reordered text resulting from\r
+     *         the last call to <code>setPara</code>.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #setPara\r
+     * @see #OPTION_INSERT_MARKS\r
+     * @see #OPTION_REMOVE_CONTROLS\r
+     * @see #REORDER_INVERSE_NUMBERS_AS_L\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getResultLength() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /* paragraphs API methods ------------------------------------------------- */\r
+\r
+    /**\r
+     * Get the paragraph level of the text.\r
+     *\r
+     * @return The paragraph level. If there are multiple paragraphs, their\r
+     *         level may vary if the required paraLevel is LEVEL_DEFAULT_LTR or\r
+     *         LEVEL_DEFAULT_RTL.  In that case, the level of the first paragraph\r
+     *         is returned.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #LEVEL_DEFAULT_LTR\r
+     * @see #LEVEL_DEFAULT_RTL\r
+     * @see #getParagraph\r
+     * @see #getParagraphByIndex\r
+     * @stable ICU 3.8\r
+     */\r
+    public byte getParaLevel()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the number of paragraphs.\r
+     *\r
+     * @return The number of paragraphs.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public int countParagraphs()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get a paragraph, given the index of this paragraph.\r
+     *\r
+     * This method returns information about a paragraph.<p>\r
+     *\r
+     * @param paraIndex is the number of the paragraph, in the\r
+     *        range <code>[0..countParagraphs()-1]</code>.\r
+     *\r
+     * @return a BidiRun object with the details of the paragraph:<br>\r
+     *        <code>start</code> will receive the index of the first character\r
+     *        of the paragraph in the text.<br>\r
+     *        <code>limit</code> will receive the limit of the paragraph.<br>\r
+     *        <code>embeddingLevel</code> will receive the level of the paragraph.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if paraIndex is not in the range\r
+     *        <code>[0..countParagraphs()-1]</code>\r
+     *\r
+     * @see com.ibm.icu.text.BidiRun\r
+     * @stable ICU 3.8\r
+     */\r
+    public BidiRun getParagraphByIndex(int paraIndex)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get a paragraph, given a position within the text.\r
+     * This method returns information about a paragraph.<br>\r
+     * Note: if the paragraph index is known, it is more efficient to\r
+     * retrieve the paragraph information using getParagraphByIndex().<p>\r
+     *\r
+     * @param charIndex is the index of a character within the text, in the\r
+     *        range <code>[0..getProcessedLength()-1]</code>.\r
+     *\r
+     * @return a BidiRun object with the details of the paragraph:<br>\r
+     *        <code>start</code> will receive the index of the first character\r
+     *        of the paragraph in the text.<br>\r
+     *        <code>limit</code> will receive the limit of the paragraph.<br>\r
+     *        <code>embeddingLevel</code> will receive the level of the paragraph.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if charIndex is not within the legal range\r
+     *\r
+     * @see com.ibm.icu.text.BidiRun\r
+     * @see #getParagraphByIndex\r
+     * @see #getProcessedLength\r
+     * @stable ICU 3.8\r
+     */\r
+    public BidiRun getParagraph(int charIndex)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the index of a paragraph, given a position within the text.<p>\r
+     *\r
+     * @param charIndex is the index of a character within the text, in the\r
+     *        range <code>[0..getProcessedLength()-1]</code>.\r
+     *\r
+     * @return The index of the paragraph containing the specified position,\r
+     *         starting from 0.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if charIndex is not within the legal range\r
+     *\r
+     * @see com.ibm.icu.text.BidiRun\r
+     * @see #getProcessedLength\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getParagraphIndex(int charIndex)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Set a custom Bidi classifier used by the UBA implementation for Bidi\r
+     * class determination.\r
+     *\r
+     * @param classifier A new custom classifier. This can be null.\r
+     *\r
+     * @see #getCustomClassifier\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setCustomClassifier(BidiClassifier classifier) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Gets the current custom class classifier used for Bidi class\r
+     * determination.\r
+     *\r
+     * @return An instance of class <code>BidiClassifier</code>\r
+     *\r
+     * @see #setCustomClassifier\r
+     * @stable ICU 3.8\r
+     */\r
+    public BidiClassifier getCustomClassifier() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Retrieves the Bidi class for a given code point.\r
+     * <p>If a <code>BidiClassifier</code> is defined and returns a value\r
+     * other than <code>CLASS_DEFAULT</code>, that value is used; otherwise\r
+     * the default class determination mechanism is invoked.</p>\r
+     *\r
+     * @param c The code point to get a Bidi class for.\r
+     *\r
+     * @return The Bidi class for the character <code>c</code> that is in effect\r
+     *         for this <code>Bidi</code> instance.\r
+     *\r
+     * @see BidiClassifier\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getCustomizedClass(int c) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * <code>setLine()</code> returns a <code>Bidi</code> object to\r
+     * contain the reordering information, especially the resolved levels,\r
+     * for all the characters in a line of text. This line of text is\r
+     * specified by referring to a <code>Bidi</code> object representing\r
+     * this information for a piece of text containing one or more paragraphs,\r
+     * and by specifying a range of indexes in this text.<p>\r
+     * In the new line object, the indexes will range from 0 to <code>limit-start-1</code>.<p>\r
+     *\r
+     * This is used after calling <code>setPara()</code>\r
+     * for a piece of text, and after line-breaking on that text.\r
+     * It is not necessary if each paragraph is treated as a single line.<p>\r
+     *\r
+     * After line-breaking, rules (L1) and (L2) for the treatment of\r
+     * trailing WS and for reordering are performed on\r
+     * a <code>Bidi</code> object that represents a line.<p>\r
+     *\r
+     * <strong>Important: </strong>the line <code>Bidi</code> object may\r
+     * reference data within the global text <code>Bidi</code> object.\r
+     * You should not alter the content of the global text object until\r
+     * you are finished using the line object.\r
+     *\r
+     * @param start is the line's first index into the text.\r
+     *\r
+     * @param limit is just behind the line's last index into the text\r
+     *        (its last index +1).\r
+     *\r
+     * @return a <code>Bidi</code> object that will now represent a line of the text.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code>\r
+     * @throws IllegalArgumentException if start and limit are not in the range\r
+     *         <code>0&lt;=start&lt;limit&lt;=getProcessedLength()</code>,\r
+     *         or if the specified line crosses a paragraph boundary\r
+     *\r
+     * @see #setPara\r
+     * @see #getProcessedLength\r
+     * @stable ICU 3.8\r
+     */\r
+    public Bidi setLine(int start, int limit)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the level for one character.\r
+     *\r
+     * @param charIndex the index of a character.\r
+     *\r
+     * @return The level for the character at <code>charIndex</code>.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if charIndex is not in the range\r
+     *         <code>0&lt;=charIndex&lt;getProcessedLength()</code>\r
+     *\r
+     * @see #getProcessedLength\r
+     * @stable ICU 3.8\r
+     */\r
+    public byte getLevelAt(int charIndex)\r
+    {\r
+        return (byte)bidi.getLevelAt(charIndex);\r
+    }\r
+\r
+    /**\r
+     * Get an array of levels for each character.<p>\r
+     *\r
+     * Note that this method may allocate memory under some\r
+     * circumstances, unlike <code>getLevelAt()</code>.\r
+     *\r
+     * @return The levels array for the text,\r
+     *         or <code>null</code> if an error occurs.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public byte[] getLevels()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get a logical run.\r
+     * This method returns information about a run and is used\r
+     * to retrieve runs in logical order.<p>\r
+     * This is especially useful for line-breaking on a paragraph.\r
+     *\r
+     * @param logicalPosition is a logical position within the source text.\r
+     *\r
+     * @return a BidiRun object filled with <code>start</code> containing\r
+     *        the first character of the run, <code>limit</code> containing\r
+     *        the limit of the run, and <code>embeddingLevel</code> containing\r
+     *        the level of the run.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if logicalPosition is not in the range\r
+     *         <code>0&lt;=logicalPosition&lt;getProcessedLength()</code>\r
+     *\r
+     * @see com.ibm.icu.text.BidiRun\r
+     * @see com.ibm.icu.text.BidiRun#getStart()\r
+     * @see com.ibm.icu.text.BidiRun#getLimit()\r
+     * @see com.ibm.icu.text.BidiRun#getEmbeddingLevel()\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public BidiRun getLogicalRun(int logicalPosition)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the number of runs.\r
+     * This method may invoke the actual reordering on the\r
+     * <code>Bidi</code> object, after <code>setPara()</code>\r
+     * may have resolved only the levels of the text. Therefore,\r
+     * <code>countRuns()</code> may have to allocate memory,\r
+     * and may throw an exception if it fails to do so.\r
+     *\r
+     * @return The number of runs.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public int countRuns()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     *\r
+     * Get a <code>BidiRun</code> object according to its index. BidiRun methods\r
+     * may be used to retrieve the run's logical start, length and level,\r
+     * which can be even for an LTR run or odd for an RTL run.\r
+     * In an RTL run, the character at the logical start is\r
+     * visually on the right of the displayed run.\r
+     * The length is the number of characters in the run.<p>\r
+     * <code>countRuns()</code> is normally called\r
+     * before the runs are retrieved.\r
+     *\r
+     * <p>\r
+     *  Example:\r
+     * <pre>\r
+     *  Bidi bidi = new Bidi();\r
+     *  String text = "abc 123 DEFG xyz";\r
+     *  bidi.setPara(text, Bidi.RTL, null);\r
+     *  int i, count=bidi.countRuns(), logicalStart, visualIndex=0, length;\r
+     *  BidiRun run;\r
+     *  for (i = 0; i &lt; count; ++i) {\r
+     *      run = bidi.getVisualRun(i);\r
+     *      logicalStart = run.getStart();\r
+     *      length = run.getLength();\r
+     *      if (Bidi.LTR == run.getEmbeddingLevel()) {\r
+     *          do { // LTR\r
+     *              show_char(text.charAt(logicalStart++), visualIndex++);\r
+     *          } while (--length &gt; 0);\r
+     *      } else {\r
+     *          logicalStart += length;  // logicalLimit\r
+     *          do { // RTL\r
+     *              show_char(text.charAt(--logicalStart), visualIndex++);\r
+     *          } while (--length &gt; 0);\r
+     *      }\r
+     *  }\r
+     * </pre>\r
+     * <p>\r
+     * Note that in right-to-left runs, code like this places\r
+     * second surrogates before first ones (which is generally a bad idea)\r
+     * and combining characters before base characters.\r
+     * <p>\r
+     * Use of <code>{@link #writeReordered}</code>, optionally with the\r
+     * <code>{@link #KEEP_BASE_COMBINING}</code> option, can be considered in\r
+     * order to avoid these issues.\r
+     *\r
+     * @param runIndex is the number of the run in visual order, in the\r
+     *        range <code>[0..countRuns()-1]</code>.\r
+     *\r
+     * @return a BidiRun object containing the details of the run. The\r
+     *         directionality of the run is\r
+     *         <code>LTR==0</code> or <code>RTL==1</code>,\r
+     *         never <code>MIXED</code>.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if <code>runIndex</code> is not in\r
+     *         the range <code>0&lt;=runIndex&lt;countRuns()</code>\r
+     *\r
+     * @see #countRuns()\r
+     * @see com.ibm.icu.text.BidiRun\r
+     * @see com.ibm.icu.text.BidiRun#getStart()\r
+     * @see com.ibm.icu.text.BidiRun#getLength()\r
+     * @see com.ibm.icu.text.BidiRun#getEmbeddingLevel()\r
+     * @stable ICU 3.8\r
+     */\r
+    public BidiRun getVisualRun(int runIndex)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get the visual position from a logical text position.\r
+     * If such a mapping is used many times on the same\r
+     * <code>Bidi</code> object, then calling\r
+     * <code>getLogicalMap()</code> is more efficient.\r
+     * <p>\r
+     * The value returned may be <code>MAP_NOWHERE</code> if there is no\r
+     * visual position because the corresponding text character is a Bidi\r
+     * control removed from output by the option\r
+     * <code>OPTION_REMOVE_CONTROLS</code>.\r
+     * <p>\r
+     * When the visual output is altered by using options of\r
+     * <code>writeReordered()</code> such as <code>INSERT_LRM_FOR_NUMERIC</code>,\r
+     * <code>KEEP_BASE_COMBINING</code>, <code>OUTPUT_REVERSE</code>,\r
+     * <code>REMOVE_BIDI_CONTROLS</code>, the visual position returned may not\r
+     * be correct. It is advised to use, when possible, reordering options\r
+     * such as {@link #OPTION_INSERT_MARKS} and {@link #OPTION_REMOVE_CONTROLS}.\r
+     * <p>\r
+     * Note that in right-to-left runs, this mapping places\r
+     * second surrogates before first ones (which is generally a bad idea)\r
+     * and combining characters before base characters.\r
+     * Use of <code>{@link #writeReordered}</code>, optionally with the\r
+     * <code>{@link #KEEP_BASE_COMBINING}</code> option can be considered instead\r
+     * of using the mapping, in order to avoid these issues.\r
+     *\r
+     * @param logicalIndex is the index of a character in the text.\r
+     *\r
+     * @return The visual position of this character.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if <code>logicalIndex</code> is not in\r
+     *         the range <code>0&lt;=logicalIndex&lt;getProcessedLength()</code>\r
+     *\r
+     * @see #getLogicalMap\r
+     * @see #getLogicalIndex\r
+     * @see #getProcessedLength\r
+     * @see #MAP_NOWHERE\r
+     * @see #OPTION_REMOVE_CONTROLS\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getVisualIndex(int logicalIndex)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+\r
+    /**\r
+     * Get the logical text position from a visual position.\r
+     * If such a mapping is used many times on the same\r
+     * <code>Bidi</code> object, then calling\r
+     * <code>getVisualMap()</code> is more efficient.\r
+     * <p>\r
+     * The value returned may be <code>MAP_NOWHERE</code> if there is no\r
+     * logical position because the corresponding text character is a Bidi\r
+     * mark inserted in the output by option\r
+     * <code>OPTION_INSERT_MARKS</code>.\r
+     * <p>\r
+     * This is the inverse method to <code>getVisualIndex()</code>.\r
+     * <p>\r
+     * When the visual output is altered by using options of\r
+     * <code>writeReordered()</code> such as <code>INSERT_LRM_FOR_NUMERIC</code>,\r
+     * <code>KEEP_BASE_COMBINING</code>, <code>OUTPUT_REVERSE</code>,\r
+     * <code>REMOVE_BIDI_CONTROLS</code>, the logical position returned may not\r
+     * be correct. It is advised to use, when possible, reordering options\r
+     * such as {@link #OPTION_INSERT_MARKS} and {@link #OPTION_REMOVE_CONTROLS}.\r
+     *\r
+     * @param visualIndex is the visual position of a character.\r
+     *\r
+     * @return The index of this character in the text.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if <code>visualIndex</code> is not in\r
+     *         the range <code>0&lt;=visualIndex&lt;getResultLength()</code>\r
+     *\r
+     * @see #getVisualMap\r
+     * @see #getVisualIndex\r
+     * @see #getResultLength\r
+     * @see #MAP_NOWHERE\r
+     * @see #OPTION_INSERT_MARKS\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getLogicalIndex(int visualIndex)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get a logical-to-visual index map (array) for the characters in the\r
+     * <code>Bidi</code> (paragraph or line) object.\r
+     * <p>\r
+     * Some values in the map may be <code>MAP_NOWHERE</code> if the\r
+     * corresponding text characters are Bidi controls removed from the visual\r
+     * output by the option <code>OPTION_REMOVE_CONTROLS</code>.\r
+     * <p>\r
+     * When the visual output is altered by using options of\r
+     * <code>writeReordered()</code> such as <code>INSERT_LRM_FOR_NUMERIC</code>,\r
+     * <code>KEEP_BASE_COMBINING</code>, <code>OUTPUT_REVERSE</code>,\r
+     * <code>REMOVE_BIDI_CONTROLS</code>, the visual positions returned may not\r
+     * be correct. It is advised to use, when possible, reordering options\r
+     * such as {@link #OPTION_INSERT_MARKS} and {@link #OPTION_REMOVE_CONTROLS}.\r
+     * <p>\r
+     * Note that in right-to-left runs, this mapping places\r
+     * second surrogates before first ones (which is generally a bad idea)\r
+     * and combining characters before base characters.\r
+     * Use of <code>{@link #writeReordered}</code>, optionally with the\r
+     * <code>{@link #KEEP_BASE_COMBINING}</code> option can be considered instead\r
+     * of using the mapping, in order to avoid these issues.\r
+     *\r
+     * @return an array of <code>getProcessedLength()</code>\r
+     *        indexes which will reflect the reordering of the characters.<br><br>\r
+     *        The index map will result in\r
+     *        <code>indexMap[logicalIndex]==visualIndex</code>, where\r
+     *        <code>indexMap</code> represents the returned array.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #getVisualMap\r
+     * @see #getVisualIndex\r
+     * @see #getProcessedLength\r
+     * @see #MAP_NOWHERE\r
+     * @see #OPTION_REMOVE_CONTROLS\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public int[] getLogicalMap()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Get a visual-to-logical index map (array) for the characters in the\r
+     * <code>Bidi</code> (paragraph or line) object.\r
+     * <p>\r
+     * Some values in the map may be <code>MAP_NOWHERE</code> if the\r
+     * corresponding text characters are Bidi marks inserted in the visual\r
+     * output by the option <code>OPTION_INSERT_MARKS</code>.\r
+     * <p>\r
+     * When the visual output is altered by using options of\r
+     * <code>writeReordered()</code> such as <code>INSERT_LRM_FOR_NUMERIC</code>,\r
+     * <code>KEEP_BASE_COMBINING</code>, <code>OUTPUT_REVERSE</code>,\r
+     * <code>REMOVE_BIDI_CONTROLS</code>, the logical positions returned may not\r
+     * be correct. It is advised to use, when possible, reordering options\r
+     * such as {@link #OPTION_INSERT_MARKS} and {@link #OPTION_REMOVE_CONTROLS}.\r
+     *\r
+     * @return an array of <code>getResultLength()</code>\r
+     *        indexes which will reflect the reordering of the characters.<br><br>\r
+     *        The index map will result in\r
+     *        <code>indexMap[visualIndex]==logicalIndex</code>, where\r
+     *        <code>indexMap</code> represents the returned array.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #getLogicalMap\r
+     * @see #getLogicalIndex\r
+     * @see #getResultLength\r
+     * @see #MAP_NOWHERE\r
+     * @see #OPTION_INSERT_MARKS\r
+     * @see #writeReordered\r
+     * @stable ICU 3.8\r
+     */\r
+    public int[] getVisualMap()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * This is a convenience method that does not use a <code>Bidi</code> object.\r
+     * It is intended to be used for when an application has determined the levels\r
+     * of objects (character sequences) and just needs to have them reordered (L2).\r
+     * This is equivalent to using <code>getLogicalMap()</code> on a\r
+     * <code>Bidi</code> object.\r
+     *\r
+     * @param levels is an array of levels that have been determined by\r
+     *        the application.\r
+     *\r
+     * @return an array of <code>levels.length</code>\r
+     *        indexes which will reflect the reordering of the characters.<p>\r
+     *        The index map will result in\r
+     *        <code>indexMap[logicalIndex]==visualIndex</code>, where\r
+     *        <code>indexMap</code> represents the returned array.\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public static int[] reorderLogical(byte[] levels)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * This is a convenience method that does not use a <code>Bidi</code> object.\r
+     * It is intended to be used for when an application has determined the levels\r
+     * of objects (character sequences) and just needs to have them reordered (L2).\r
+     * This is equivalent to using <code>getVisualMap()</code> on a\r
+     * <code>Bidi</code> object.\r
+     *\r
+     * @param levels is an array of levels that have been determined by\r
+     *        the application.\r
+     *\r
+     * @return an array of <code>levels.length</code>\r
+     *        indexes which will reflect the reordering of the characters.<p>\r
+     *        The index map will result in\r
+     *        <code>indexMap[visualIndex]==logicalIndex</code>, where\r
+     *        <code>indexMap</code> represents the returned array.\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public static int[] reorderVisual(byte[] levels)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Invert an index map.\r
+     * The index mapping of the argument map is inverted and returned as\r
+     * an array of indexes that we will call the inverse map.\r
+     *\r
+     * @param srcMap is an array whose elements define the original mapping\r
+     * from a source array to a destination array.\r
+     * Some elements of the source array may have no mapping in the\r
+     * destination array. In that case, their value will be\r
+     * the special value <code>MAP_NOWHERE</code>.\r
+     * All elements must be >=0 or equal to <code>MAP_NOWHERE</code>.\r
+     * Some elements in the source map may have a value greater than the\r
+     * srcMap.length if the destination array has more elements than the\r
+     * source array.\r
+     * There must be no duplicate indexes (two or more elements with the\r
+     * same value except <code>MAP_NOWHERE</code>).\r
+     *\r
+     * @return an array representing the inverse map.\r
+     *         This array has a number of elements equal to 1 + the highest\r
+     *         value in <code>srcMap</code>.\r
+     *         For elements of the result array which have no matching elements\r
+     *         in the source array, the corresponding elements in the inverse\r
+     *         map will receive a value equal to <code>MAP_NOWHERE</code>.\r
+     *         If element with index i in <code>srcMap</code> has a value k different\r
+     *         from <code>MAP_NOWHERE</code>, this means that element i of\r
+     *         the source array maps to element k in the destination array.\r
+     *         The inverse map will have value i in its k-th element.\r
+     *         For all elements of the destination array which do not map to\r
+     *         an element in the source array, the corresponding element in the\r
+     *         inverse map will have a value equal to <code>MAP_NOWHERE</code>.\r
+     *\r
+     * @see #MAP_NOWHERE\r
+     * @stable ICU 3.8\r
+     */\r
+    public static int[] invertMap(int[] srcMap)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /*\r
+     * Fields and methods for compatibility with java.text.bidi (Sun implementation)\r
+     */\r
+\r
+    /**\r
+     * Constant indicating base direction is left-to-right.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int DIRECTION_LEFT_TO_RIGHT = LTR;\r
+\r
+    /**\r
+     * Constant indicating base direction is right-to-left.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int DIRECTION_RIGHT_TO_LEFT = RTL;\r
+\r
+    /**\r
+     * Constant indicating that the base direction depends on the first strong\r
+     * directional character in the text according to the Unicode Bidirectional\r
+     * Algorithm. If no strong directional character is present, the base\r
+     * direction is left-to-right.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT = LEVEL_DEFAULT_LTR;\r
+\r
+    /**\r
+     * Constant indicating that the base direction depends on the first strong\r
+     * directional character in the text according to the Unicode Bidirectional\r
+     * Algorithm. If no strong directional character is present, the base\r
+     * direction is right-to-left.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT = LEVEL_DEFAULT_RTL;\r
+\r
+    /**\r
+     * Create Bidi from the given paragraph of text and base direction.\r
+     *\r
+     * @param paragraph a paragraph of text\r
+     * @param flags a collection of flags that control the algorithm. The\r
+     *        algorithm understands the flags DIRECTION_LEFT_TO_RIGHT,\r
+     *        DIRECTION_RIGHT_TO_LEFT, DIRECTION_DEFAULT_LEFT_TO_RIGHT, and\r
+     *        DIRECTION_DEFAULT_RIGHT_TO_LEFT. Other values are reserved.\r
+     * @see #DIRECTION_LEFT_TO_RIGHT\r
+     * @see #DIRECTION_RIGHT_TO_LEFT\r
+     * @see #DIRECTION_DEFAULT_LEFT_TO_RIGHT\r
+     * @see #DIRECTION_DEFAULT_RIGHT_TO_LEFT\r
+     * @stable ICU 3.8\r
+     */\r
+    public Bidi(String paragraph, int flags)\r
+    {\r
+        // Note: ICU and Oracle JDK are using the\r
+        // same DIRECTION_* flags definitions.\r
+        this(new java.text.Bidi(paragraph, flags));\r
+    }\r
+\r
+    /**\r
+     * Create Bidi from the given paragraph of text.<p>\r
+     *\r
+     * The RUN_DIRECTION attribute in the text, if present, determines the base\r
+     * direction (left-to-right or right-to-left). If not present, the base\r
+     * direction is computed using the Unicode Bidirectional Algorithm,\r
+     * defaulting to left-to-right if there are no strong directional characters\r
+     * in the text. This attribute, if present, must be applied to all the text\r
+     * in the paragraph.<p>\r
+     *\r
+     * The BIDI_EMBEDDING attribute in the text, if present, represents\r
+     * embedding level information. Negative values from -1 to -62 indicate\r
+     * overrides at the absolute value of the level. Positive values from 1 to\r
+     * 62 indicate embeddings. Where values are zero or not defined, the base\r
+     * embedding level as determined by the base direction is assumed.<p>\r
+     *\r
+     * The NUMERIC_SHAPING attribute in the text, if present, converts European\r
+     * digits to other decimal digits before running the bidi algorithm. This\r
+     * attribute, if present, must be applied to all the text in the paragraph.<p>\r
+     *\r
+     * Note: this constructor calls setPara() internally.\r
+     *\r
+     * @param paragraph a paragraph of text with optional character and\r
+     *        paragraph attribute information\r
+     * @stable ICU 3.8\r
+     */\r
+    public Bidi(AttributedCharacterIterator paragraph)\r
+    {\r
+        // ICU does not define its own attributes and just\r
+        // use java.awt.font.TextAttribute. Thus, no mappings\r
+        // are necessary.\r
+        this(new java.text.Bidi(paragraph));\r
+    }\r
+\r
+    /**\r
+     * Create Bidi from the given text, embedding, and direction information.\r
+     * The embeddings array may be null. If present, the values represent\r
+     * embedding level information. Negative values from -1 to -61 indicate\r
+     * overrides at the absolute value of the level. Positive values from 1 to\r
+     * 61 indicate embeddings. Where values are zero, the base embedding level\r
+     * as determined by the base direction is assumed.<p>\r
+     *\r
+     * Note: this constructor calls setPara() internally.\r
+     *\r
+     * @param text an array containing the paragraph of text to process.\r
+     * @param textStart the index into the text array of the start of the\r
+     *        paragraph.\r
+     * @param embeddings an array containing embedding values for each character\r
+     *        in the paragraph. This can be null, in which case it is assumed\r
+     *        that there is no external embedding information.\r
+     * @param embStart the index into the embedding array of the start of the\r
+     *        paragraph.\r
+     * @param paragraphLength the length of the paragraph in the text and\r
+     *        embeddings arrays.\r
+     * @param flags a collection of flags that control the algorithm. The\r
+     *        algorithm understands the flags DIRECTION_LEFT_TO_RIGHT,\r
+     *        DIRECTION_RIGHT_TO_LEFT, DIRECTION_DEFAULT_LEFT_TO_RIGHT, and\r
+     *        DIRECTION_DEFAULT_RIGHT_TO_LEFT. Other values are reserved.\r
+     *\r
+     * @throws IllegalArgumentException if the values in embeddings are\r
+     *         not within the allowed range\r
+     *\r
+     * @see #DIRECTION_LEFT_TO_RIGHT\r
+     * @see #DIRECTION_RIGHT_TO_LEFT\r
+     * @see #DIRECTION_DEFAULT_LEFT_TO_RIGHT\r
+     * @see #DIRECTION_DEFAULT_RIGHT_TO_LEFT\r
+     * @stable ICU 3.8\r
+     */\r
+    public Bidi(char[] text,\r
+            int textStart,\r
+            byte[] embeddings,\r
+            int embStart,\r
+            int paragraphLength,\r
+            int flags)\r
+    {\r
+        // Note: ICU and Oracle JDK are using the\r
+        // same DIRECTION_* flags definitions.\r
+        this(new java.text.Bidi(text, textStart, embeddings, embStart, paragraphLength, flags));\r
+    }\r
+\r
+    /**\r
+     * Create a Bidi object representing the bidi information on a line of text\r
+     * within the paragraph represented by the current Bidi. This call is not\r
+     * required if the entire paragraph fits on one line.\r
+     *\r
+     * @param lineStart the offset from the start of the paragraph to the start\r
+     *        of the line.\r
+     * @param lineLimit the offset from the start of the paragraph to the limit\r
+     *        of the line.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code>\r
+     * @throws IllegalArgumentException if lineStart and lineLimit are not in the range\r
+     *         <code>0&lt;=lineStart&lt;lineLimit&lt;=getProcessedLength()</code>,\r
+     *         or if the specified line crosses a paragraph boundary\r
+     * @stable ICU 3.8\r
+     */\r
+    public Bidi createLineBidi(int lineStart, int lineLimit)\r
+    {\r
+        return new Bidi(bidi.createLineBidi(lineStart, lineLimit));\r
+    }\r
+\r
+    /**\r
+     * Return true if the line is not left-to-right or right-to-left. This means\r
+     * it either has mixed runs of left-to-right and right-to-left text, or the\r
+     * base direction differs from the direction of the only run of text.\r
+     *\r
+     * @return true if the line is not left-to-right or right-to-left.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public boolean isMixed()\r
+    {\r
+        return bidi.isMixed();\r
+    }\r
+\r
+    /**\r
+     * Return true if the line is all left-to-right text and the base direction\r
+     * is left-to-right.\r
+     *\r
+     * @return true if the line is all left-to-right text and the base direction\r
+     *         is left-to-right.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public boolean isLeftToRight()\r
+    {\r
+        return bidi.isLeftToRight();\r
+    }\r
+\r
+    /**\r
+     * Return true if the line is all right-to-left text, and the base direction\r
+     * is right-to-left\r
+     *\r
+     * @return true if the line is all right-to-left text, and the base\r
+     *         direction is right-to-left\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public boolean isRightToLeft()\r
+    {\r
+        return bidi.isRightToLeft();\r
+    }\r
+\r
+    /**\r
+     * Return true if the base direction is left-to-right\r
+     *\r
+     * @return true if the base direction is left-to-right\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public boolean baseIsLeftToRight()\r
+    {\r
+        return bidi.baseIsLeftToRight();\r
+    }\r
+\r
+    /**\r
+     * Return the base level (0 if left-to-right, 1 if right-to-left).\r
+     *\r
+     * @return the base level\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getBaseLevel()\r
+    {\r
+        return bidi.getBaseLevel();\r
+    }\r
+\r
+    /**\r
+     * Return the number of level runs.\r
+     *\r
+     * @return the number of level runs\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getRunCount()\r
+    {\r
+        return bidi.getRunCount();\r
+    }\r
+\r
+    /**\r
+     * Return the level of the nth logical run in this line.\r
+     *\r
+     * @param run the index of the run, between 0 and <code>countRuns()-1</code>\r
+     *\r
+     * @return the level of the run\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if <code>run</code> is not in\r
+     *         the range <code>0&lt;=run&lt;countRuns()</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getRunLevel(int run)\r
+    {\r
+        return bidi.getRunLevel(run);\r
+    }\r
+\r
+    /**\r
+     * Return the index of the character at the start of the nth logical run in\r
+     * this line, as an offset from the start of the line.\r
+     *\r
+     * @param run the index of the run, between 0 and <code>countRuns()</code>\r
+     *\r
+     * @return the start of the run\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if <code>run</code> is not in\r
+     *         the range <code>0&lt;=run&lt;countRuns()</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getRunStart(int run)\r
+    {\r
+        return bidi.getRunStart(run);\r
+    }\r
+\r
+    /**\r
+     * Return the index of the character past the end of the nth logical run in\r
+     * this line, as an offset from the start of the line. For example, this\r
+     * will return the length of the line for the last run on the line.\r
+     *\r
+     * @param run the index of the run, between 0 and <code>countRuns()</code>\r
+     *\r
+     * @return the limit of the run\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     * @throws IllegalArgumentException if <code>run</code> is not in\r
+     *         the range <code>0&lt;=run&lt;countRuns()</code>\r
+     * @stable ICU 3.8\r
+     */\r
+    public int getRunLimit(int run)\r
+    {\r
+        return bidi.getRunLimit(run);\r
+    }\r
+\r
+    /**\r
+     * Return true if the specified text requires bidi analysis. If this returns\r
+     * false, the text will display left-to-right. Clients can then avoid\r
+     * constructing a Bidi object. Text in the Arabic Presentation Forms area of\r
+     * Unicode is presumed to already be shaped and ordered for display, and so\r
+     * will not cause this method to return true.\r
+     *\r
+     * @param text the text containing the characters to test\r
+     * @param start the start of the range of characters to test\r
+     * @param limit the limit of the range of characters to test\r
+     *\r
+     * @return true if the range of characters requires bidi analysis\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public static boolean requiresBidi(char[] text,\r
+            int start,\r
+            int limit)\r
+    {\r
+        return java.text.Bidi.requiresBidi(text, start, limit);\r
+    }\r
+\r
+    /**\r
+     * Reorder the objects in the array into visual order based on their levels.\r
+     * This is a utility method to use when you have a collection of objects\r
+     * representing runs of text in logical order, each run containing text at a\r
+     * single level. The elements at <code>index</code> from\r
+     * <code>objectStart</code> up to <code>objectStart + count</code> in the\r
+     * objects array will be reordered into visual order assuming\r
+     * each run of text has the level indicated by the corresponding element in\r
+     * the levels array (at <code>index - objectStart + levelStart</code>).\r
+     *\r
+     * @param levels an array representing the bidi level of each object\r
+     * @param levelStart the start position in the levels array\r
+     * @param objects the array of objects to be reordered into visual order\r
+     * @param objectStart the start position in the objects array\r
+     * @param count the number of objects to reorder\r
+     * @stable ICU 3.8\r
+     */\r
+    public static void reorderVisually(byte[] levels,\r
+            int levelStart,\r
+            Object[] objects,\r
+            int objectStart,\r
+            int count)\r
+    {\r
+        java.text.Bidi.reorderVisually(levels, levelStart, objects, objectStart, count);\r
+    }\r
+\r
+    /**\r
+     * Take a <code>Bidi</code> object containing the reordering\r
+     * information for a piece of text (one or more paragraphs) set by\r
+     * <code>setPara()</code> or for a line of text set by <code>setLine()</code>\r
+     * and return a string containing the reordered text.\r
+     *\r
+     * <p>The text may have been aliased (only a reference was stored\r
+     * without copying the contents), thus it must not have been modified\r
+     * since the <code>setPara()</code> call.</p>\r
+     *\r
+     * This method preserves the integrity of characters with multiple\r
+     * code units and (optionally) combining characters.\r
+     * Characters in RTL runs can be replaced by mirror-image characters\r
+     * in the returned string. Note that "real" mirroring has to be done in a\r
+     * rendering engine by glyph selection and that for many "mirrored"\r
+     * characters there are no Unicode characters as mirror-image equivalents.\r
+     * There are also options to insert or remove Bidi control\r
+     * characters; see the descriptions of the return value and the\r
+     * <code>options</code> parameter, and of the option bit flags.\r
+     *\r
+     * @param options A bit set of options for the reordering that control\r
+     *                how the reordered text is written.\r
+     *                The options include mirroring the characters on a code\r
+     *                point basis and inserting LRM characters, which is used\r
+     *                especially for transforming visually stored text\r
+     *                to logically stored text (although this is still an\r
+     *                imperfect implementation of an "inverse Bidi" algorithm\r
+     *                because it uses the "forward Bidi" algorithm at its core).\r
+     *                The available options are:\r
+     *                <code>DO_MIRRORING</code>,\r
+     *                <code>INSERT_LRM_FOR_NUMERIC</code>,\r
+     *                <code>KEEP_BASE_COMBINING</code>,\r
+     *                <code>OUTPUT_REVERSE</code>,\r
+     *                <code>REMOVE_BIDI_CONTROLS</code>,\r
+     *                <code>STREAMING</code>\r
+     *\r
+     * @return The reordered text.\r
+     *         If the <code>INSERT_LRM_FOR_NUMERIC</code> option is set, then\r
+     *         the length of the returned string could be as large as\r
+     *         <code>getLength()+2*countRuns()</code>.<br>\r
+     *         If the <code>REMOVE_BIDI_CONTROLS</code> option is set, then the\r
+     *         length of the returned string may be less than\r
+     *         <code>getLength()</code>.<br>\r
+     *         If none of these options is set, then the length of the returned\r
+     *         string will be exactly <code>getProcessedLength()</code>.\r
+     *\r
+     * @throws IllegalStateException if this call is not preceded by a successful\r
+     *         call to <code>setPara</code> or <code>setLine</code>\r
+     *\r
+     * @see #DO_MIRRORING\r
+     * @see #INSERT_LRM_FOR_NUMERIC\r
+     * @see #KEEP_BASE_COMBINING\r
+     * @see #OUTPUT_REVERSE\r
+     * @see #REMOVE_BIDI_CONTROLS\r
+     * @see #OPTION_STREAMING\r
+     * @see #getProcessedLength\r
+     * @stable ICU 3.8\r
+     */\r
+    public String writeReordered(int options)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Reverse a Right-To-Left run of Unicode text.\r
+     *\r
+     * This method preserves the integrity of characters with multiple\r
+     * code units and (optionally) combining characters.\r
+     * Characters can be replaced by mirror-image characters\r
+     * in the destination buffer. Note that "real" mirroring has\r
+     * to be done in a rendering engine by glyph selection\r
+     * and that for many "mirrored" characters there are no\r
+     * Unicode characters as mirror-image equivalents.\r
+     * There are also options to insert or remove Bidi control\r
+     * characters.\r
+     *\r
+     * This method is the implementation for reversing RTL runs as part\r
+     * of <code>writeReordered()</code>. For detailed descriptions\r
+     * of the parameters, see there.\r
+     * Since no Bidi controls are inserted here, the output string length\r
+     * will never exceed <code>src.length()</code>.\r
+     *\r
+     * @see #writeReordered\r
+     *\r
+     * @param src The RTL run text.\r
+     *\r
+     * @param options A bit set of options for the reordering that control\r
+     *                how the reordered text is written.\r
+     *                See the <code>options</code> parameter in <code>writeReordered()</code>.\r
+     *\r
+     * @return The reordered text.\r
+     *         If the <code>REMOVE_BIDI_CONTROLS</code> option\r
+     *         is set, then the length of the returned string may be less than\r
+     *         <code>src.length()</code>. If this option is not set,\r
+     *         then the length of the returned string will be exactly\r
+     *         <code>src.length()</code>.\r
+     *\r
+     * @throws IllegalArgumentException if <code>src</code> is null.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static String writeReverse(String src, int options)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiClassifier.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiClassifier.java
new file mode 100644 (file)
index 0000000..5063e7c
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2011, International Business Machines Corporation and         *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.text;\r
+\r
+/*\r
+ * Empty stub\r
+ */\r
+public class BidiClassifier {\r
+    private BidiClassifier() {}\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiRun.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BidiRun.java
new file mode 100644 (file)
index 0000000..4846816
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2011, International Business Machines Corporation and         *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.text;\r
+\r
+/*\r
+ * Empty stub\r
+ */\r
+public class BidiRun {\r
+    private BidiRun() {}\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BreakIterator.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/BreakIterator.java
new file mode 100644 (file)
index 0000000..5b0922f
--- /dev/null
@@ -0,0 +1,833 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.text;\r
+\r
+import java.text.CharacterIterator;\r
+import java.text.StringCharacterIterator;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.util.ULocale;\r
+\r
+/**\r
+ * {@icuenhanced java.text.BreakIterator}.{@icu _usage_}\r
+ *\r
+ * <p>A class that locates boundaries in text.  This class defines a protocol for\r
+ * objects that break up a piece of natural-language text according to a set\r
+ * of criteria.  Instances or subclasses of BreakIterator can be provided, for\r
+ * example, to break a piece of text into words, sentences, or logical characters\r
+ * according to the conventions of some language or group of languages.\r
+ *\r
+ * We provide five built-in types of BreakIterator:\r
+ * <ul><li>getTitleInstance() returns a BreakIterator that locates boundaries\r
+ * between title breaks.\r
+ * <li>getSentenceInstance() returns a BreakIterator that locates boundaries\r
+ * between sentences.  This is useful for triple-click selection, for example.\r
+ * <li>getWordInstance() returns a BreakIterator that locates boundaries between\r
+ * words.  This is useful for double-click selection or "find whole words" searches.\r
+ * This type of BreakIterator makes sure there is a boundary position at the\r
+ * beginning and end of each legal word.  (Numbers count as words, too.)  Whitespace\r
+ * and punctuation are kept separate from real words.\r
+ * <li>getLineInstance() returns a BreakIterator that locates positions where it is\r
+ * legal for a text editor to wrap lines.  This is similar to word breaking, but\r
+ * not the same: punctuation and whitespace are generally kept with words (you don't\r
+ * want a line to start with whitespace, for example), and some special characters\r
+ * can force a position to be considered a line-break position or prevent a position\r
+ * from being a line-break position.\r
+ * <li>getCharacterInstance() returns a BreakIterator that locates boundaries between\r
+ * logical characters.  Because of the structure of the Unicode encoding, a logical\r
+ * character may be stored internally as more than one Unicode code point.  (A with an\r
+ * umlaut may be stored as an a followed by a separate combining umlaut character,\r
+ * for example, but the user still thinks of it as one character.)  This iterator allows\r
+ * various processes (especially text editors) to treat as characters the units of text\r
+ * that a user would think of as characters, rather than the units of text that the\r
+ * computer sees as "characters".</ul>\r
+ *\r
+ * BreakIterator's interface follows an "iterator" model (hence the name), meaning it\r
+ * has a concept of a "current position" and methods like first(), last(), next(),\r
+ * and previous() that update the current position.  All BreakIterators uphold the\r
+ * following invariants:\r
+ * <ul><li>The beginning and end of the text are always treated as boundary positions.\r
+ * <li>The current position of the iterator is always a boundary position (random-\r
+ * access methods move the iterator to the nearest boundary position before or\r
+ * after the specified position, not _to_ the specified position).\r
+ * <li>DONE is used as a flag to indicate when iteration has stopped.  DONE is only\r
+ * returned when the current position is the end of the text and the user calls next(),\r
+ * or when the current position is the beginning of the text and the user calls\r
+ * previous().\r
+ * <li>Break positions are numbered by the positions of the characters that follow\r
+ * them.  Thus, under normal circumstances, the position before the first character\r
+ * is 0, the position after the first character is 1, and the position after the\r
+ * last character is 1 plus the length of the string.\r
+ * <li>The client can change the position of an iterator, or the text it analyzes,\r
+ * at will, but cannot change the behavior.  If the user wants different behavior, he\r
+ * must instantiate a new iterator.</ul>\r
+ *\r
+ * BreakIterator accesses the text it analyzes through a CharacterIterator, which makes\r
+ * it possible to use BreakIterator to analyze text in any text-storage vehicle that\r
+ * provides a CharacterIterator interface.\r
+ *\r
+ * <b>Note:</b>  Some types of BreakIterator can take a long time to create, and\r
+ * instances of BreakIterator are not currently cached by the system.  For\r
+ * optimal performance, keep instances of BreakIterator around as long as makes\r
+ * sense.  For example, when word-wrapping a document, don't create and destroy a\r
+ * new BreakIterator for each line.  Create one break iterator for the whole document\r
+ * (or whatever stretch of text you're wrapping) and use it to do the whole job of\r
+ * wrapping the text.\r
+ *\r
+  * <P>\r
+ * <strong>Examples</strong>:<P>\r
+ * Creating and using text boundaries\r
+ * <blockquote>\r
+ * <pre>\r
+ * public static void main(String args[]) {\r
+ *      if (args.length == 1) {\r
+ *          String stringToExamine = args[0];\r
+ *          //print each word in order\r
+ *          BreakIterator boundary = BreakIterator.getWordInstance();\r
+ *          boundary.setText(stringToExamine);\r
+ *          printEachForward(boundary, stringToExamine);\r
+ *          //print each sentence in reverse order\r
+ *          boundary = BreakIterator.getSentenceInstance(Locale.US);\r
+ *          boundary.setText(stringToExamine);\r
+ *          printEachBackward(boundary, stringToExamine);\r
+ *          printFirst(boundary, stringToExamine);\r
+ *          printLast(boundary, stringToExamine);\r
+ *      }\r
+ * }\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * Print each element in order\r
+ * <blockquote>\r
+ * <pre>\r
+ * public static void printEachForward(BreakIterator boundary, String source) {\r
+ *     int start = boundary.first();\r
+ *     for (int end = boundary.next();\r
+ *          end != BreakIterator.DONE;\r
+ *          start = end, end = boundary.next()) {\r
+ *          System.out.println(source.substring(start,end));\r
+ *     }\r
+ * }\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * Print each element in reverse order\r
+ * <blockquote>\r
+ * <pre>\r
+ * public static void printEachBackward(BreakIterator boundary, String source) {\r
+ *     int end = boundary.last();\r
+ *     for (int start = boundary.previous();\r
+ *          start != BreakIterator.DONE;\r
+ *          end = start, start = boundary.previous()) {\r
+ *         System.out.println(source.substring(start,end));\r
+ *     }\r
+ * }\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * Print first element\r
+ * <blockquote>\r
+ * <pre>\r
+ * public static void printFirst(BreakIterator boundary, String source) {\r
+ *     int start = boundary.first();\r
+ *     int end = boundary.next();\r
+ *     System.out.println(source.substring(start,end));\r
+ * }\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * Print last element\r
+ * <blockquote>\r
+ * <pre>\r
+ * public static void printLast(BreakIterator boundary, String source) {\r
+ *     int end = boundary.last();\r
+ *     int start = boundary.previous();\r
+ *     System.out.println(source.substring(start,end));\r
+ * }\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * Print the element at a specified position\r
+ * <blockquote>\r
+ * <pre>\r
+ * public static void printAt(BreakIterator boundary, int pos, String source) {\r
+ *     int end = boundary.following(pos);\r
+ *     int start = boundary.previous();\r
+ *     System.out.println(source.substring(start,end));\r
+ * }\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * Find the next word\r
+ * <blockquote>\r
+ * <pre>\r
+ * public static int nextWordStartAfter(int pos, String text) {\r
+ *     BreakIterator wb = BreakIterator.getWordInstance();\r
+ *     wb.setText(text);\r
+ *     int last = wb.following(pos);\r
+ *     int current = wb.next();\r
+ *     while (current != BreakIterator.DONE) {\r
+ *         for (int p = last; p < current; p++) {\r
+ *             if (Character.isLetter(text.charAt(p)))\r
+ *                 return last;\r
+ *         }\r
+ *         last = current;\r
+ *         current = wb.next();\r
+ *     }\r
+ *     return BreakIterator.DONE;\r
+ * }\r
+ * </pre>\r
+ * (The iterator returned by BreakIterator.getWordInstance() is unique in that\r
+ * the break positions it returns don't represent both the start and end of the\r
+ * thing being iterated over.  That is, a sentence-break iterator returns breaks\r
+ * that each represent the end of one sentence and the beginning of the next.\r
+ * With the word-break iterator, the characters between two boundaries might be a\r
+ * word, or they might be the punctuation or whitespace between two words.  The\r
+ * above code uses a simple heuristic to determine which boundary is the beginning\r
+ * of a word: If the characters between this boundary and the next boundary\r
+ * include at least one letter (this can be an alphabetical letter, a CJK ideograph,\r
+ * a Hangul syllable, a Kana character, etc.), then the text between this boundary\r
+ * and the next is a word; otherwise, it's the material between words.)\r
+ * </blockquote>\r
+ *\r
+ * @see CharacterIterator\r
+ * @stable ICU 2.0\r
+ *\r
+ */\r
+\r
+public abstract class BreakIterator implements Cloneable\r
+{\r
+\r
+    /**\r
+     * Default constructor.  There is no state that is carried by this abstract\r
+     * base class.\r
+     * @stable ICU 2.0\r
+     */\r
+    protected BreakIterator()\r
+    {\r
+    }\r
+\r
+    /**\r
+     * Clone method.  Creates another BreakIterator with the same behavior and\r
+     * current state as this one.\r
+     * @return The clone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone()\r
+    {\r
+        try {\r
+            return super.clone();\r
+        }\r
+        catch (CloneNotSupportedException e) {\r
+            ///CLOVER:OFF\r
+            throw new IllegalStateException();\r
+            ///CLOVER:ON\r
+        }\r
+    }\r
+\r
+    /**\r
+     * DONE is returned by previous() and next() after all valid\r
+     * boundaries have been returned.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int DONE = -1;\r
+\r
+    /**\r
+     * Return the first boundary position.  This is always the beginning\r
+     * index of the text this iterator iterates over.  For example, if\r
+     * the iterator iterates over a whole string, this function will\r
+     * always return 0.  This function also updates the iteration position\r
+     * to point to the beginning of the text.\r
+     * @return The character offset of the beginning of the stretch of text\r
+     * being broken.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract int first();\r
+\r
+    /**\r
+     * Return the last boundary position.  This is always the "past-the-end"\r
+     * index of the text this iterator iterates over.  For example, if the\r
+     * iterator iterates over a whole string (call it "text"), this function\r
+     * will always return text.length().  This function also updated the\r
+     * iteration position to point to the end of the text.\r
+     * @return The character offset of the end of the stretch of text\r
+     * being broken.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract int last();\r
+\r
+    /**\r
+     * Advances the specified number of steps forward in the text (a negative\r
+     * number, therefore, advances backwards).  If this causes the iterator\r
+     * to advance off either end of the text, this function returns DONE;\r
+     * otherwise, this function returns the position of the appropriate\r
+     * boundary.  Calling this function is equivalent to calling next() or\r
+     * previous() n times.\r
+     * @param n The number of boundaries to advance over (if positive, moves\r
+     * forward; if negative, moves backwards).\r
+     * @return The position of the boundary n boundaries from the current\r
+     * iteration position, or DONE if moving n boundaries causes the iterator\r
+     * to advance off either end of the text.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract int next(int n);\r
+\r
+    /**\r
+     * Advances the iterator forward one boundary.  The current iteration\r
+     * position is updated to point to the next boundary position after the\r
+     * current position, and this is also the value that is returned.  If\r
+     * the current position is equal to the value returned by last(), or to\r
+     * DONE, this function returns DONE and sets the current position to\r
+     * DONE.\r
+     * @return The position of the first boundary position following the\r
+     * iteration position.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract int next();\r
+\r
+    /**\r
+     * Advances the iterator backward one boundary.  The current iteration\r
+     * position is updated to point to the last boundary position before\r
+     * the current position, and this is also the value that is returned.  If\r
+     * the current position is equal to the value returned by first(), or to\r
+     * DONE, this function returns DONE and sets the current position to\r
+     * DONE.\r
+     * @return The position of the last boundary position preceding the\r
+     * iteration position.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract int previous();\r
+\r
+    /**\r
+     * Sets the iterator's current iteration position to be the first\r
+     * boundary position following the specified position.  (Whether the\r
+     * specified position is itself a boundary position or not doesn't\r
+     * matter-- this function always moves the iteration position to the\r
+     * first boundary after the specified position.)  If the specified\r
+     * position is the past-the-end position, returns DONE.\r
+     * @param offset The character position to start searching from.\r
+     * @return The position of the first boundary position following\r
+     * "offset" (whether or not "offset" itself is a boundary position),\r
+     * or DONE if "offset" is the past-the-end offset.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract int following(int offset);\r
+\r
+    /**\r
+     * Sets the iterator's current iteration position to be the last\r
+     * boundary position preceding the specified position.  (Whether the\r
+     * specified position is itself a boundary position or not doesn't\r
+     * matter-- this function always moves the iteration position to the\r
+     * last boundary before the specified position.)  If the specified\r
+     * position is the starting position, returns DONE.\r
+     * @param offset The character position to start searching from.\r
+     * @return The position of the last boundary position preceding\r
+     * "offset" (whether of not "offset" itself is a boundary position),\r
+     * or DONE if "offset" is the starting offset of the iterator.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int preceding(int offset) {\r
+        // NOTE:  This implementation is here solely because we can't add new\r
+        // abstract methods to an existing class.  There is almost ALWAYS a\r
+        // better, faster way to do this.\r
+        int pos = following(offset);\r
+        while (pos >= offset && pos != DONE)\r
+            pos = previous();\r
+        return pos;\r
+    }\r
+\r
+    /**\r
+     * Return true if the specfied position is a boundary position.  If the\r
+     * function returns true, the current iteration position is set to the\r
+     * specified position; if the function returns false, the current\r
+     * iteration position is set as though following() had been called.\r
+     * @param offset the offset to check.\r
+     * @return True if "offset" is a boundary position.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isBoundary(int offset) {\r
+        // Again, this is the default implementation, which is provided solely because\r
+        // we couldn't add a new abstract method to an existing class.  The real\r
+        // implementations will usually need to do a little more work.\r
+        if (offset == 0) {\r
+            return true;\r
+        }\r
+        else\r
+            return following(offset - 1) == offset;\r
+    }\r
+\r
+    /**\r
+     * Return the iterator's current position.\r
+     * @return The iterator's current position.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract int current();\r
+\r
+    /**\r
+     * Returns a CharacterIterator over the text being analyzed.\r
+     * For at least some subclasses of BreakIterator, this is a reference\r
+     * to the <b>actual iterator being used</b> by the BreakIterator,\r
+     * and therefore, this function's return value should be treated as\r
+     * <tt>const</tt>.  No guarantees are made about the current position\r
+     * of this iterator when it is returned.  If you need to move that\r
+     * position to examine the text, clone this function's return value first.\r
+     * @return A CharacterIterator over the text being analyzed.\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract CharacterIterator getText();\r
+\r
+    /**\r
+     * Sets the iterator to analyze a new piece of text.  The new\r
+     * piece of text is passed in as a String, and the current\r
+     * iteration position is reset to the beginning of the string.\r
+     * (The old text is dropped.)\r
+     * @param newText A String containing the text to analyze with\r
+     * this BreakIterator.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setText(String newText)\r
+    {\r
+        setText(new StringCharacterIterator(newText));\r
+    }\r
+\r
+    /**\r
+     * Sets the iterator to analyze a new piece of text.  The\r
+     * BreakIterator is passed a CharacterIterator through which\r
+     * it will access the text itself.  The current iteration\r
+     * position is reset to the CharacterIterator's start index.\r
+     * (The old iterator is dropped.)\r
+     * @param newText A CharacterIterator referring to the text\r
+     * to analyze with this BreakIterator (the iterator's current\r
+     * position is ignored, but its other state is significant).\r
+     * @stable ICU 2.0\r
+     */\r
+    public abstract void setText(CharacterIterator newText);\r
+\r
+    /**\r
+     * {@icu}\r
+     * @stable ICU 2.4\r
+     */\r
+    public static final int KIND_CHARACTER = 0;\r
+    /**\r
+     * {@icu}\r
+     * @stable ICU 2.4\r
+     */\r
+    public static final int KIND_WORD = 1;\r
+    /** \r
+     * {@icu}\r
+     * @stable ICU 2.4\r
+     */\r
+    public static final int KIND_LINE = 2;\r
+    /** \r
+     * {@icu}\r
+     * @stable ICU 2.4\r
+     */\r
+    public static final int KIND_SENTENCE = 3;\r
+    /** \r
+     * {@icu}\r
+     * @stable ICU 2.4\r
+     */\r
+    public static final int KIND_TITLE = 4;\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates word boundaries.\r
+     * This function assumes that the text being analyzed is in the default\r
+     * locale's language.\r
+     * @return An instance of BreakIterator that locates word boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getWordInstance()\r
+    {\r
+        return getWordInstance(Locale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates word boundaries.\r
+     * @param where A locale specifying the language of the text to be\r
+     * analyzed.\r
+     * @return An instance of BreakIterator that locates word boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getWordInstance(Locale where)\r
+    {\r
+        return getBreakInstance(where, KIND_WORD);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a new instance of BreakIterator that locates word boundaries.\r
+     * @param where A locale specifying the language of the text to be\r
+     * analyzed.\r
+     * @return An instance of BreakIterator that locates word boundaries.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static BreakIterator getWordInstance(ULocale where)\r
+    {\r
+        return getBreakInstance(where.toLocale(), KIND_WORD);\r
+    }\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates legal line-\r
+     * wrapping positions.  This function assumes the text being broken\r
+     * is in the default locale's language.\r
+     * @return A new instance of BreakIterator that locates legal\r
+     * line-wrapping positions.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getLineInstance()\r
+    {\r
+        return getLineInstance(Locale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates legal line-\r
+     * wrapping positions.\r
+     * @param where A Locale specifying the language of the text being broken.\r
+     * @return A new instance of BreakIterator that locates legal\r
+     * line-wrapping positions.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getLineInstance(Locale where)\r
+    {\r
+        return getBreakInstance(where, KIND_LINE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a new instance of BreakIterator that locates legal line-\r
+     * wrapping positions.\r
+     * @param where A Locale specifying the language of the text being broken.\r
+     * @return A new instance of BreakIterator that locates legal\r
+     * line-wrapping positions.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static BreakIterator getLineInstance(ULocale where)\r
+    {\r
+        return getBreakInstance(where.toLocale(), KIND_LINE);\r
+    }\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates logical-character\r
+     * boundaries.  This function assumes that the text being analyzed is\r
+     * in the default locale's language.\r
+     * @return A new instance of BreakIterator that locates logical-character\r
+     * boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getCharacterInstance()\r
+    {\r
+        return getCharacterInstance(Locale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates logical-character\r
+     * boundaries.\r
+     * @param where A Locale specifying the language of the text being analyzed.\r
+     * @return A new instance of BreakIterator that locates logical-character\r
+     * boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getCharacterInstance(Locale where)\r
+    {\r
+        return getBreakInstance(where, KIND_CHARACTER);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a new instance of BreakIterator that locates logical-character\r
+     * boundaries.\r
+     * @param where A Locale specifying the language of the text being analyzed.\r
+     * @return A new instance of BreakIterator that locates logical-character\r
+     * boundaries.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static BreakIterator getCharacterInstance(ULocale where)\r
+    {\r
+        return getBreakInstance(where.toLocale(), KIND_CHARACTER);\r
+    }\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates sentence boundaries.\r
+     * This function assumes the text being analyzed is in the default locale's\r
+     * language.\r
+     * @return A new instance of BreakIterator that locates sentence boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getSentenceInstance()\r
+    {\r
+        return getSentenceInstance(Locale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns a new instance of BreakIterator that locates sentence boundaries.\r
+     * @param where A Locale specifying the language of the text being analyzed.\r
+     * @return A new instance of BreakIterator that locates sentence boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getSentenceInstance(Locale where)\r
+    {\r
+        return getBreakInstance(where, KIND_SENTENCE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a new instance of BreakIterator that locates sentence boundaries.\r
+     * @param where A Locale specifying the language of the text being analyzed.\r
+     * @return A new instance of BreakIterator that locates sentence boundaries.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static BreakIterator getSentenceInstance(ULocale where)\r
+    {\r
+        return getBreakInstance(where.toLocale(), KIND_SENTENCE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a new instance of BreakIterator that locates title boundaries.\r
+     * This function assumes the text being analyzed is in the default locale's\r
+     * language. The iterator returned locates title boundaries as described for\r
+     * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration,\r
+     * please use a word boundary iterator. {@link #getWordInstance}\r
+     * @return A new instance of BreakIterator that locates title boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getTitleInstance()\r
+    {\r
+        return getTitleInstance(Locale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a new instance of BreakIterator that locates title boundaries.\r
+     * The iterator returned locates title boundaries as described for\r
+     * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration,\r
+     * please use Word Boundary iterator.{@link #getWordInstance}\r
+     * @param where A Locale specifying the language of the text being analyzed.\r
+     * @return A new instance of BreakIterator that locates title boundaries.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static BreakIterator getTitleInstance(Locale where)\r
+    {\r
+        return getBreakInstance(where, KIND_TITLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a new instance of BreakIterator that locates title boundaries.\r
+     * The iterator returned locates title boundaries as described for\r
+     * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration,\r
+     * please use Word Boundary iterator.{@link #getWordInstance}\r
+     * @param where A Locale specifying the language of the text being analyzed.\r
+     * @return A new instance of BreakIterator that locates title boundaries.\r
+     * @stable ICU 3.2\r
+s     */\r
+    public static BreakIterator getTitleInstance(ULocale where)\r
+    {\r
+        return getBreakInstance(where.toLocale(), KIND_TITLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Registers a new break iterator of the indicated kind, to use in the given\r
+     * locale.  Clones of the iterator will be returned if a request for a break iterator\r
+     * of the given kind matches or falls back to this locale.\r
+     * @param iter the BreakIterator instance to adopt.\r
+     * @param locale the Locale for which this instance is to be registered\r
+     * @param kind the type of iterator for which this instance is to be registered\r
+     * @return a registry key that can be used to unregister this instance\r
+     * @stable ICU 2.4\r
+     */\r
+    public static Object registerInstance(BreakIterator iter, Locale locale, int kind) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Registers a new break iterator of the indicated kind, to use in the given\r
+     * locale.  Clones of the iterator will be returned if a request for a break iterator\r
+     * of the given kind matches or falls back to this locale.\r
+     * @param iter the BreakIterator instance to adopt.\r
+     * @param locale the Locale for which this instance is to be registered\r
+     * @param kind the type of iterator for which this instance is to be registered\r
+     * @return a registry key that can be used to unregister this instance\r
+     * @stable ICU 3.2\r
+     */\r
+    public static Object registerInstance(BreakIterator iter, ULocale locale, int kind) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Unregisters a previously-registered BreakIterator using the key returned\r
+     * from the register call.  Key becomes invalid after this call and should not be used\r
+     * again.\r
+     * @param key the registry key returned by a previous call to registerInstance\r
+     * @return true if the iterator for the key was successfully unregistered\r
+     * @stable ICU 2.4\r
+     */\r
+    public static boolean unregister(Object key) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    // end of registration\r
+\r
+    /**\r
+     * Returns a particular kind of BreakIterator for a locale.\r
+     * Avoids writing a switch statement with getXYZInstance(where) calls.\r
+     * @internal\r
+     * @deprecated This API is ICU internal only.\r
+     */\r
+    public static BreakIterator getBreakInstance(ULocale where, int kind) {\r
+        return getBreakInstance(where.toLocale(), KIND_SENTENCE);\r
+    }\r
+\r
+    private static BreakIterator getBreakInstance(Locale where, int kind) {\r
+        java.text.BreakIterator br = null;\r
+        switch(kind) {\r
+        case KIND_CHARACTER: br = java.text.BreakIterator.getCharacterInstance(where); break;\r
+        case KIND_WORD: br = java.text.BreakIterator.getWordInstance(where); break;\r
+        case KIND_LINE: br = java.text.BreakIterator.getLineInstance(where); break;\r
+        case KIND_SENTENCE: br = java.text.BreakIterator.getSentenceInstance(where); break;             \r
+        case KIND_TITLE: throw new UnsupportedOperationException("Title break is not supported by com.ibm.icu.base");\r
+        }\r
+        return new BreakIteratorHandle(br);\r
+    }\r
+\r
+    /**\r
+     * Returns a list of locales for which BreakIterators can be used.\r
+     * @return An array of Locales.  All of the locales in the array can\r
+     * be used when creating a BreakIterator.\r
+     * @stable ICU 2.6\r
+     */\r
+    public static synchronized Locale[] getAvailableLocales() {\r
+        return java.text.BreakIterator.getAvailableLocales();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a list of locales for which BreakIterators can be used.\r
+     * @return An array of Locales.  All of the locales in the array can\r
+     * be used when creating a BreakIterator.\r
+     * @draft ICU 3.2 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static synchronized ULocale[] getAvailableULocales() {\r
+        Locale[] locales = java.text.BreakIterator.getAvailableLocales();\r
+        ULocale[] ulocales = new ULocale[locales.length];\r
+        for (int i = 0; i < locales.length; ++i) {\r
+            ulocales[i] = ULocale.forLocale(locales[i]);\r
+        }\r
+        return ulocales;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the locale that was used to create this object, or null.\r
+     * This may may differ from the locale requested at the time of\r
+     * this object's creation.  For example, if an object is created\r
+     * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be\r
+     * drawn from <tt>en</tt> (the <i>actual</i> locale), and\r
+     * <tt>en_US</tt> may be the most specific locale that exists (the\r
+     * <i>valid</i> locale).\r
+     *\r
+     * <p>Note: The <i>actual</i> locale is returned correctly, but the <i>valid</i>\r
+     * locale is not, in most cases.\r
+     * @param type type of information requested, either {@link\r
+     * com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link\r
+     * com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.\r
+     * @return the information specified by <i>type</i>, or null if\r
+     * this object was not constructed from locale data.\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public final ULocale getLocale(ULocale.Type type) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    // forwarding implementation class\r
+    static final class BreakIteratorHandle extends BreakIterator {\r
+        /**\r
+         * @internal\r
+         */\r
+        public final java.text.BreakIterator breakIterator;\r
+\r
+        /**\r
+         * @internal\r
+         * @param delegate the BreakIterator to which to delegate\r
+         */\r
+        public BreakIteratorHandle(java.text.BreakIterator delegate) {\r
+            this.breakIterator = delegate;\r
+        }\r
+\r
+        public int first() {\r
+            return breakIterator.first();\r
+        }\r
+        public int last() {\r
+            return breakIterator.last();\r
+        }\r
+        public int next(int n) {\r
+            return breakIterator.next(n);\r
+        }\r
+        public int next() {\r
+            return breakIterator.next();\r
+        }\r
+        public int previous() {\r
+            return breakIterator.previous();\r
+        }\r
+        public int following(int offset) {\r
+            return breakIterator.following(offset);\r
+        }\r
+        public int preceding(int offset) {\r
+            return breakIterator.preceding(offset);\r
+        }\r
+        public boolean isBoundary(int offset) {\r
+            return breakIterator.isBoundary(offset);\r
+        }\r
+        public int current() {\r
+            return breakIterator.current();\r
+        }\r
+        public CharacterIterator getText() {\r
+            return breakIterator.getText();\r
+        }\r
+        public void setText(CharacterIterator newText) {\r
+            breakIterator.setText(newText);\r
+        }\r
+\r
+        /**\r
+         * Return a string suitable for debugging.\r
+         * @return a string suitable for debugging\r
+         * @stable ICU 3.4.3\r
+         */\r
+        public String toString() {\r
+            return breakIterator.toString();\r
+        }\r
+\r
+        /**\r
+         * Return a clone of this BreakIterator.\r
+         * @return a clone of this BreakIterator\r
+         * @stable ICU 3.4.3\r
+         */\r
+        public Object clone() {\r
+            return new BreakIteratorHandle((java.text.BreakIterator)breakIterator.clone());\r
+        }\r
+\r
+        /**\r
+         * Return true if rhs is a BreakIterator with the same break behavior as this.\r
+         * @return true if rhs equals this\r
+         * @stable ICU 3.4.3\r
+         */\r
+        public boolean equals(Object rhs) {\r
+            try {\r
+                return breakIterator.equals(((BreakIteratorHandle)rhs).breakIterator);\r
+            }\r
+            catch (Exception e) {\r
+                return false;\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Return a hashCode.\r
+         * @return a hashCode\r
+         * @stable ICU 3.4.3\r
+         */\r
+        public int hashCode() {\r
+            return breakIterator.hashCode();\r
+        }\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CollationKey.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CollationKey.java
new file mode 100644 (file)
index 0000000..5cdef2f
--- /dev/null
@@ -0,0 +1,415 @@
+/**\r
+*******************************************************************************\r
+* Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+* others. All Rights Reserved.                                                *\r
+*******************************************************************************\r
+*/\r
+package com.ibm.icu.text;\r
+\r
+/**\r
+ * <p>A <code>CollationKey</code> represents a <code>String</code>\r
+ * under the rules of a specific <code>Collator</code>\r
+ * object. Comparing two <code>CollationKey</code>s returns the\r
+ * relative order of the <code>String</code>s they represent.</p>\r
+ *\r
+ * <p>Since the rule set of <code>Collator</code>s can differ, the\r
+ * sort orders of the same string under two different\r
+ * <code>Collator</code>s might differ.  Hence comparing\r
+ * <code>CollationKey</code>s generated from different\r
+ * <code>Collator</code>s can give incorrect results.</p>\r
\r
+ * <p>Both the method\r
+ * <code>CollationKey.compareTo(CollationKey)</code> and the method\r
+ * <code>Collator.compare(String, String)</code> compare two strings\r
+ * and returns their relative order.  The performance characterictics\r
+ * of these two approaches can differ.</p>\r
+ *\r
+ * <p>During the construction of a <code>CollationKey</code>, the\r
+ * entire source string is examined and processed into a series of\r
+ * bits terminated by a null, that are stored in the <code>CollationKey</code>. \r
+ * When <code>CollationKey.compareTo(CollationKey)</code> executes, it\r
+ * performs bitwise comparison on the bit sequences.  This can incurs\r
+ * startup cost when creating the <code>CollationKey</code>, but once\r
+ * the key is created, binary comparisons are fast.  This approach is\r
+ * recommended when the same strings are to be compared over and over\r
+ * again.</p>\r
+ *\r
+ * <p>On the other hand, implementations of\r
+ * <code>Collator.compare(String, String)</code> can examine and\r
+ * process the strings only until the first characters differing in\r
+ * order.  This approach is recommended if the strings are to be\r
+ * compared only once.</p>\r
+ * \r
+ * <p>More information about the composition of the bit sequence can\r
+ * be found in the \r
+ * <a href="http://www.icu-project.org/userguide/Collate_ServiceArchitecture.html">\r
+ * user guide</a>.</p>\r
+ *\r
+ * <p>The following example shows how <code>CollationKey</code>s can be used\r
+ * to sort a list of <code>String</code>s.</p>\r
+ * <blockquote>\r
+ * <pre>\r
+ * // Create an array of CollationKeys for the Strings to be sorted.\r
+ * Collator myCollator = Collator.getInstance();\r
+ * CollationKey[] keys = new CollationKey[3];\r
+ * keys[0] = myCollator.getCollationKey("Tom");\r
+ * keys[1] = myCollator.getCollationKey("Dick");\r
+ * keys[2] = myCollator.getCollationKey("Harry");\r
+ * sort( keys );\r
+ * <br>\r
+ * //...\r
+ * <br>\r
+ * // Inside body of sort routine, compare keys this way\r
+ * if( keys[i].compareTo( keys[j] ) > 0 )\r
+ *    // swap keys[i] and keys[j]\r
+ * <br>\r
+ * //...\r
+ * <br>\r
+ * // Finally, when we've returned from sort.\r
+ * System.out.println( keys[0].getSourceString() );\r
+ * System.out.println( keys[1].getSourceString() );\r
+ * System.out.println( keys[2].getSourceString() );\r
+ * </pre>\r
+ * </blockquote>\r
+ * </p>\r
+ * <p>\r
+ * This class is not subclassable\r
+ * </p>\r
+ * @see Collator\r
+ * @see RuleBasedCollator\r
+ * @author Syn Wee Quek\r
+ * @stable ICU 2.8 \r
+ */\r
+public final class CollationKey implements Comparable<CollationKey>\r
+{\r
+    /**\r
+     * @internal\r
+     */\r
+    final java.text.CollationKey key;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    CollationKey(java.text.CollationKey delegate) {\r
+        this.key = delegate;\r
+    }\r
+\r
+    // public inner classes -------------------------------------------------\r
+    \r
+    /** \r
+     * Options that used in the API CollationKey.getBound() for getting a \r
+     * CollationKey based on the bound mode requested.\r
+     * @stable ICU 2.6\r
+     */\r
+    public static final class BoundMode \r
+    {\r
+        /*\r
+         * do not change the values assigned to the members of this enum. \r
+         * Underlying code depends on them having these numbers  \r
+         */\r
+         \r
+        /** \r
+         * Lower bound\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int LOWER = 0;\r
+\r
+        /** \r
+         * Upper bound that will match strings of exact size\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int UPPER = 1;\r
+\r
+        /** \r
+         * Upper bound that will match all the strings that have the same \r
+         * initial substring as the given string\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int UPPER_LONG = 2;\r
+\r
+        /**\r
+         * Number of bound mode\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int COUNT = 3;\r
+        \r
+        /**\r
+         * Private Constructor\r
+         */\r
+        ///CLOVER:OFF\r
+        private BoundMode(){}\r
+        ///CLOVER:ON\r
+    }\r
+    \r
+    // public constructor ---------------------------------------------------\r
+    \r
+    /**\r
+     * CollationKey constructor.\r
+     * This constructor is given public access, unlike the JDK version, to\r
+     * allow access to users extending the Collator class. See \r
+     * {@link Collator#getCollationKey(String)}. \r
+     * @param source string this CollationKey is to represent\r
+     * @param key array of bytes that represent the collation order of argument\r
+     *            source terminated by a null\r
+     * @see Collator\r
+     * @stable ICU 2.8\r
+     */\r
+    public CollationKey(String source, byte key[])\r
+    {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * CollationKey constructor that forces key to release its internal byte \r
+     * array for adoption. key will have a null byte array after this \r
+     * construction.\r
+     * @param source string this CollationKey is to represent\r
+     * @param key RawCollationKey object that represents the collation order of \r
+     *            argument source. \r
+     * @see Collator\r
+     * @see RawCollationKey\r
+     * @stable ICU 2.8 \r
+     */\r
+    public CollationKey(String source, RawCollationKey key)\r
+    {\r
+       throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    // public getters -------------------------------------------------------\r
+    \r
+    /**\r
+     * Return the source string that this CollationKey represents.\r
+     * @return source string that this CollationKey represents\r
+     * @stable ICU 2.8\r
+     */\r
+    public String getSourceString() \r
+    {\r
+        return key.getSourceString();\r
+    }\r
+\r
+    /**\r
+     * <p>Duplicates and returns the value of this CollationKey as a sequence \r
+     * of big-endian bytes terminated by a null.</p> \r
+     *\r
+     * <p>If two CollationKeys can be legitimately compared, then one can\r
+     * compare the byte arrays of each to obtain the same result, e.g.\r
+     * <pre>\r
+     * byte key1[] = collationkey1.toByteArray();\r
+     * byte key2[] = collationkey2.toByteArray();\r
+     * int key, targetkey;\r
+     * int i = 0;\r
+     * do {\r
+     *       key = key1[i] & 0xFF;\r
+     *     targetkey = key2[i] & 0xFF;\r
+     *     if (key &lt; targetkey) {\r
+     *         System.out.println("String 1 is less than string 2");\r
+     *         return;\r
+     *     }\r
+     *     if (targetkey &lt; key) {\r
+     *         System.out.println("String 1 is more than string 2");\r
+     *     }\r
+     *     i ++;\r
+     * } while (key != 0 && targetKey != 0);\r
+     *\r
+     * System.out.println("Strings are equal.");\r
+     * </pre>\r
+     * </p>  \r
+     * @return CollationKey value in a sequence of big-endian byte bytes \r
+     *         terminated by a null.\r
+     * @stable ICU 2.8\r
+     */\r
+    public byte[] toByteArray() \r
+    {\r
+        return key.toByteArray();\r
+    }\r
+\r
+    // public other methods -------------------------------------------------    \r
+     \r
+    /**\r
+     * <p>Compare this CollationKey to another CollationKey.  The\r
+     * collation rules of the Collator that created this key are\r
+     * applied.</p>\r
+     *\r
+     * <p><strong>Note:</strong> Comparison between CollationKeys\r
+     * created by different Collators might return incorrect\r
+     * results.  See class documentation.</p>\r
+     *\r
+     * @param target target CollationKey\r
+     * @return an integer value.  If the value is less than zero this CollationKey\r
+     *         is less than than target, if the value is zero they are equal, and\r
+     *         if the value is greater than zero this CollationKey is greater \r
+     *         than target.\r
+     * @exception NullPointerException is thrown if argument is null.\r
+     * @see Collator#compare(String, String)\r
+     * @stable ICU 2.8 \r
+     */\r
+    public int compareTo(CollationKey target)\r
+    {\r
+       return key.compareTo(target.key);\r
+    }\r
+\r
+    /**\r
+     * <p>Compare this CollationKey and the specified Object for\r
+     * equality.  The collation rules of the Collator that created\r
+     * this key are applied.</p>\r
+     *\r
+     * <p>See note in compareTo(CollationKey) for warnings about\r
+     * possible incorrect results.</p>\r
+     *\r
+     * @param target the object to compare to.\r
+     * @return true if the two keys compare as equal, false otherwise.\r
+     * @see #compareTo(CollationKey)\r
+     * @exception ClassCastException is thrown when the argument is not \r
+     *            a CollationKey.  NullPointerException is thrown when the argument \r
+     *            is null.\r
+     * @stable ICU 2.8 \r
+     */\r
+    public boolean equals(Object target) \r
+    {\r
+        if (!(target instanceof CollationKey)) {\r
+            return false;\r
+        }\r
+        \r
+        return equals((CollationKey)target);\r
+    }\r
+    \r
+    /**\r
+     * <p>\r
+     * Compare this CollationKey and the argument target CollationKey for \r
+     * equality.\r
+     * The collation \r
+     * rules of the Collator object which created these objects are applied.\r
+     * </p>\r
+     * <p>\r
+     * See note in compareTo(CollationKey) for warnings of incorrect results\r
+     * </p>\r
+     * @param target the CollationKey to compare to.\r
+     * @return true if two objects are equal, false otherwise.\r
+     * @exception NullPointerException is thrown when the argument is null.\r
+     * @stable ICU 2.8\r
+     */\r
+    public boolean equals(CollationKey target) \r
+    {\r
+       return key.equals(target.key);\r
+    }\r
+\r
+    /**\r
+     * <p>Returns a hash code for this CollationKey. The hash value is calculated \r
+     * on the key itself, not the String from which the key was created. Thus \r
+     * if x and y are CollationKeys, then x.hashCode(x) == y.hashCode() \r
+     * if x.equals(y) is true. This allows language-sensitive comparison in a \r
+     * hash table.\r
+     * </p>\r
+     * @return the hash value.\r
+     * @stable ICU 2.8\r
+     */\r
+    public int hashCode() \r
+    {\r
+       return key.hashCode();\r
+    }\r
+    \r
+    /**\r
+     * <p>\r
+     * Produce a bound for the sort order of a given collation key and a \r
+     * strength level. This API does not attempt to find a bound for the \r
+     * CollationKey String representation, hence null will be returned in its \r
+     * place.\r
+     * </p>\r
+     * <p>\r
+     * Resulting bounds can be used to produce a range of strings that are\r
+     * between upper and lower bounds. For example, if bounds are produced\r
+     * for a sortkey of string "smith", strings between upper and lower \r
+     * bounds with primary strength would include "Smith", "SMITH", "sMiTh".\r
+     * </p>\r
+     * <p>\r
+     * There are two upper bounds that can be produced. If BoundMode.UPPER\r
+     * is produced, strings matched would be as above. However, if a bound\r
+     * is produced using BoundMode.UPPER_LONG is used, the above example will\r
+     * also match "Smithsonian" and similar.\r
+     * </p>\r
+     * <p>\r
+     * For more on usage, see example in test procedure \r
+     * <a href="http://source.icu-project.org/repos/icu/icu4j/trunk/src/com/ibm/icu/dev/test/collator/CollationAPITest.java">\r
+     * src/com/ibm/icu/dev/test/collator/CollationAPITest/TestBounds.\r
+     * </a>\r
+     * </p>\r
+     * <p>\r
+     * Collation keys produced may be compared using the <TT>compare</TT> API.\r
+     * </p>\r
+     * @param boundType Mode of bound required. It can be BoundMode.LOWER, which \r
+     *              produces a lower inclusive bound, BoundMode.UPPER, that \r
+     *              produces upper bound that matches strings of the same \r
+     *              length or BoundMode.UPPER_LONG that matches strings that \r
+     *              have the same starting substring as the source string.\r
+     * @param noOfLevels Strength levels required in the resulting bound \r
+     *                 (for most uses, the recommended value is PRIMARY). This\r
+     *                 strength should be less than the maximum strength of \r
+     *                 this CollationKey.\r
+     *                 See users guide for explanation on the strength levels a \r
+     *                 collation key can have. \r
+     * @return the result bounded CollationKey with a valid sort order but \r
+     *         a null String representation.\r
+     * @exception IllegalArgumentException thrown when the strength level \r
+     *            requested is higher than or equal to the strength in this\r
+     *            CollationKey. \r
+     *            In the case of an Exception, information \r
+     *            about the maximum strength to use will be returned in the \r
+     *            Exception. The user can then call getBound() again with the \r
+     *            appropriate strength.\r
+     * @see CollationKey\r
+     * @see CollationKey.BoundMode\r
+     * @see Collator#PRIMARY\r
+     * @see Collator#SECONDARY\r
+     * @see Collator#TERTIARY\r
+     * @see Collator#QUATERNARY\r
+     * @see Collator#IDENTICAL\r
+     * @stable ICU 2.6\r
+     */\r
+    public CollationKey getBound(int boundType, int noOfLevels) \r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+    \r
+    /** \r
+     * <p>\r
+     * Merges this CollationKey with another. Only the sorting order of the \r
+     * CollationKeys will be merged. This API does not attempt to merge the \r
+     * String representations of the CollationKeys, hence null will be returned\r
+     * as the String representation.\r
+     * </p>\r
+     * <p>\r
+     * The strength levels are merged with their corresponding counterparts \r
+     * (PRIMARIES with PRIMARIES, SECONDARIES with SECONDARIES etc.). \r
+     * </p>\r
+     * <p>\r
+     * The merged String representation of the result CollationKey will be a\r
+     * concatenation of the String representations of the 2 source \r
+     * CollationKeys.\r
+     * </p>\r
+     * <p>\r
+     * Between the values from the same level a separator is inserted.\r
+     * example (uncompressed):\r
+     * <pre> \r
+     * 191B1D 01 050505 01 910505 00 and 1F2123 01 050505 01 910505 00\r
+     * will be merged as \r
+     * 191B1D 02 1F212301 050505 02 050505 01 910505 02 910505 00\r
+     * </pre>\r
+     * </p>\r
+     * <p>\r
+     * This allows for concatenating of first and last names for sorting, among \r
+     * other things.\r
+     * </p>\r
+     * </p>\r
+     * @param source CollationKey to merge with \r
+     * @return a CollationKey that contains the valid merged sorting order \r
+     *         with a null String representation, \r
+     *         i.e. <tt>new CollationKey(null, merge_sort_order)</tt>\r
+     * @exception IllegalArgumentException thrown if source CollationKey\r
+     *            argument is null or of 0 length.\r
+     * @stable ICU 2.6\r
+     */\r
+    public CollationKey merge(CollationKey source)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Collator.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/Collator.java
new file mode 100644 (file)
index 0000000..d9eaaeb
--- /dev/null
@@ -0,0 +1,932 @@
+/**\r
+*******************************************************************************\r
+* Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+* others. All Rights Reserved.                                                *\r
+*******************************************************************************\r
+*/\r
+package com.ibm.icu.text;\r
+\r
+import java.util.Comparator;\r
+import java.util.Locale;\r
+import java.util.Set;\r
+\r
+import com.ibm.icu.util.ULocale;\r
+import com.ibm.icu.util.VersionInfo;\r
+\r
+/**\r
+* {@icuenhanced java.text.Collator}.{@icu _usage_}\r
+*\r
+* <p>Collator performs locale-sensitive string comparison. A concrete\r
+* subclass, RuleBasedCollator, allows customization of the collation\r
+* ordering by the use of rule sets.</p>\r
+*\r
+* <p>Following the <a href=http://www.unicode.org>Unicode\r
+* Consortium</a>'s specifications for the\r
+* <a href="http://www.unicode.org/unicode/reports/tr10/">Unicode Collation\r
+* Algorithm (UCA)</a>, there are 5 different levels of strength used\r
+* in comparisons:\r
+*\r
+* <ul>\r
+* <li>PRIMARY strength: Typically, this is used to denote differences between\r
+*     base characters (for example, "a" &lt; "b").\r
+*     It is the strongest difference. For example, dictionaries are divided\r
+*     into different sections by base character.\r
+* <li>SECONDARY strength: Accents in the characters are considered secondary\r
+*     differences (for example, "as" &lt; "&agrave;s" &lt; "at"). Other\r
+*     differences\r
+*     between letters can also be considered secondary differences, depending\r
+*     on the language. A secondary difference is ignored when there is a\r
+*     primary difference anywhere in the strings.\r
+* <li>TERTIARY strength: Upper and lower case differences in characters are\r
+*     distinguished at tertiary strength (for example, "ao" &lt; "Ao" &lt;\r
+*     "a&ograve;"). In addition, a variant of a letter differs from the base\r
+*     form on the tertiary strength (such as "A" and "&#9398;"). Another\r
+*     example is the\r
+*     difference between large and small Kana. A tertiary difference is ignored\r
+*     when there is a primary or secondary difference anywhere in the strings.\r
+* <li>QUATERNARY strength: When punctuation is ignored\r
+*     <a href="http://www.icu-project.org/userguide/Collate_Concepts.html#Ignoring_Punctuation">\r
+*     (see Ignoring Punctuations in the user guide)</a> at PRIMARY to TERTIARY\r
+*     strength, an additional strength level can\r
+*     be used to distinguish words with and without punctuation (for example,\r
+*     "ab" &lt; "a-b" &lt; "aB").\r
+*     This difference is ignored when there is a PRIMARY, SECONDARY or TERTIARY\r
+*     difference. The QUATERNARY strength should only be used if ignoring\r
+*     punctuation is required.\r
+* <li>IDENTICAL strength:\r
+*     When all other strengths are equal, the IDENTICAL strength is used as a\r
+*     tiebreaker. The Unicode code point values of the NFD form of each string\r
+*     are compared, just in case there is no difference.\r
+*     For example, Hebrew cantellation marks are only distinguished at this\r
+*     strength. This strength should be used sparingly, as only code point\r
+*     value differences between two strings is an extremely rare occurrence.\r
+*     Using this strength substantially decreases the performance for both\r
+*     comparison and collation key generation APIs. This strength also\r
+*     increases the size of the collation key.\r
+* </ul>\r
+*\r
+* Unlike the JDK, ICU4J's Collator deals only with 2 decomposition modes,\r
+* the canonical decomposition mode and one that does not use any decomposition.\r
+* The compatibility decomposition mode, java.text.Collator.FULL_DECOMPOSITION\r
+* is not supported here. If the canonical\r
+* decomposition mode is set, the Collator handles un-normalized text properly,\r
+* producing the same results as if the text were normalized in NFD. If\r
+* canonical decomposition is turned off, it is the user's responsibility to\r
+* ensure that all text is already in the appropriate form before performing\r
+* a comparison or before getting a CollationKey.</p>\r
+*\r
+* <p>For more information about the collation service see the\r
+* <a href="http://www.icu-project.org/userguide/Collate_Intro.html">users\r
+* guide</a>.</p>\r
+*\r
+* <p>Examples of use\r
+* <pre>\r
+* // Get the Collator for US English and set its strength to PRIMARY\r
+* Collator usCollator = Collator.getInstance(Locale.US);\r
+* usCollator.setStrength(Collator.PRIMARY);\r
+* if (usCollator.compare("abc", "ABC") == 0) {\r
+*     System.out.println("Strings are equivalent");\r
+* }\r
+*\r
+* The following example shows how to compare two strings using the\r
+* Collator for the default locale.\r
+*\r
+* // Compare two strings in the default locale\r
+* Collator myCollator = Collator.getInstance();\r
+* myCollator.setDecomposition(NO_DECOMPOSITION);\r
+* if (myCollator.compare("&agrave;&#92;u0325", "a&#92;u0325&#768;") != 0) {\r
+*     System.out.println("&agrave;&#92;u0325 is not equals to a&#92;u0325&#768; without decomposition");\r
+*     myCollator.setDecomposition(CANONICAL_DECOMPOSITION);\r
+*     if (myCollator.compare("&agrave;&#92;u0325", "a&#92;u0325&#768;") != 0) {\r
+*         System.out.println("Error: &agrave;&#92;u0325 should be equals to a&#92;u0325&#768; with decomposition");\r
+*     }\r
+*     else {\r
+*         System.out.println("&agrave;&#92;u0325 is equals to a&#92;u0325&#768; with decomposition");\r
+*     }\r
+* }\r
+* else {\r
+*     System.out.println("Error: &agrave;&#92;u0325 should be not equals to a&#92;u0325&#768; without decomposition");\r
+* }\r
+* </pre>\r
+* </p>\r
+* @see RuleBasedCollator\r
+* @see CollationKey\r
+* @author Syn Wee Quek\r
+* @stable ICU 2.8\r
+*/\r
+public class Collator implements Comparator<Object>, Cloneable\r
+{\r
+    /**\r
+     * @internal\r
+     */\r
+    private final java.text.Collator collator;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    private Collator(java.text.Collator delegate) {\r
+        this.collator = delegate;\r
+    }\r
+\r
+    /**\r
+     * Create a collator with a null delegate.\r
+     * For use by possible subclassers.  This is present since\r
+     * the original Collator is abstract, and so, in theory\r
+     * subclassable.  All member APIs must be overridden.\r
+     */\r
+    protected Collator() {\r
+        this.collator = null;\r
+    }\r
+\r
+    // public data members ---------------------------------------------------\r
+\r
+    /**\r
+     * Strongest collator strength value. Typically used to denote differences\r
+     * between base characters. See class documentation for more explanation.\r
+     * @see #setStrength\r
+     * @see #getStrength\r
+     * @stable ICU 2.8\r
+     */\r
+    public final static int PRIMARY = java.text.Collator.PRIMARY;\r
+\r
+    /**\r
+     * Second level collator strength value.\r
+     * Accents in the characters are considered secondary differences.\r
+     * Other differences between letters can also be considered secondary\r
+     * differences, depending on the language.\r
+     * See class documentation for more explanation.\r
+     * @see #setStrength\r
+     * @see #getStrength\r
+     * @stable ICU 2.8\r
+     */\r
+    public final static int SECONDARY = java.text.Collator.SECONDARY;\r
+\r
+    /**\r
+     * Third level collator strength value.\r
+     * Upper and lower case differences in characters are distinguished at this\r
+     * strength level. In addition, a variant of a letter differs from the base\r
+     * form on the tertiary level.\r
+     * See class documentation for more explanation.\r
+     * @see #setStrength\r
+     * @see #getStrength\r
+     * @stable ICU 2.8\r
+     */\r
+    public final static int TERTIARY = java.text.Collator.TERTIARY;\r
+\r
+    /**\r
+     * {@icu} Fourth level collator strength value.\r
+     * When punctuation is ignored\r
+     * <a href="http://www.icu-project.org/userguide/Collate_Concepts.html#Ignoring_Punctuation">\r
+     * (see Ignoring Punctuations in the user guide)</a> at PRIMARY to TERTIARY\r
+     * strength, an additional strength level can\r
+     * be used to distinguish words with and without punctuation.\r
+     * See class documentation for more explanation.\r
+     * @see #setStrength\r
+     * @see #getStrength\r
+     * @stable ICU 2.8\r
+     */\r
+    public final static int QUATERNARY = java.text.Collator.IDENTICAL;\r
+\r
+    /**\r
+     * Smallest Collator strength value. When all other strengths are equal,\r
+     * the IDENTICAL strength is used as a tiebreaker. The Unicode code point\r
+     * values of the NFD form of each string are compared, just in case there\r
+     * is no difference.\r
+     * See class documentation for more explanation.\r
+     * </p>\r
+     * <p>\r
+     * Note this value is different from JDK's\r
+     * </p>\r
+     * @stable ICU 2.8\r
+     */\r
+    public final static int IDENTICAL = java.text.Collator.FULL_DECOMPOSITION;\r
+\r
+    /**\r
+     * {@icunote} This is for backwards compatibility with Java APIs only.  It\r
+     * should not be used, IDENTICAL should be used instead.  ICU's\r
+     * collation does not support Java's FULL_DECOMPOSITION mode.\r
+     * @stable ICU 3.4\r
+     */\r
+    public final static int FULL_DECOMPOSITION = java.text.Collator.FULL_DECOMPOSITION;\r
+\r
+    /**\r
+     * Decomposition mode value. With NO_DECOMPOSITION set, Strings\r
+     * will not be decomposed for collation. This is the default\r
+     * decomposition setting unless otherwise specified by the locale\r
+     * used to create the Collator.</p>\r
+     *\r
+     * <p><strong>Note</strong> this value is different from the JDK's.</p>\r
+     * @see #CANONICAL_DECOMPOSITION\r
+     * @see #getDecomposition\r
+     * @see #setDecomposition\r
+     * @stable ICU 2.8\r
+     */\r
+    public final static int NO_DECOMPOSITION = java.text.Collator.NO_DECOMPOSITION;\r
+\r
+    /**\r
+     * Decomposition mode value. With CANONICAL_DECOMPOSITION set,\r
+     * characters that are canonical variants according to the Unicode standard\r
+     * will be decomposed for collation.</p>\r
+     *\r
+     * <p>CANONICAL_DECOMPOSITION corresponds to Normalization Form D as\r
+     * described in <a href="http://www.unicode.org/unicode/reports/tr15/">\r
+     * Unicode Technical Report #15</a>.\r
+     * </p>\r
+     * @see #NO_DECOMPOSITION\r
+     * @see #getDecomposition\r
+     * @see #setDecomposition\r
+     * @stable ICU 2.8\r
+     */\r
+    public final static int CANONICAL_DECOMPOSITION = java.text.Collator.CANONICAL_DECOMPOSITION;\r
+\r
+    // public methods --------------------------------------------------------\r
+\r
+    // public setters --------------------------------------------------------\r
+\r
+    /**\r
+     * Sets this Collator's strength property. The strength property\r
+     * determines the minimum level of difference considered significant\r
+     * during comparison.</p>\r
+     *\r
+     * <p>The default strength for the Collator is TERTIARY, unless specified\r
+     * otherwise by the locale used to create the Collator.</p>\r
+     *\r
+     * <p>See the Collator class description for an example of use.</p>\r
+     * @param newStrength the new strength value.\r
+     * @see #getStrength\r
+     * @see #PRIMARY\r
+     * @see #SECONDARY\r
+     * @see #TERTIARY\r
+     * @see #QUATERNARY\r
+     * @see #IDENTICAL\r
+     * @throws IllegalArgumentException if the new strength value is not one\r
+     *                of PRIMARY, SECONDARY, TERTIARY, QUATERNARY or IDENTICAL.\r
+     * @stable ICU 2.8\r
+     */\r
+    public void setStrength(int newStrength)\r
+    {\r
+        collator.setStrength(newStrength);\r
+    }\r
+\r
+    /**\r
+     * Sets the decomposition mode of this Collator.  Setting this\r
+     * decomposition property with CANONICAL_DECOMPOSITION allows the\r
+     * Collator to handle un-normalized text properly, producing the\r
+     * same results as if the text were normalized. If\r
+     * NO_DECOMPOSITION is set, it is the user's responsibility to\r
+     * insure that all text is already in the appropriate form before\r
+     * a comparison or before getting a CollationKey. Adjusting\r
+     * decomposition mode allows the user to select between faster and\r
+     * more complete collation behavior.</p>\r
+     *\r
+     * <p>Since a great many of the world's languages do not require\r
+     * text normalization, most locales set NO_DECOMPOSITION as the\r
+     * default decomposition mode.</p>\r
+     *\r
+     * The default decompositon mode for the Collator is\r
+     * NO_DECOMPOSITON, unless specified otherwise by the locale used\r
+     * to create the Collator.</p>\r
+     *\r
+     * <p>See getDecomposition for a description of decomposition\r
+     * mode.</p>\r
+     *\r
+     * @param decomposition the new decomposition mode\r
+     * @see #getDecomposition\r
+     * @see #NO_DECOMPOSITION\r
+     * @see #CANONICAL_DECOMPOSITION\r
+     * @throws IllegalArgumentException If the given value is not a valid\r
+     *            decomposition mode.\r
+     * @stable ICU 2.8\r
+     */\r
+    public void setDecomposition(int decomposition)\r
+    {\r
+        collator.setDecomposition(decomposition);\r
+    }\r
+\r
+    // public getters --------------------------------------------------------\r
+\r
+    /**\r
+     * Returns the Collator for the current default locale.\r
+     * The default locale is determined by java.util.Locale.getDefault().\r
+     * @return the Collator for the default locale (for example, en_US) if it\r
+     *         is created successfully. Otherwise if there is no Collator\r
+     *         associated with the current locale, the default UCA collator\r
+     *         will be returned.\r
+     * @see java.util.Locale#getDefault()\r
+     * @see #getInstance(Locale)\r
+     * @stable ICU 2.8\r
+     */\r
+    public static final Collator getInstance()\r
+    {\r
+        return new Collator(java.text.Collator.getInstance());\r
+    }\r
+\r
+    /**\r
+     * Clones the collator.\r
+     * @stable ICU 2.6\r
+     * @return a clone of this collator.\r
+     */\r
+    public Object clone() throws CloneNotSupportedException {\r
+        return new Collator((java.text.Collator)collator.clone());\r
+    }\r
+\r
+    // begin registry stuff\r
+\r
+    /**\r
+     * A factory used with registerFactory to register multiple collators and provide\r
+     * display names for them.  If standard locale display names are sufficient,\r
+     * Collator instances may be registered instead.\r
+     * <p><b>Note:</b> as of ICU4J 3.2, the default API for CollatorFactory uses\r
+     * ULocale instead of Locale.  Instead of overriding createCollator(Locale),\r
+     * new implementations should override createCollator(ULocale).  Note that\r
+     * one of these two methods <b>MUST</b> be overridden or else an infinite\r
+     * loop will occur.\r
+     * @stable ICU 2.6\r
+     */\r
+    public static abstract class CollatorFactory {\r
+        /**\r
+         * Return true if this factory will be visible.  Default is true.\r
+         * If not visible, the locales supported by this factory will not\r
+         * be listed by getAvailableLocales.\r
+         *\r
+         * @return true if this factory is visible\r
+         * @stable ICU 2.6\r
+         */\r
+        public boolean visible() {\r
+            return true;\r
+        }\r
+\r
+        /**\r
+         * Return an instance of the appropriate collator.  If the locale\r
+         * is not supported, return null.\r
+         * <b>Note:</b> as of ICU4J 3.2, implementations should override\r
+         * this method instead of createCollator(Locale).\r
+         * @param loc the locale for which this collator is to be created.\r
+         * @return the newly created collator.\r
+         * @stable ICU 3.2\r
+         */\r
+        public Collator createCollator(ULocale loc) {\r
+            return createCollator(loc.toLocale());\r
+        }\r
+\r
+        /**\r
+         * Return an instance of the appropriate collator.  If the locale\r
+         * is not supported, return null.\r
+         * <p><b>Note:</b> as of ICU4J 3.2, implementations should override\r
+         * createCollator(ULocale) instead of this method, and inherit this\r
+         * method's implementation.  This method is no longer abstract\r
+         * and instead delegates to createCollator(ULocale).\r
+         * @param loc the locale for which this collator is to be created.\r
+         * @return the newly created collator.\r
+         * @stable ICU 2.6\r
+         */\r
+         public Collator createCollator(Locale loc) {\r
+            return createCollator(ULocale.forLocale(loc));\r
+        }\r
+\r
+        /**\r
+         * Return the name of the collator for the objectLocale, localized for the displayLocale.\r
+         * If objectLocale is not visible or not defined by the factory, return null.\r
+         * @param objectLocale the locale identifying the collator\r
+         * @param displayLocale the locale for which the display name of the collator should be localized\r
+         * @return the display name\r
+         * @stable ICU 2.6\r
+         */\r
+        public String getDisplayName(Locale objectLocale, Locale displayLocale) {\r
+            return getDisplayName(ULocale.forLocale(objectLocale), ULocale.forLocale(displayLocale));\r
+        }\r
+\r
+        /**\r
+         * Return the name of the collator for the objectLocale, localized for the displayLocale.\r
+         * If objectLocale is not visible or not defined by the factory, return null.\r
+         * @param objectLocale the locale identifying the collator\r
+         * @param displayLocale the locale for which the display name of the collator should be localized\r
+         * @return the display name\r
+         * @stable ICU 3.2\r
+         */\r
+        public String getDisplayName(ULocale objectLocale, ULocale displayLocale) {\r
+            if (visible()) {\r
+                Set<String> supported = getSupportedLocaleIDs();\r
+                String name = objectLocale.getBaseName();\r
+                if (supported.contains(name)) {\r
+                    return objectLocale.getDisplayName(displayLocale);\r
+                }\r
+            }\r
+            return null;\r
+        }\r
+\r
+        /**\r
+         * Return an unmodifiable collection of the locale names directly\r
+         * supported by this factory.\r
+         *\r
+         * @return the set of supported locale IDs.\r
+         * @stable ICU 2.6\r
+         */\r
+        public abstract Set<String> getSupportedLocaleIDs();\r
+\r
+        /**\r
+         * Empty default constructor.\r
+         * @stable ICU 2.6\r
+         */\r
+        protected CollatorFactory() {\r
+        }\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the Collator for the desired locale.\r
+     * @param locale the desired locale.\r
+     * @return Collator for the desired locale if it is created successfully.\r
+     *         Otherwise if there is no Collator\r
+     *         associated with the current locale, a default UCA collator will\r
+     *         be returned.\r
+     * @see java.util.Locale\r
+     * @see java.util.ResourceBundle\r
+     * @see #getInstance(Locale)\r
+     * @see #getInstance()\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final Collator getInstance(ULocale locale) {\r
+        return getInstance(locale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * Returns the Collator for the desired locale.\r
+     * @param locale the desired locale.\r
+     * @return Collator for the desired locale if it is created successfully.\r
+     *         Otherwise if there is no Collator\r
+     *         associated with the current locale, a default UCA collator will\r
+     *         be returned.\r
+     * @see java.util.Locale\r
+     * @see java.util.ResourceBundle\r
+     * @see #getInstance(ULocale)\r
+     * @see #getInstance()\r
+     * @stable ICU 2.8\r
+     */\r
+    public static final Collator getInstance(Locale locale) {\r
+        return new Collator(java.text.Collator.getInstance(locale));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Registers a collator as the default collator for the provided locale.  The\r
+     * collator should not be modified after it is registered.\r
+     *\r
+     * @param collator the collator to register\r
+     * @param locale the locale for which this is the default collator\r
+     * @return an object that can be used to unregister the registered collator.\r
+     *\r
+     * @stable ICU 3.2\r
+     */\r
+    public static final Object registerInstance(Collator collator, ULocale locale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Registers a collator factory.\r
+     *\r
+     * @param factory the factory to register\r
+     * @return an object that can be used to unregister the registered factory.\r
+     *\r
+     * @stable ICU 2.6\r
+     */\r
+    public static final Object registerFactory(CollatorFactory factory) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Unregisters a collator previously registered using registerInstance.\r
+     * @param registryKey the object previously returned by registerInstance.\r
+     * @return true if the collator was successfully unregistered.\r
+     * @stable ICU 2.6\r
+     */\r
+    public static final boolean unregister(Object registryKey) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the set of locales, as Locale objects, for which collators\r
+     * are installed.  Note that Locale objects do not support RFC 3066.\r
+     * @return the list of locales in which collators are installed.\r
+     * This list includes any that have been registered, in addition to\r
+     * those that are installed with ICU4J.\r
+     * @stable ICU 2.4\r
+     */\r
+    public static Locale[] getAvailableLocales() {\r
+        return java.text.Collator.getAvailableLocales();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the set of locales, as ULocale objects, for which collators\r
+     * are installed.  ULocale objects support RFC 3066.\r
+     * @return the list of locales in which collators are installed.\r
+     * This list includes any that have been registered, in addition to\r
+     * those that are installed with ICU4J.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale[] getAvailableULocales() {\r
+        Locale[] locales = java.text.Collator.getAvailableLocales();\r
+        ULocale[] ulocales = new ULocale[locales.length];\r
+        for (int i = 0; i < locales.length; ++i) {\r
+            ulocales[i] = ULocale.forLocale(locales[i]);\r
+        }\r
+        return ulocales;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns an array of all possible keywords that are relevant to\r
+     * collation. At this point, the only recognized keyword for this\r
+     * service is "collation".\r
+     * @return an array of valid collation keywords.\r
+     * @see #getKeywordValues\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final String[] getKeywords() {\r
+        // No keywords support in com.ibm.icu.base\r
+        return new String[0];\r
+    }\r
+\r
+    /**\r
+     * {@icu} Given a keyword, returns an array of all values for\r
+     * that keyword that are currently in use.\r
+     * @param keyword one of the keywords returned by getKeywords.\r
+     * @see #getKeywords\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final String[] getKeywordValues(String keyword) {\r
+        // No keywords support in com.ibm.icu.base\r
+        return new String[0];\r
+    }\r
+\r
+    /**\r
+     * {@icu} Given a key and a locale, returns an array of string values in a preferred\r
+     * order that would make a difference. These are all and only those values where\r
+     * the open (creation) of the service with the locale formed from the input locale\r
+     * plus input keyword and that value has different behavior than creation with the\r
+     * input locale alone.\r
+     * @param key           one of the keys supported by this service.  For now, only\r
+     *                      "collation" is supported.\r
+     * @param locale        the locale\r
+     * @param commonlyUsed  if set to true it will return only commonly used values\r
+     *                      with the given locale in preferred order.  Otherwise,\r
+     *                      it will return all the available values for the locale.\r
+     * @return an array of string values for the given key and the locale.\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final String[] getKeywordValuesForLocale(String key, ULocale locale, \r
+                                                           boolean commonlyUsed) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the functionally equivalent locale for the given\r
+     * requested locale, with respect to given keyword, for the\r
+     * collation service.  If two locales return the same result, then\r
+     * collators instantiated for these locales will behave\r
+     * equivalently.  The converse is not always true; two collators\r
+     * may in fact be equivalent, but return different results, due to\r
+     * internal details.  The return result has no other meaning than\r
+     * that stated above, and implies nothing as to the relationship\r
+     * between the two locales.  This is intended for use by\r
+     * applications who wish to cache collators, or otherwise reuse\r
+     * collators when possible.  The functional equivalent may change\r
+     * over time.  For more information, please see the <a\r
+     * href="http://www.icu-project.org/userguide/locale.html#services">\r
+     * Locales and Services</a> section of the ICU User Guide.\r
+     * @param keyword a particular keyword as enumerated by\r
+     * getKeywords.\r
+     * @param locID The requested locale\r
+     * @param isAvailable If non-null, isAvailable[0] will receive and\r
+     * output boolean that indicates whether the requested locale was\r
+     * 'available' to the collation service. If non-null, isAvailable\r
+     * must have length >= 1.\r
+     * @return the locale\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale getFunctionalEquivalent(String keyword,\r
+                                                        ULocale locID,\r
+                                                        boolean isAvailable[]) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the functionally equivalent locale for the given\r
+     * requested locale, with respect to given keyword, for the\r
+     * collation service.\r
+     * @param keyword a particular keyword as enumerated by\r
+     * getKeywords.\r
+     * @param locID The requested locale\r
+     * @return the locale\r
+     * @see #getFunctionalEquivalent(String,ULocale,boolean[])\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale getFunctionalEquivalent(String keyword,\r
+                                                        ULocale locID) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the name of the collator for the objectLocale, localized for the\r
+     * displayLocale.\r
+     * @param objectLocale the locale of the collator\r
+     * @param displayLocale the locale for the collator's display name\r
+     * @return the display name\r
+     * @stable ICU 2.6\r
+     */\r
+    static public String getDisplayName(Locale objectLocale, Locale displayLocale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the name of the collator for the objectLocale, localized for the\r
+     * displayLocale.\r
+     * @param objectLocale the locale of the collator\r
+     * @param displayLocale the locale for the collator's display name\r
+     * @return the display name\r
+     * @stable ICU 3.2\r
+     */\r
+    static public String getDisplayName(ULocale objectLocale, ULocale displayLocale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the name of the collator for the objectLocale, localized for the\r
+     * current locale.\r
+     * @param objectLocale the locale of the collator\r
+     * @return the display name\r
+     * @stable ICU 2.6\r
+     */\r
+    static public String getDisplayName(Locale objectLocale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the name of the collator for the objectLocale, localized for the\r
+     * current locale.\r
+     * @param objectLocale the locale of the collator\r
+     * @return the display name\r
+     * @stable ICU 3.2\r
+     */\r
+    static public String getDisplayName(ULocale objectLocale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns this Collator's strength property. The strength property\r
+     * determines the minimum level of difference considered significant.\r
+     * </p>\r
+     * {@icunote} This can return QUATERNARY strength, which is not supported by the\r
+     * JDK version.\r
+     * <p>\r
+     * See the Collator class description for more details.\r
+     * </p>\r
+     * @return this Collator's current strength property.\r
+     * @see #setStrength\r
+     * @see #PRIMARY\r
+     * @see #SECONDARY\r
+     * @see #TERTIARY\r
+     * @see #QUATERNARY\r
+     * @see #IDENTICAL\r
+     * @stable ICU 2.8\r
+     */\r
+    public int getStrength()\r
+    {\r
+        return collator.getStrength();\r
+    }\r
+\r
+    /**\r
+     * Returns the decomposition mode of this Collator. The decomposition mode\r
+     * determines how Unicode composed characters are handled.\r
+     * </p>\r
+     * <p>\r
+     * See the Collator class description for more details.\r
+     * </p>\r
+     * @return the decomposition mode\r
+     * @see #setDecomposition\r
+     * @see #NO_DECOMPOSITION\r
+     * @see #CANONICAL_DECOMPOSITION\r
+     * @stable ICU 2.8\r
+     */\r
+    public int getDecomposition()\r
+    {\r
+        return collator.getDecomposition();\r
+    }\r
+\r
+    // public other methods -------------------------------------------------\r
+\r
+    /**\r
+     * Compares the equality of two text Strings using\r
+     * this Collator's rules, strength and decomposition mode.  Convenience method.\r
+     * @param source the source string to be compared.\r
+     * @param target the target string to be compared.\r
+     * @return true if the strings are equal according to the collation\r
+     *         rules, otherwise false.\r
+     * @see #compare\r
+     * @throws NullPointerException thrown if either arguments is null.\r
+     * @stable ICU 2.8\r
+     */\r
+    public boolean equals(String source, String target)\r
+    {\r
+        return (compare(source, target) == 0);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a UnicodeSet that contains all the characters and sequences tailored\r
+     * in this collator.\r
+     * @return a pointer to a UnicodeSet object containing all the\r
+     *         code points and sequences that may sort differently than\r
+     *         in the UCA.\r
+     * @stable ICU 2.4\r
+     */\r
+    public UnicodeSet getTailoredSet()\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Compares the source text String to the target text String according to\r
+     * this Collator's rules, strength and decomposition mode.\r
+     * Returns an integer less than,\r
+     * equal to or greater than zero depending on whether the source String is\r
+     * less than, equal to or greater than the target String. See the Collator\r
+     * class description for an example of use.\r
+     * </p>\r
+     * @param source the source String.\r
+     * @param target the target String.\r
+     * @return Returns an integer value. Value is less than zero if source is\r
+     *         less than target, value is zero if source and target are equal,\r
+     *         value is greater than zero if source is greater than target.\r
+     * @see CollationKey\r
+     * @see #getCollationKey\r
+     * @throws NullPointerException thrown if either argument is null.\r
+     * @stable ICU 2.8\r
+     */\r
+    public int compare(String source, String target) {\r
+        return collator.compare(source, target);\r
+    }\r
+\r
+    /**\r
+     * Compares the source Object to the target Object.\r
+     * </p>\r
+     * @param source the source Object.\r
+     * @param target the target Object.\r
+     * @return Returns an integer value. Value is less than zero if source is\r
+     *         less than target, value is zero if source and target are equal,\r
+     *         value is greater than zero if source is greater than target.\r
+     * @throws ClassCastException thrown if either arguments cannot be cast to String.\r
+     * @stable ICU 4.2\r
+     */\r
+    public int compare(Object source, Object target) {\r
+        return compare((String)source, (String)target);\r
+    }\r
+\r
+    /**\r
+     * <p>\r
+     * Transforms the String into a CollationKey suitable for efficient\r
+     * repeated comparison.  The resulting key depends on the collator's\r
+     * rules, strength and decomposition mode.\r
+     * </p>\r
+     * <p>See the CollationKey class documentation for more information.</p>\r
+     * @param source the string to be transformed into a CollationKey.\r
+     * @return the CollationKey for the given String based on this Collator's\r
+     *         collation rules. If the source String is null, a null\r
+     *         CollationKey is returned.\r
+     * @see CollationKey\r
+     * @see #compare(String, String)\r
+     * @see #getRawCollationKey\r
+     * @stable ICU 2.8\r
+     */\r
+    public CollationKey getCollationKey(String source) {\r
+        return new CollationKey(collator.getCollationKey(source));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the simpler form of a CollationKey for the String source following\r
+     * the rules of this Collator and stores the result into the user provided argument\r
+     * key.  If key has a internal byte array of length that's too small for the result,\r
+     * the internal byte array will be grown to the exact required size.\r
+     * @param source the text String to be transformed into a RawCollationKey\r
+     * @return If key is null, a new instance of RawCollationKey will be\r
+     *         created and returned, otherwise the user provided key will be\r
+     *         returned.\r
+     * @see #compare(String, String)\r
+     * @see #getCollationKey\r
+     * @see RawCollationKey\r
+     * @stable ICU 2.8\r
+     */\r
+    public RawCollationKey getRawCollationKey(String source, RawCollationKey key) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Variable top is a two byte primary value which causes all the codepoints\r
+     * with primary values that are less or equal than the variable top to be\r
+     * shifted when alternate handling is set to SHIFTED.\r
+     * </p>\r
+     * <p>\r
+     * Sets the variable top to a collation element value of a string supplied.\r
+     * </p>\r
+     * @param varTop one or more (if contraction) characters to which the\r
+     *               variable top should be set\r
+     * @return a int value containing the value of the variable top in upper 16\r
+     *         bits. Lower 16 bits are undefined.\r
+     * @throws IllegalArgumentException is thrown if varTop argument is not\r
+     *            a valid variable top element. A variable top element is\r
+     *            invalid when it is a contraction that does not exist in the\r
+     *            Collation order or when the PRIMARY strength collation\r
+     *            element for the variable top has more than two bytes\r
+     * @see #getVariableTop\r
+     * @see RuleBasedCollator#setAlternateHandlingShifted\r
+     * @stable ICU 2.6\r
+     */\r
+    public int setVariableTop(String varTop) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the variable top value of a Collator.\r
+     * Lower 16 bits are undefined and should be ignored.\r
+     * @return the variable top value of a Collator.\r
+     * @see #setVariableTop\r
+     * @stable ICU 2.6\r
+     */\r
+    public int getVariableTop() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the variable top to a collation element value supplied.\r
+     * Variable top is set to the upper 16 bits.\r
+     * Lower 16 bits are ignored.\r
+     * @param varTop Collation element value, as returned by setVariableTop or\r
+     *               getVariableTop\r
+     * @see #getVariableTop\r
+     * @see #setVariableTop\r
+     * @stable ICU 2.6\r
+     */\r
+    public void setVariableTop(int varTop) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the version of this collator object.\r
+     * @return the version object associated with this collator\r
+     * @stable ICU 2.8\r
+     */\r
+    public VersionInfo getVersion() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the UCA version of this collator object.\r
+     * @return the version object associated with this collator\r
+     * @stable ICU 2.8\r
+     */\r
+    public VersionInfo getUCAVersion() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the locale that was used to create this object, or null.\r
+     * This may may differ from the locale requested at the time of\r
+     * this object's creation.  For example, if an object is created\r
+     * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be\r
+     * drawn from <tt>en</tt> (the <i>actual</i> locale), and\r
+     * <tt>en_US</tt> may be the most specific locale that exists (the\r
+     * <i>valid</i> locale).\r
+     *\r
+     * <p>Note: This method will be implemented in ICU 3.0; ICU 2.8\r
+     * contains a partial preview implementation.  The * <i>actual</i>\r
+     * locale is returned correctly, but the <i>valid</i> locale is\r
+     * not, in most cases.\r
+     * @param type type of information requested, either {@link\r
+     * com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link\r
+     * com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.\r
+     * @return the information specified by <i>type</i>, or null if\r
+     * this object was not constructed from locale data.\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public final ULocale getLocale(ULocale.Type type) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    // com.ibm.icu.base specific overrides\r
+    public String toString() {\r
+        return collator.toString();\r
+    }\r
+\r
+    public boolean equals(Object rhs) {\r
+        try {\r
+            return collator.equals(((Collator)rhs).collator);\r
+        }\r
+        catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    public int hashCode() {\r
+        return collator.hashCode();\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CurrencyPluralInfo.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/CurrencyPluralInfo.java
new file mode 100644 (file)
index 0000000..39f1fd1
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2011, International Business Machines Corporation and         *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.text;\r
+\r
+/*\r
+ * Empty stub\r
+ */\r
+public class CurrencyPluralInfo {\r
+    private CurrencyPluralInfo() {}\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormat.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormat.java
new file mode 100644 (file)
index 0000000..686d1dd
--- /dev/null
@@ -0,0 +1,1949 @@
+/*\r
+ *   Copyright (C) 1996-2011, International Business Machines\r
+ *   Corporation and others.  All Rights Reserved.\r
+ */\r
+\r
+package com.ibm.icu.text;\r
+\r
+import java.io.InvalidObjectException;\r
+import java.text.FieldPosition;\r
+import java.text.Format;\r
+import java.text.ParseException;\r
+import java.text.ParsePosition;\r
+import java.util.Date;\r
+import java.util.HashMap;\r
+import java.util.Locale;\r
+import java.util.Map;\r
+\r
+import com.ibm.icu.util.Calendar;\r
+import com.ibm.icu.util.TimeZone;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+/**\r
+ * {@icuenhanced java.text.DateFormat}.{@icu _usage_}\r
+ *\r
+ * <p>DateFormat is an abstract class for date/time formatting subclasses which\r
+ * formats and parses dates or time in a language-independent manner.\r
+ * The date/time formatting subclass, such as SimpleDateFormat, allows for\r
+ * formatting (i.e., date -> text), parsing (text -> date), and\r
+ * normalization.  The date is represented as a <code>Date</code> object or\r
+ * as the milliseconds since January 1, 1970, 00:00:00 GMT.\r
+ *\r
+ * <p>DateFormat provides many class methods for obtaining default date/time\r
+ * formatters based on the default or a given locale and a number of formatting\r
+ * styles. The formatting styles include FULL, LONG, MEDIUM, and SHORT. More\r
+ * detail and examples of using these styles are provided in the method\r
+ * descriptions.\r
+ *\r
+ * <p>DateFormat helps you to format and parse dates for any locale.\r
+ * Your code can be completely independent of the locale conventions for\r
+ * months, days of the week, or even the calendar format: lunar vs. solar.\r
+ *\r
+ * <p>To format a date for the current Locale, use one of the\r
+ * static factory methods:\r
+ * <pre>\r
+ *  myString = DateFormat.getDateInstance().format(myDate);\r
+ * </pre>\r
+ * <p>If you are formatting multiple numbers, it is\r
+ * more efficient to get the format and use it multiple times so that\r
+ * the system doesn't have to fetch the information about the local\r
+ * language and country conventions multiple times.\r
+ * <pre>\r
+ *  DateFormat df = DateFormat.getDateInstance();\r
+ *  for (int i = 0; i < a.length; ++i) {\r
+ *    output.println(df.format(myDate[i]) + "; ");\r
+ *  }\r
+ * </pre>\r
+ * <p>To format a number for a different Locale, specify it in the\r
+ * call to getDateInstance().\r
+ * <pre>\r
+ *  DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);\r
+ * </pre>\r
+ * <p>You can use a DateFormat to parse also.\r
+ * <pre>\r
+ *  myDate = df.parse(myString);\r
+ * </pre>\r
+ * <p>Use getDateInstance to get the normal date format for that country.\r
+ * There are other static factory methods available.\r
+ * Use getTimeInstance to get the time format for that country.\r
+ * Use getDateTimeInstance to get a date and time format. You can pass in\r
+ * different options to these factory methods to control the length of the\r
+ * result; from SHORT to MEDIUM to LONG to FULL. The exact result depends\r
+ * on the locale, but generally:\r
+ * <ul><li>SHORT is completely numeric, such as 12.13.52 or 3:30pm\r
+ * <li>MEDIUM is longer, such as Jan 12, 1952\r
+ * <li>LONG is longer, such as January 12, 1952 or 3:30:32pm\r
+ * <li>FULL is pretty completely specified, such as\r
+ * Tuesday, April 12, 1952 AD or 3:30:42pm PST.\r
+ * </ul>\r
+ *\r
+ * <p>You can also set the time zone on the format if you wish.\r
+ * If you want even more control over the format or parsing,\r
+ * (or want to give your users more control),\r
+ * you can try casting the DateFormat you get from the factory methods\r
+ * to a SimpleDateFormat. This will work for the majority\r
+ * of countries; just remember to put it in a try block in case you\r
+ * encounter an unusual one.\r
+ *\r
+ * <p>You can also use forms of the parse and format methods with\r
+ * ParsePosition and FieldPosition to\r
+ * allow you to\r
+ * <ul><li>progressively parse through pieces of a string.\r
+ * <li>align any particular field, or find out where it is for selection\r
+ * on the screen.\r
+ * </ul>\r
+ *\r
+ * <h4>Synchronization</h4>\r
+ *\r
+ * Date formats are not synchronized. It is recommended to create separate\r
+ * format instances for each thread. If multiple threads access a format\r
+ * concurrently, it must be synchronized externally.\r
+ *\r
+ * @see          UFormat\r
+ * @see          NumberFormat\r
+ * @see          SimpleDateFormat\r
+ * @see          com.ibm.icu.util.Calendar\r
+ * @see          com.ibm.icu.util.GregorianCalendar\r
+ * @see          com.ibm.icu.util.TimeZone\r
+ * @author       Mark Davis, Chen-Lieh Huang, Alan Liu\r
+ * @stable ICU 2.0\r
+ */\r
+public class DateFormat extends Format {\r
+\r
+    private static final long serialVersionUID = 1L;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    public final java.text.DateFormat dateFormat;\r
+        \r
+    /**\r
+     * @internal\r
+     * @param delegate the DateFormat to which to delegate\r
+     */\r
+    public DateFormat(java.text.DateFormat delegate) {\r
+        this.dateFormat = delegate;\r
+    }\r
+    \r
+    /**\r
+     * For subclass use.  Subclasses will generally not\r
+     * work correctly unless they manipulate the delegate.\r
+     */\r
+    protected DateFormat() {\r
+        this.dateFormat = java.text.DateFormat.getInstance();\r
+    }\r
+\r
+    /**\r
+     * FieldPosition selector for 'G' field alignment,\r
+     * corresponding to the {@link Calendar#ERA} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int ERA_FIELD = 0;\r
+\r
+    /**\r
+     * FieldPosition selector for 'y' field alignment,\r
+     * corresponding to the {@link Calendar#YEAR} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int YEAR_FIELD = 1;\r
+\r
+    /**\r
+     * FieldPosition selector for 'M' field alignment,\r
+     * corresponding to the {@link Calendar#MONTH} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MONTH_FIELD = 2;\r
+\r
+    /**\r
+     * FieldPosition selector for 'd' field alignment,\r
+     * corresponding to the {@link Calendar#DATE} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DATE_FIELD = 3;\r
+\r
+    /**\r
+     * FieldPosition selector for 'k' field alignment,\r
+     * corresponding to the {@link Calendar#HOUR_OF_DAY} field.\r
+     * HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock.\r
+     * For example, 23:59 + 01:00 results in 24:59.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int HOUR_OF_DAY1_FIELD = 4;\r
+\r
+    /**\r
+     * FieldPosition selector for 'H' field alignment,\r
+     * corresponding to the {@link Calendar#HOUR_OF_DAY} field.\r
+     * HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock.\r
+     * For example, 23:59 + 01:00 results in 00:59.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int HOUR_OF_DAY0_FIELD = 5;\r
+\r
+    /**\r
+     * FieldPosition selector for 'm' field alignment,\r
+     * corresponding to the {@link Calendar#MINUTE} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MINUTE_FIELD = 6;\r
+\r
+    /**\r
+     * FieldPosition selector for 's' field alignment,\r
+     * corresponding to the {@link Calendar#SECOND} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int SECOND_FIELD = 7;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'S' field alignment,\r
+     * corresponding to the {@link Calendar#MILLISECOND} field.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int FRACTIONAL_SECOND_FIELD = 8;\r
+\r
+    /**\r
+     * Alias for FRACTIONAL_SECOND_FIELD.\r
+     * @deprecated ICU 3.0 use FRACTIONAL_SECOND_FIELD.\r
+     */\r
+    public final static int MILLISECOND_FIELD = FRACTIONAL_SECOND_FIELD;\r
+\r
+    /**\r
+     * FieldPosition selector for 'E' field alignment,\r
+     * corresponding to the {@link Calendar#DAY_OF_WEEK} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DAY_OF_WEEK_FIELD = 9;\r
+\r
+    /**\r
+     * FieldPosition selector for 'D' field alignment,\r
+     * corresponding to the {@link Calendar#DAY_OF_YEAR} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DAY_OF_YEAR_FIELD = 10;\r
+\r
+    /**\r
+     * FieldPosition selector for 'F' field alignment,\r
+     * corresponding to the {@link Calendar#DAY_OF_WEEK_IN_MONTH} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DAY_OF_WEEK_IN_MONTH_FIELD = 11;\r
+\r
+    /**\r
+     * FieldPosition selector for 'w' field alignment,\r
+     * corresponding to the {@link Calendar#WEEK_OF_YEAR} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int WEEK_OF_YEAR_FIELD = 12;\r
+\r
+    /**\r
+     * FieldPosition selector for 'W' field alignment,\r
+     * corresponding to the {@link Calendar#WEEK_OF_MONTH} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int WEEK_OF_MONTH_FIELD = 13;\r
+\r
+    /**\r
+     * FieldPosition selector for 'a' field alignment,\r
+     * corresponding to the {@link Calendar#AM_PM} field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int AM_PM_FIELD = 14;\r
+\r
+    /**\r
+     * FieldPosition selector for 'h' field alignment,\r
+     * corresponding to the {@link Calendar#HOUR} field.\r
+     * HOUR1_FIELD is used for the one-based 12-hour clock.\r
+     * For example, 11:30 PM + 1 hour results in 12:30 AM.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int HOUR1_FIELD = 15;\r
+\r
+    /**\r
+     * FieldPosition selector for 'K' field alignment,\r
+     * corresponding to the {@link Calendar#HOUR} field.\r
+     * HOUR0_FIELD is used for the zero-based 12-hour clock.\r
+     * For example, 11:30 PM + 1 hour results in 00:30 AM.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int HOUR0_FIELD = 16;\r
+\r
+    /**\r
+     * FieldPosition selector for 'z' field alignment,\r
+     * corresponding to the {@link Calendar#ZONE_OFFSET} and\r
+     * {@link Calendar#DST_OFFSET} fields.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int TIMEZONE_FIELD = 17;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'Y' field alignment,\r
+     * corresponding to the {@link Calendar#YEAR_WOY} field.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int YEAR_WOY_FIELD = 18;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'e' field alignment,\r
+     * corresponding to the {@link Calendar#DOW_LOCAL} field.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int DOW_LOCAL_FIELD = 19;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'u' field alignment,\r
+     * corresponding to the {@link Calendar#EXTENDED_YEAR} field.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int EXTENDED_YEAR_FIELD = 20;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'g' field alignment,\r
+     * corresponding to the {@link Calendar#JULIAN_DAY} field.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int JULIAN_DAY_FIELD = 21;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'A' field alignment,\r
+     * corresponding to the {@link Calendar#MILLISECONDS_IN_DAY} field.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int MILLISECONDS_IN_DAY_FIELD = 22;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'Z' field alignment,\r
+     * corresponding to the {@link Calendar#ZONE_OFFSET} and\r
+     * {@link Calendar#DST_OFFSET} fields.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int TIMEZONE_RFC_FIELD = 23;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'v' field alignment,\r
+     * corresponding to the {@link Calendar#ZONE_OFFSET} and\r
+     * {@link Calendar#DST_OFFSET} fields.  This displays the generic zone\r
+     * name, if available.\r
+     * @stable ICU 3.4\r
+     */\r
+    public final static int TIMEZONE_GENERIC_FIELD = 24;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'c' field alignment,\r
+     * corresponding to the {@link Calendar#DAY_OF_WEEK} field.\r
+     * This displays the stand alone day name, if available.\r
+     * @stable ICU 3.4\r
+     */\r
+    public final static int STANDALONE_DAY_FIELD = 25;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'L' field alignment,\r
+     * corresponding to the {@link Calendar#MONTH} field.\r
+     * This displays the stand alone month name, if available.\r
+     * @stable ICU 3.4\r
+     */\r
+    public final static int STANDALONE_MONTH_FIELD = 26;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'Q' field alignment,\r
+     * corresponding to the {@link Calendar#MONTH} field.\r
+     * This displays the quarter.\r
+     * @stable ICU 3.6\r
+     */\r
+    public final static int QUARTER_FIELD = 27;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'q' field alignment,\r
+     * corresponding to the {@link Calendar#MONTH} field.\r
+     * This displays the stand alone quarter, if available.\r
+     * @stable ICU 3.6\r
+     */\r
+    public final static int STANDALONE_QUARTER_FIELD = 28;\r
+\r
+    /**\r
+     * {@icu} FieldPosition selector for 'V' field alignment,\r
+     * corresponding to the {@link Calendar#ZONE_OFFSET} and\r
+     * {@link Calendar#DST_OFFSET} fields.  This displays the fallback timezone\r
+     * name when VVVV is specified, and the short standard or daylight\r
+     * timezone name ignoring commonlyUsed when a single V is specified.\r
+     * @stable ICU 3.8\r
+     */\r
+    public final static int TIMEZONE_SPECIAL_FIELD = 29;\r
+\r
+    /**\r
+     * {@icu} Number of FieldPosition selectors for DateFormat.\r
+     * Valid selectors range from 0 to FIELD_COUNT-1.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final static int FIELD_COUNT = 30; // must == DateFormatSymbols.patternChars.length()\r
+\r
+    /**\r
+     * Formats a time object into a time string. Examples of time objects\r
+     * are a time value expressed in milliseconds and a Date object.\r
+     * @param obj must be a Number or a Date or a Calendar.\r
+     * @param toAppendTo the string buffer for the returning time string.\r
+     * @return the formatted time string.\r
+     * @param fieldPosition keeps track of the position of the field\r
+     * within the returned string.\r
+     * On input: an alignment field,\r
+     * if desired. On output: the offsets of the alignment field. For\r
+     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",\r
+     * if the given fieldPosition is DateFormat.YEAR_FIELD, the\r
+     * begin index and end index of fieldPosition will be set to\r
+     * 0 and 4, respectively.\r
+     * Notice that if the same time field appears\r
+     * more than once in a pattern, the fieldPosition will be set for the first\r
+     * occurrence of that time field. For instance, formatting a Date to\r
+     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern\r
+     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,\r
+     * the begin index and end index of fieldPosition will be set to\r
+     * 5 and 8, respectively, for the first occurrence of the timezone\r
+     * pattern character 'z'.\r
+     * @see java.text.Format\r
+     * @stable ICU 2.0\r
+     */\r
+    public final StringBuffer format(Object obj, StringBuffer toAppendTo,\r
+                                     FieldPosition fieldPosition)\r
+    {\r
+        if (obj instanceof Calendar) {\r
+            return format((Calendar)obj, toAppendTo, fieldPosition);\r
+        } else if (obj instanceof Date) {\r
+            return format((Date)obj, toAppendTo, fieldPosition);\r
+        } else if (obj instanceof Number) {\r
+            return format(new Date(((Number)obj).longValue()), toAppendTo, fieldPosition );\r
+        }\r
+\r
+        throw new IllegalArgumentException("Cannot format given Object (" +\r
+                                               obj.getClass().getName() + ") as a Date");\r
+    }\r
+\r
+    /**\r
+     * Formats a date into a date/time string.\r
+     * @param cal a Calendar set to the date and time to be formatted\r
+     * into a date/time string.  When the calendar type is different from\r
+     * the internal calendar held by this DateFormat instance, the date\r
+     * and the time zone will be inherited from the input calendar, but\r
+     * other calendar field values will be calculated by the internal calendar.\r
+     * @param toAppendTo the string buffer for the returning date/time string.\r
+     * @param fieldPosition keeps track of the position of the field\r
+     * within the returned string.\r
+     * On input: an alignment field,\r
+     * if desired. On output: the offsets of the alignment field. For\r
+     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",\r
+     * if the given fieldPosition is DateFormat.YEAR_FIELD, the\r
+     * begin index and end index of fieldPosition will be set to\r
+     * 0 and 4, respectively.\r
+     * Notice that if the same time field appears\r
+     * more than once in a pattern, the fieldPosition will be set for the first\r
+     * occurrence of that time field. For instance, formatting a Date to\r
+     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern\r
+     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,\r
+     * the begin index and end index of fieldPosition will be set to\r
+     * 5 and 8, respectively, for the first occurrence of the timezone\r
+     * pattern character 'z'.\r
+     * @return the formatted date/time string.\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(Calendar cal, StringBuffer toAppendTo,\r
+                                        FieldPosition fieldPosition) {\r
+        return format(cal.getTime(), toAppendTo, fieldPosition);\r
+    }\r
+\r
+    /**\r
+     * Formats a Date into a date/time string.\r
+     * @param date a Date to be formatted into a date/time string.\r
+     * @param toAppendTo the string buffer for the returning date/time string.\r
+     * @param fieldPosition keeps track of the position of the field\r
+     * within the returned string.\r
+     * On input: an alignment field,\r
+     * if desired. On output: the offsets of the alignment field. For\r
+     * example, given a time text "1996.07.10 AD at 15:08:56 PDT",\r
+     * if the given fieldPosition is DateFormat.YEAR_FIELD, the\r
+     * begin index and end index of fieldPosition will be set to\r
+     * 0 and 4, respectively.\r
+     * Notice that if the same time field appears\r
+     * more than once in a pattern, the fieldPosition will be set for the first\r
+     * occurrence of that time field. For instance, formatting a Date to\r
+     * the time string "1 PM PDT (Pacific Daylight Time)" using the pattern\r
+     * "h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,\r
+     * the begin index and end index of fieldPosition will be set to\r
+     * 5 and 8, respectively, for the first occurrence of the timezone\r
+     * pattern character 'z'.\r
+     * @return the formatted date/time string.\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(Date date, StringBuffer toAppendTo,\r
+                                     FieldPosition fieldPosition) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(fieldPosition);\r
+        StringBuffer buf = dateFormat.format(date, toAppendTo, jdkPos);\r
+        if (jdkPos != null) {\r
+            fieldPosition.setBeginIndex(jdkPos.getBeginIndex());\r
+            fieldPosition.setEndIndex(jdkPos.getEndIndex());\r
+        }\r
+        return buf;\r
+    }\r
+\r
+    /**\r
+     * Formats a Date into a date/time string.\r
+     * @param date the time value to be formatted into a time string.\r
+     * @return the formatted time string.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String format(Date date)\r
+    {\r
+        return dateFormat.format(date);\r
+    }\r
+\r
+    /**\r
+     * Parses a date/time string.\r
+     *\r
+     * @param text  The date/time string to be parsed\r
+     *\r
+     * @return      A Date, or null if the input could not be parsed\r
+     *\r
+     * @exception  ParseException  If the given string cannot be parsed as a date.\r
+     *\r
+     * @see #parse(String, ParsePosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public Date parse(String text) throws ParseException\r
+    {\r
+        return dateFormat.parse(text);\r
+    }\r
+\r
+    /**\r
+     * Parses a date/time string according to the given parse position.\r
+     * For example, a time text "07/10/96 4:5 PM, PDT" will be parsed\r
+     * into a Calendar that is equivalent to Date(837039928046).  The\r
+     * caller should clear the calendar before calling this method,\r
+     * unless existing field information is to be kept.\r
+     *\r
+     * <p> By default, parsing is lenient: If the input is not in the form used\r
+     * by this object's format method but can still be parsed as a date, then\r
+     * the parse succeeds.  Clients may insist on strict adherence to the\r
+     * format by calling setLenient(false).\r
+     *\r
+     * @see #setLenient(boolean)\r
+     *\r
+     * @param text  The date/time string to be parsed\r
+     *\r
+     * @param cal   The calendar into which parsed data will be stored.\r
+     *              In general, this should be cleared before calling this\r
+     *              method.  If this parse fails, the calendar may still\r
+     *              have been modified.  When the calendar type is different\r
+     *              from the internal calendar held by this DateFormat\r
+     *              instance, calendar field values will be parsed based\r
+     *              on the internal calendar initialized with the time and\r
+     *              the time zone taken from this calendar, then the\r
+     *              parse result (time in milliseconds and time zone) will\r
+     *              be set back to this calendar.\r
+     *\r
+     * @param pos   On input, the position at which to start parsing; on\r
+     *              output, the position at which parsing terminated, or the\r
+     *              start position if the parse failed.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void parse(String text, Calendar cal, ParsePosition pos) {\r
+        Date result = dateFormat.parse(text, pos);\r
+        cal.setTime(result);\r
+    }\r
+\r
+    /**\r
+     * Parses a date/time string according to the given parse position.  For\r
+     * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date\r
+     * that is equivalent to Date(837039928046).\r
+     *\r
+     * <p> By default, parsing is lenient: If the input is not in the form used\r
+     * by this object's format method but can still be parsed as a date, then\r
+     * the parse succeeds.  Clients may insist on strict adherence to the\r
+     * format by calling setLenient(false).\r
+     *\r
+     * @see #setLenient(boolean)\r
+     *\r
+     * @param text  The date/time string to be parsed\r
+     *\r
+     * @param pos   On input, the position at which to start parsing; on\r
+     *              output, the position at which parsing terminated, or the\r
+     *              start position if the parse failed.\r
+     *\r
+     * @return      A Date, or null if the input could not be parsed\r
+     * @stable ICU 2.0\r
+     */\r
+    public Date parse(String text, ParsePosition pos) {\r
+        return dateFormat.parse(text, pos);\r
+    }\r
+\r
+    /**\r
+     * Parses a date/time string into an Object.  This convenience method simply\r
+     * calls parse(String, ParsePosition).\r
+     *\r
+     * @see #parse(String, ParsePosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object parseObject (String source, ParsePosition pos)\r
+    {\r
+        return parse(source, pos);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Constant for empty style pattern.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int NONE = -1;\r
+\r
+    /**\r
+     * Constant for full style pattern.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int FULL = 0;\r
+\r
+    /**\r
+     * Constant for long style pattern.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int LONG = 1;\r
+\r
+    /**\r
+     * Constant for medium style pattern.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int MEDIUM = 2;\r
+\r
+    /**\r
+     * Constant for short style pattern.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int SHORT = 3;\r
+\r
+    /**\r
+     * Constant for default style pattern.  Its value is MEDIUM.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int DEFAULT = MEDIUM;\r
+\r
+    /**\r
+     * {@icu} Constant for relative style mask.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int RELATIVE = (1 << 7);\r
+\r
+    /**\r
+     * {@icu} Constant for relative full style pattern.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int RELATIVE_FULL = RELATIVE | FULL;\r
+\r
+    /**\r
+     * {@icu} Constant for relative style pattern.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int RELATIVE_LONG = RELATIVE | LONG;\r
+\r
+    /**\r
+     * {@icu} Constant for relative style pattern.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int RELATIVE_MEDIUM = RELATIVE | MEDIUM;\r
+\r
+    /**\r
+     * {@icu} Constant for relative style pattern.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int RELATIVE_SHORT = RELATIVE | SHORT;\r
+\r
+    /**\r
+     * {@icu} Constant for relative default style pattern.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static final int RELATIVE_DEFAULT = RELATIVE | DEFAULT;\r
+\r
+    /* Below are pre-defined skeletons\r
+     *\r
+     * <P>\r
+     * A skeleton\r
+     * <ul>\r
+     * <li>\r
+     * 1. only keeps the field pattern letter and ignores all other parts\r
+     *    in a pattern, such as space, punctuations, and string literals.\r
+     * <li>\r
+     * 2. hides the order of fields.\r
+     * <li>\r
+     * 3. might hide a field's pattern letter length.\r
+     *\r
+     *    For those non-digit calendar fields, the pattern letter length is\r
+     *    important, such as MMM, MMMM, and MMMMM; E and EEEE,\r
+     *    and the field's pattern letter length is honored.\r
+     *\r
+     *    For the digit calendar fields,  such as M or MM, d or dd, yy or yyyy,\r
+     *    the field pattern length is ignored and the best match, which is\r
+     *    defined in date time patterns, will be returned without honor\r
+     *    the field pattern letter length in skeleton.\r
+     * </ul>\r
+     */\r
+    /**\r
+     * {@icu} Constant for date pattern with minute and second.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String MINUTE_SECOND = "ms";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour and minute in 24-hour presentation.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR24_MINUTE = "Hm";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour, minute, and second in\r
+     * 24-hour presentation.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR24_MINUTE_SECOND = "Hms";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour, minute, and second.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR_MINUTE_SECOND = "hms";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with standalone month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String STANDALONE_MONTH = "LLLL";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with standalone abbreviated month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String ABBR_STANDALONE_MONTH = "LLL";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year and quarter.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_QUARTER = "yQQQ";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year and abbreviated quarter.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_ABBR_QUARTER = "yQ";\r
+\r
+\r
+    /* Below are skeletons that date interval pre-defined in resource file.\r
+     * Users are encouraged to use them in date interval format factory methods.\r
+     */\r
+    /**\r
+     * {@icu} Constant for date pattern with hour and minute.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR_MINUTE = "hm";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR = "y";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String DAY = "d";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with numeric month, weekday, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String NUM_MONTH_WEEKDAY_DAY = "MEd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year and numeric month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_NUM_MONTH = "yM";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with numeric month and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String NUM_MONTH_DAY = "Md";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year, numeric month, weekday, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_NUM_MONTH_WEEKDAY_DAY = "yMEd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with abbreviated month, weekday, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String ABBR_MONTH_WEEKDAY_DAY = "MMMEd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year and month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_MONTH = "yMMMM";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year and abbreviated month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_ABBR_MONTH = "yMMM";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern having month and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String MONTH_DAY = "MMMMd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with abbreviated month and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String ABBR_MONTH_DAY = "MMMd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with month, weekday, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String MONTH_WEEKDAY_DAY = "MMMMEEEEd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year, abbreviated month, weekday,\r
+     * and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_ABBR_MONTH_WEEKDAY_DAY = "yMMMEd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year, month, weekday, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_MONTH_WEEKDAY_DAY = "yMMMMEEEEd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year, month, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_MONTH_DAY = "yMMMMd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year, abbreviated month, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_ABBR_MONTH_DAY = "yMMMd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with year, numeric month, and day.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String YEAR_NUM_MONTH_DAY = "yMd";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with numeric month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String NUM_MONTH = "M";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with abbreviated month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String ABBR_MONTH = "MMM";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with month.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String MONTH = "MMMM";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour, minute, and generic timezone.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR_MINUTE_GENERIC_TZ = "hmv";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour, minute, and timezone.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR_MINUTE_TZ = "hmz";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR = "h";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour and generic timezone.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR_GENERIC_TZ = "hv";\r
+\r
+    /**\r
+     * {@icu} Constant for date pattern with hour and timezone.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final String HOUR_TZ = "hz";\r
+\r
+    /**\r
+     * Gets the time formatter with the default formatting style\r
+     * for the default locale.\r
+     * @return a time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getTimeInstance()\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getTimeInstance());\r
+    }\r
+\r
+    /**\r
+     * Returns the time formatter with the given formatting style\r
+     * for the default locale.\r
+     * @param style the given formatting style. For example,\r
+     * SHORT for "h:mm a" in the US locale.\r
+     * @return a time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getTimeInstance(int style)\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(style)));\r
+    }\r
+\r
+    /**\r
+     * Returns the time formatter with the given formatting style\r
+     * for the given locale.\r
+     * @param style the given formatting style. For example,\r
+     * SHORT for "h:mm a" in the US locale.\r
+     * @param aLocale the given locale.\r
+     * @return a time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getTimeInstance(int style,\r
+                                                 Locale aLocale)\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(style), aLocale));\r
+    }\r
+\r
+    /**\r
+     * Returns the time formatter with the given formatting style\r
+     * for the given locale.\r
+     * @param style the given formatting style. For example,\r
+     * SHORT for "h:mm a" in the US locale.\r
+     * @param locale the given ulocale.\r
+     * @return a time formatter.\r
+     * @stable ICU 3.2\r
+     */\r
+    public final static DateFormat getTimeInstance(int style,\r
+                                                 ULocale locale)\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(style), locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Returns the date formatter with the default formatting style\r
+     * for the default locale.\r
+     * @return a date formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getDateInstance()\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getDateInstance());\r
+    }\r
+\r
+    /**\r
+     * Returns the date formatter with the given formatting style\r
+     * for the default locale.\r
+     * @param style the given formatting style. For example,\r
+     * SHORT for "M/d/yy" in the US locale.\r
+     * @return a date formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getDateInstance(int style)\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(style)));\r
+    }\r
+\r
+    /**\r
+     * Returns the date formatter with the given formatting style\r
+     * for the given locale.\r
+     * @param style the given formatting style. For example,\r
+     * SHORT for "M/d/yy" in the US locale.\r
+     * @param aLocale the given locale.\r
+     * @return a date formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getDateInstance(int style,\r
+                                                 Locale aLocale)\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(style), aLocale));\r
+    }\r
+\r
+    /**\r
+     * Returns the date formatter with the given formatting style\r
+     * for the given locale.\r
+     * @param style the given formatting style. For example,\r
+     * SHORT for "M/d/yy" in the US locale.\r
+     * @param locale the given ulocale.\r
+     * @return a date formatter.\r
+     * @stable ICU 3.2\r
+     */\r
+    public final static DateFormat getDateInstance(int style,\r
+                                                 ULocale locale)\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(style), locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Returns the date/time formatter with the default formatting style\r
+     * for the default locale.\r
+     * @return a date/time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getDateTimeInstance()\r
+    {\r
+        return new DateFormat(java.text.DateFormat.getDateTimeInstance());\r
+    }\r
+\r
+    /**\r
+     * Returns the date/time formatter with the given date and time\r
+     * formatting styles for the default locale.\r
+     * @param dateStyle the given date formatting style. For example,\r
+     * SHORT for "M/d/yy" in the US locale.\r
+     * @param timeStyle the given time formatting style. For example,\r
+     * SHORT for "h:mm a" in the US locale.\r
+     * @return a date/time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getDateTimeInstance(int dateStyle,\r
+                                                       int timeStyle)\r
+    {\r
+        if (dateStyle != NONE) {\r
+            if (timeStyle != NONE) {\r
+                return new DateFormat(java.text.DateFormat.getDateTimeInstance(getJDKFormatStyle(dateStyle), getJDKFormatStyle(timeStyle)));\r
+            } else {\r
+                return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(dateStyle)));\r
+            }\r
+        }\r
+        if (timeStyle != NONE) {\r
+            return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(timeStyle)));\r
+        }\r
+        return null;\r
+    }\r
+\r
+    /**\r
+     * Returns the date/time formatter with the given formatting styles\r
+     * for the given locale.\r
+     * @param dateStyle the given date formatting style.\r
+     * @param timeStyle the given time formatting style.\r
+     * @param aLocale the given locale.\r
+     * @return a date/time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getDateTimeInstance(\r
+        int dateStyle, int timeStyle, Locale aLocale)\r
+    {\r
+        if (dateStyle != NONE) {\r
+            if (timeStyle != NONE) {\r
+                return new DateFormat(java.text.DateFormat.getDateTimeInstance(getJDKFormatStyle(dateStyle), getJDKFormatStyle(timeStyle), aLocale));\r
+            } else {\r
+                return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(dateStyle), aLocale));\r
+            }\r
+        }\r
+        if (timeStyle != NONE) {\r
+            return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(timeStyle), aLocale));\r
+        }\r
+        return null;\r
+    }\r
+\r
+    /**\r
+     * Returns the date/time formatter with the given formatting styles\r
+     * for the given locale.\r
+     * @param dateStyle the given date formatting style.\r
+     * @param timeStyle the given time formatting style.\r
+     * @param locale the given ulocale.\r
+     * @return a date/time formatter.\r
+     * @stable ICU 3.2\r
+     */\r
+    public final static DateFormat getDateTimeInstance(\r
+        int dateStyle, int timeStyle, ULocale locale)\r
+    {\r
+        if (dateStyle != NONE) {\r
+            if (timeStyle != NONE) {\r
+                return new DateFormat(java.text.DateFormat.getDateTimeInstance(getJDKFormatStyle(dateStyle), getJDKFormatStyle(timeStyle), locale.toLocale()));\r
+            } else {\r
+                return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(dateStyle), locale.toLocale()));\r
+            }\r
+        }\r
+        if (timeStyle != NONE) {\r
+            return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(timeStyle), locale.toLocale()));\r
+        }\r
+        return null;\r
+    }\r
+\r
+    /**\r
+     * Returns a default date/time formatter that uses the SHORT style for both the\r
+     * date and the time.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static DateFormat getInstance() {\r
+        return new DateFormat(java.text.DateFormat.getInstance());\r
+    }\r
+\r
+    /**\r
+     * Returns the set of locales for which DateFormats are installed.\r
+     * @return the set of locales for which DateFormats are installed.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static Locale[] getAvailableLocales()\r
+    {\r
+        return java.text.DateFormat.getAvailableLocales();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the set of locales for which DateFormats are installed.\r
+     * @return the set of locales for which DateFormats are installed.\r
+     * @draft ICU 3.2 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static ULocale[] getAvailableULocales()\r
+    {\r
+        if (availableULocales == null) {\r
+            synchronized(DateFormat.class) {\r
+                if (availableULocales == null) {\r
+                    Locale[] locales = java.text.DateFormat.getAvailableLocales();\r
+                    availableULocales = new ULocale[locales.length];\r
+                    for (int i = 0; i < locales.length; ++i) {\r
+                        availableULocales[i] = ULocale.forLocale(locales[i]);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return availableULocales;\r
+    }\r
+    private static volatile ULocale[] availableULocales;\r
+\r
+    /**\r
+     * Sets the calendar to be used by this date format.  Initially, the default\r
+     * calendar for the specified or default locale is used.\r
+     * @param newCalendar the new Calendar to be used by the date format\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setCalendar(Calendar newCalendar)\r
+    {\r
+        dateFormat.setCalendar(newCalendar.calendar);\r
+    }\r
+\r
+    /**\r
+     * Returns the calendar associated with this date/time formatter.\r
+     * @return the calendar associated with this date/time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Calendar getCalendar()\r
+    {\r
+        return new Calendar(dateFormat.getCalendar());\r
+    }\r
+\r
+    /**\r
+     * Sets the number formatter.\r
+     * @param newNumberFormat the given new NumberFormat.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setNumberFormat(NumberFormat newNumberFormat)\r
+    {\r
+        dateFormat.setNumberFormat(newNumberFormat.numberFormat);\r
+    }\r
+\r
+    /**\r
+     * Returns the number formatter which this date/time formatter uses to\r
+     * format and parse a time.\r
+     * @return the number formatter which this date/time formatter uses.\r
+     * @stable ICU 2.0\r
+     */\r
+    public NumberFormat getNumberFormat()\r
+    {\r
+        return new NumberFormat(dateFormat.getNumberFormat());\r
+    }\r
+\r
+    /**\r
+     * Sets the time zone for the calendar of this DateFormat object.\r
+     * @param zone the given new time zone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setTimeZone(TimeZone zone)\r
+    {\r
+        dateFormat.setTimeZone(zone.timeZone);\r
+    }\r
+\r
+    /**\r
+     * Returns the time zone.\r
+     * @return the time zone associated with the calendar of DateFormat.\r
+     * @stable ICU 2.0\r
+     */\r
+    public TimeZone getTimeZone()\r
+    {\r
+        return new TimeZone(dateFormat.getTimeZone());\r
+    }\r
+\r
+    /**\r
+     * Specifies whether date/time parsing is to be lenient.  With\r
+     * lenient parsing, the parser may use heuristics to interpret inputs that\r
+     * do not precisely match this object's format.  With strict parsing,\r
+     * inputs must match this object's format.\r
+     * @param lenient when true, parsing is lenient\r
+     * @see com.ibm.icu.util.Calendar#setLenient\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setLenient(boolean lenient)\r
+    {\r
+        dateFormat.setLenient(lenient);\r
+    }\r
+\r
+    /**\r
+     * Returns whether date/time parsing is lenient.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isLenient()\r
+    {\r
+        return dateFormat.isLenient();\r
+    }\r
+\r
+    /**\r
+     * Overrides hashCode.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int hashCode() {\r
+        return dateFormat.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Overrides equals.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean equals(Object obj) {\r
+        try {\r
+            return dateFormat.equals(((DateFormat)obj).dateFormat);\r
+        }\r
+        catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Overrides clone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone()\r
+    {\r
+        return new DateFormat((java.text.DateFormat)dateFormat.clone());\r
+    }\r
+\r
+    //-------------------------------------------------------------------------\r
+    // Public static interface for creating custon DateFormats for different\r
+    // types of Calendars.\r
+    //-------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Creates a {@link DateFormat} object that can be used to format dates in\r
+     * the calendar system specified by <code>cal</code>.\r
+     * <p>\r
+     * @param cal   The calendar system for which a date format is desired.\r
+     *\r
+     * @param dateStyle The type of date format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param locale The locale for which the date format is desired.\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getDateInstance(Calendar cal, int dateStyle, Locale locale)\r
+    {\r
+        DateFormat df = getDateInstance(dateStyle, locale);\r
+        df.setCalendar(cal);\r
+        return df;\r
+    }\r
+\r
+    /**\r
+     * Creates a {@link DateFormat} object that can be used to format dates in\r
+     * the calendar system specified by <code>cal</code>.\r
+     * <p>\r
+     * @param cal   The calendar system for which a date format is desired.\r
+     *\r
+     * @param dateStyle The type of date format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param locale The locale for which the date format is desired.\r
+     * @stable ICU 3.2\r
+     */\r
+    static final public DateFormat getDateInstance(Calendar cal, int dateStyle, ULocale locale)\r
+    {\r
+        DateFormat df = getDateInstance(dateStyle, locale);\r
+        df.setCalendar(cal);\r
+        return df;\r
+    }\r
+\r
+    /**\r
+     * Creates a {@link DateFormat} object that can be used to format times in\r
+     * the calendar system specified by <code>cal</code>.\r
+     * <p>\r
+     * <b>Note:</b> When this functionality is moved into the core JDK, this method\r
+     * will probably be replaced by a new overload of {@link DateFormat#getInstance}.\r
+     * <p>\r
+     * @param cal   The calendar system for which a time format is desired.\r
+     *\r
+     * @param timeStyle The type of time format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param locale The locale for which the time format is desired.\r
+     *\r
+     * @see DateFormat#getTimeInstance\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getTimeInstance(Calendar cal, int timeStyle, Locale locale)\r
+    {\r
+        DateFormat df = getTimeInstance(timeStyle, locale);\r
+        df.setCalendar(cal);\r
+        return df;\r
+    }\r
+\r
+    /**\r
+     * Creates a {@link DateFormat} object that can be used to format times in\r
+     * the calendar system specified by <code>cal</code>.\r
+     * <p>\r
+     * <b>Note:</b> When this functionality is moved into the core JDK, this method\r
+     * will probably be replaced by a new overload of {@link DateFormat#getInstance}.\r
+     * <p>\r
+     * @param cal   The calendar system for which a time format is desired.\r
+     *\r
+     * @param timeStyle The type of time format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param locale The locale for which the time format is desired.\r
+     *\r
+     * @see DateFormat#getTimeInstance\r
+     * @stable ICU 3.2\r
+     */\r
+    static final public DateFormat getTimeInstance(Calendar cal, int timeStyle, ULocale locale)\r
+    {\r
+        DateFormat df = getTimeInstance(timeStyle, locale);\r
+        df.setCalendar(cal);\r
+        return df;\r
+    }\r
+\r
+    /**\r
+     * Creates a {@link DateFormat} object that can be used to format dates and times in\r
+     * the calendar system specified by <code>cal</code>.\r
+     * <p>\r
+     * <b>Note:</b> When this functionality is moved into the core JDK, this method\r
+     * will probably be replaced by a new overload of {@link DateFormat#getInstance}.\r
+     * <p>\r
+     * @param cal   The calendar system for which a date/time format is desired.\r
+     *\r
+     * @param dateStyle The type of date format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param timeStyle The type of time format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param locale The locale for which the date/time format is desired.\r
+     *\r
+     * @see DateFormat#getDateTimeInstance\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle,\r
+                                                 int timeStyle, Locale locale)\r
+    {\r
+        DateFormat df = getDateTimeInstance(dateStyle, timeStyle, locale);\r
+        df.setCalendar(cal);\r
+        return df;\r
+    }\r
+\r
+    /**\r
+     * Creates a {@link DateFormat} object that can be used to format dates and times in\r
+     * the calendar system specified by <code>cal</code>.\r
+     * <p>\r
+     * <b>Note:</b> When this functionality is moved into the core JDK, this method\r
+     * will probably be replaced by a new overload of {@link DateFormat#getInstance}.\r
+     * <p>\r
+     * @param cal   The calendar system for which a date/time format is desired.\r
+     *\r
+     * @param dateStyle The type of date format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param timeStyle The type of time format desired.  This can be\r
+     *              {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},\r
+     *              etc.\r
+     *\r
+     * @param locale The locale for which the date/time format is desired.\r
+     *\r
+     * @see DateFormat#getDateTimeInstance\r
+     * @stable ICU 3.2\r
+     */\r
+    static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle,\r
+                                                 int timeStyle, ULocale locale)\r
+    {\r
+        DateFormat df = getDateTimeInstance(dateStyle, timeStyle, locale);\r
+        df.setCalendar(cal);\r
+        return df;\r
+    }\r
+\r
+    /**\r
+     * Convenience overload.\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getInstance(Calendar cal, Locale locale) {\r
+        return getDateTimeInstance(cal, DateFormat.MEDIUM, DateFormat.SHORT, locale);\r
+    }\r
+\r
+    /**\r
+     * Convenience overload.\r
+     * @stable ICU 3.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    static final public DateFormat getInstance(Calendar cal, ULocale locale) {\r
+        return getDateTimeInstance(cal, DateFormat.MEDIUM, DateFormat.SHORT, locale);\r
+    }\r
+\r
+    /**\r
+     * Convenience overload.\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getInstance(Calendar cal) {\r
+        return getInstance(cal, ULocale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Convenience overload.\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getDateInstance(Calendar cal, int dateStyle) {\r
+        return getDateInstance(cal, dateStyle, ULocale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Convenience overload.\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getTimeInstance(Calendar cal, int timeStyle) {\r
+        return getTimeInstance(cal, timeStyle, ULocale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Convenience overload.\r
+     * @stable ICU 2.0\r
+     */\r
+    static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle, int timeStyle) {\r
+        return getDateTimeInstance(cal, dateStyle, timeStyle, ULocale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Convenience overload.\r
+     * @stable ICU 4.0\r
+     */\r
+    public final static DateFormat getPatternInstance(String pattern) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Convenience overload.\r
+     * @stable ICU 4.0\r
+     */\r
+    public final static DateFormat getPatternInstance(String pattern, Locale locale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a {@link DateFormat} object that can be used to format dates and times in\r
+     * the given locale.\r
+     * <p>\r
+     * <b>Note:</b> When this functionality is moved into the core JDK, this method\r
+     * will probably be replaced by a new overload of {@link DateFormat#getInstance}.\r
+     * <p>\r
+     *\r
+     * @param pattern The pattern that selects the fields to be formatted. (Uses the\r
+     *              {@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},\r
+     *              {@link DateFormat#MONTH_WEEKDAY_DAY}, etc.\r
+     *\r
+     * @param locale The locale for which the date/time format is desired.\r
+     *\r
+     * @stable ICU 4.0\r
+     */\r
+    public final static DateFormat getPatternInstance(String pattern, ULocale locale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Convenience overload.\r
+     * @stable ICU 4.0\r
+     */\r
+    public final static DateFormat getPatternInstance(Calendar cal, String pattern, Locale locale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Creates a {@link DateFormat} object that can be used to format dates and\r
+     * times in the calendar system specified by <code>cal</code>.\r
+     *\r
+     * <p><b>Note:</b> When this functionality is moved into the core JDK, this method\r
+     * will probably be replaced by a new overload of {@link DateFormat#getInstance}.\r
+     *\r
+     * @param cal   The calendar system for which a date/time format is desired.\r
+     *\r
+     * @param pattern The pattern that selects the fields to be formatted. (Uses the\r
+     *              {@link DateTimePatternGenerator}.)  This can be\r
+     *              {@link DateFormat#ABBR_MONTH}, {@link DateFormat#MONTH_WEEKDAY_DAY},\r
+     *              etc.\r
+     *\r
+     * @param locale The locale for which the date/time format is desired.\r
+     *\r
+     * @stable ICU 4.0\r
+     */\r
+    public final static DateFormat getPatternInstance(\r
+        Calendar cal, String pattern, ULocale locale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * The instances of this inner class are used as attribute keys and values\r
+     * in AttributedCharacterIterator that\r
+     * DateFormat.formatToCharacterIterator() method returns.\r
+     *\r
+     * <p>There is no public constructor to this class, the only instances are the\r
+     * constants defined here.\r
+     * <p>\r
+     * @stable ICU 3.8\r
+     */\r
+    public static class Field extends Format.Field {\r
+\r
+        private static final long serialVersionUID = -3627456821000730829L;\r
+\r
+        // Max number of calendar fields\r
+        private static final int CAL_FIELD_COUNT;\r
+\r
+        // Table for mapping calendar field number to DateFormat.Field\r
+        private static final Field[] CAL_FIELDS;\r
+\r
+        // Map for resolving DateFormat.Field by name\r
+        private static final Map<String, Field> FIELD_NAME_MAP;\r
+\r
+        static {\r
+            Calendar cal = Calendar.getInstance();\r
+            CAL_FIELD_COUNT = cal.getFieldCount();\r
+            CAL_FIELDS = new Field[CAL_FIELD_COUNT];\r
+            FIELD_NAME_MAP = new HashMap<String, Field>(CAL_FIELD_COUNT);\r
+        }\r
+\r
+        // Java fields -------------------\r
+\r
+        /**\r
+         * Constant identifying the time of day indicator(am/pm).\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field AM_PM = new Field("am pm", Calendar.AM_PM);\r
+\r
+        /**\r
+         * Constant identifying the day of month field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field DAY_OF_MONTH = new Field("day of month", Calendar.DAY_OF_MONTH);\r
+\r
+        /**\r
+         * Constant identifying the day of week field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field DAY_OF_WEEK = new Field("day of week", Calendar.DAY_OF_WEEK);\r
+\r
+        /**\r
+         * Constant identifying the day of week in month field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field DAY_OF_WEEK_IN_MONTH =\r
+            new Field("day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH);\r
+\r
+        /**\r
+         * Constant identifying the day of year field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field DAY_OF_YEAR = new Field("day of year", Calendar.DAY_OF_YEAR);\r
+\r
+        /**\r
+         * Constant identifying the era field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field ERA = new Field("era", Calendar.ERA);\r
+\r
+        /**\r
+         * Constant identifying the hour(0-23) of day field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field HOUR_OF_DAY0 = new Field("hour of day", Calendar.HOUR_OF_DAY);\r
+\r
+        /**\r
+         * Constant identifying the hour(1-24) of day field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field HOUR_OF_DAY1 = new Field("hour of day 1", -1);\r
+\r
+        /**\r
+         * Constant identifying the hour(0-11) field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field HOUR0 = new Field("hour", Calendar.HOUR);\r
+\r
+        /**\r
+         * Constant identifying the hour(1-12) field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field HOUR1 = new Field("hour 1", -1);\r
+\r
+        /**\r
+         * Constant identifying the millisecond field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field MILLISECOND = new Field("millisecond", Calendar.MILLISECOND);\r
+\r
+        /**\r
+         * Constant identifying the minute field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field MINUTE = new Field("minute", Calendar.MINUTE);\r
+\r
+        /**\r
+         * Constant identifying the month field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field MONTH = new Field("month", Calendar.MONTH);\r
+\r
+        /**\r
+         * Constant identifying the second field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field SECOND = new Field("second", Calendar.SECOND);\r
+\r
+        /**\r
+         * Constant identifying the time zone field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field TIME_ZONE = new Field("time zone", -1);\r
+\r
+        /**\r
+         * Constant identifying the week of month field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field WEEK_OF_MONTH =\r
+            new Field("week of month", Calendar.WEEK_OF_MONTH);\r
+\r
+        /**\r
+         * Constant identifying the week of year field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field WEEK_OF_YEAR = new Field("week of year", Calendar.WEEK_OF_YEAR);\r
+\r
+        /**\r
+         * Constant identifying the year field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field YEAR = new Field("year", Calendar.YEAR);\r
+\r
+\r
+        // ICU only fields -------------------\r
+\r
+        /**\r
+         * Constant identifying the local day of week field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field DOW_LOCAL = new Field("local day of week", Calendar.DOW_LOCAL);\r
+\r
+        /**\r
+         * Constant identifying the extended year field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field EXTENDED_YEAR = new Field("extended year", \r
+                                                            Calendar.EXTENDED_YEAR);\r
+\r
+        /**\r
+         * Constant identifying the Julian day field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field JULIAN_DAY = new Field("Julian day", Calendar.JULIAN_DAY);\r
+\r
+        /**\r
+         * Constant identifying the milliseconds in day field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field MILLISECONDS_IN_DAY =\r
+            new Field("milliseconds in day", Calendar.MILLISECONDS_IN_DAY);\r
+\r
+        /**\r
+         * Constant identifying the year used with week of year field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field YEAR_WOY = new Field("year for week of year", Calendar.YEAR_WOY);\r
+\r
+        /**\r
+         * Constant identifying the quarter field.\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field QUARTER = new Field("quarter", -1);\r
+\r
+        // Stand alone types are variants for its base types.  So we do not define Field for\r
+        // them.\r
+        /*\r
+        public static final Field STANDALONE_DAY =\r
+            new Field("stand alone day of week", Calendar.DAY_OF_WEEK);\r
+        public static final Field STANDALONE_MONTH = new Field("stand alone month", Calendar.MONTH);\r
+        public static final Field STANDALONE_QUARTER = new Field("stand alone quarter", -1);\r
+        */\r
+\r
+        // Corresponding calendar field\r
+        private final int calendarField;\r
+\r
+        /**\r
+         * Constructs a <code>DateFormat.Field</code> with the given name and\r
+         * the <code>Calendar</code> field which this attribute represents.  Use -1 for\r
+         * <code>calendarField</code> if this field does not have a corresponding\r
+         * <code>Calendar</code> field.\r
+         *\r
+         * @param name          Name of the attribute\r
+         * @param calendarField <code>Calendar</code> field constant\r
+         *\r
+         * @stable ICU 3.8\r
+         */\r
+        protected Field(String name, int calendarField) {\r
+            super(name);\r
+            this.calendarField = calendarField;\r
+            if (this.getClass() == DateFormat.Field.class) {\r
+                FIELD_NAME_MAP.put(name, this);\r
+                if (calendarField >= 0 && calendarField < CAL_FIELD_COUNT) {\r
+                    CAL_FIELDS[calendarField] = this;\r
+                }\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Returns the <code>Field</code> constant that corresponds to the <code>\r
+         * Calendar</code> field <code>calendarField</code>.  If there is no\r
+         * corresponding <code>Field</code> is available, null is returned.\r
+         *\r
+         * @param calendarField <code>Calendar</code> field constant\r
+         * @return <code>Field</code> associated with the <code>calendarField</code>,\r
+         * or null if no associated <code>Field</code> is available.\r
+         * @throws IllegalArgumentException if <code>calendarField</code> is not\r
+         * a valid <code>Calendar</code> field constant.\r
+         *\r
+         * @stable ICU 3.8\r
+         */\r
+        public static DateFormat.Field ofCalendarField(int calendarField) {\r
+            if (calendarField < 0 || calendarField >= CAL_FIELD_COUNT) {\r
+                throw new IllegalArgumentException("Calendar field number is out of range");\r
+            }\r
+            return CAL_FIELDS[calendarField];\r
+        }\r
+\r
+        /**\r
+         * Returns the <code>Calendar</code> field associated with this attribute.\r
+         * If there is no corresponding <code>Calendar</code> available, this will\r
+         * return -1.\r
+         *\r
+         * @return <code>Calendar</code> constant for this attribute.\r
+         *\r
+         * @stable ICU 3.8\r
+         */\r
+        public int getCalendarField() {\r
+            return calendarField;\r
+        }\r
+\r
+        /**\r
+         * Resolves instances being deserialized to the predefined constants.\r
+         *\r
+         * @throws InvalidObjectException if the constant could not be resolved.\r
+         *\r
+         * @stable ICU 3.8\r
+         */\r
+        protected Object readResolve() throws InvalidObjectException {\r
+            ///CLOVER:OFF\r
+            if (this.getClass() != DateFormat.Field.class) {\r
+                throw new InvalidObjectException(\r
+                    "A subclass of DateFormat.Field must implement readResolve.");\r
+            }\r
+            ///CLOVER:ON\r
+            Object o = FIELD_NAME_MAP.get(this.getName());\r
+            ///CLOVER:OFF\r
+            if (o == null) {\r
+                throw new InvalidObjectException("Unknown attribute name.");\r
+            }\r
+            ///CLOVER:ON\r
+            return o;\r
+        }\r
+    }\r
+\r
+    private static int getJDKFormatStyle(int icuFormatStyle) {\r
+        switch (icuFormatStyle) {\r
+        case DateFormat.FULL:\r
+            return java.text.DateFormat.FULL;\r
+        case DateFormat.LONG:\r
+            return java.text.DateFormat.LONG;\r
+        case DateFormat.MEDIUM:\r
+            return java.text.DateFormat.MEDIUM;\r
+        case DateFormat.SHORT:\r
+            return java.text.DateFormat.SHORT;\r
+        default:\r
+            throw new UnsupportedOperationException("Style not supported by com.ibm.icu.base");\r
+        }\r
+    }\r
+\r
+\r
+    protected static FieldPosition toJDKFieldPosition(FieldPosition icuPos) {\r
+        if (icuPos == null) {\r
+            return null;\r
+        }\r
+\r
+        int fieldID = icuPos.getField();\r
+        Format.Field fieldAttribute = icuPos.getFieldAttribute();\r
+\r
+        FieldPosition jdkPos = null;\r
+\r
+        if (fieldID >= 0) {\r
+            switch (fieldID) {\r
+            case ERA_FIELD:\r
+                fieldID = java.text.DateFormat.ERA_FIELD;\r
+                break;\r
+            case YEAR_FIELD:\r
+                fieldID = java.text.DateFormat.YEAR_FIELD;\r
+                break;\r
+            case MONTH_FIELD:\r
+                fieldID = java.text.DateFormat.MONTH_FIELD;\r
+                break;\r
+            case DATE_FIELD:\r
+                fieldID = java.text.DateFormat.DATE_FIELD;\r
+                break;\r
+            case HOUR_OF_DAY1_FIELD:\r
+                fieldID = java.text.DateFormat.HOUR_OF_DAY1_FIELD;\r
+                break;\r
+            case HOUR_OF_DAY0_FIELD:\r
+                fieldID = java.text.DateFormat.HOUR_OF_DAY0_FIELD;\r
+                break;\r
+            case MINUTE_FIELD:\r
+                fieldID = java.text.DateFormat.MINUTE_FIELD;\r
+                break;\r
+            case SECOND_FIELD:\r
+                fieldID = java.text.DateFormat.SECOND_FIELD;\r
+                break;\r
+            case FRACTIONAL_SECOND_FIELD: // MILLISECOND_FIELD\r
+                fieldID = java.text.DateFormat.MILLISECOND_FIELD;\r
+                break;\r
+            case DAY_OF_WEEK_FIELD:\r
+                fieldID = java.text.DateFormat.DAY_OF_WEEK_FIELD;\r
+                break;\r
+            case DAY_OF_YEAR_FIELD:\r
+                fieldID = java.text.DateFormat.DAY_OF_YEAR_FIELD;\r
+                break;\r
+            case DAY_OF_WEEK_IN_MONTH_FIELD:\r
+                fieldID = java.text.DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD;\r
+                break;\r
+            case WEEK_OF_YEAR_FIELD:\r
+                fieldID = java.text.DateFormat.WEEK_OF_YEAR_FIELD;\r
+                break;\r
+            case WEEK_OF_MONTH_FIELD:\r
+                fieldID = java.text.DateFormat.WEEK_OF_MONTH_FIELD;\r
+                break;\r
+            case AM_PM_FIELD:\r
+                fieldID = java.text.DateFormat.AM_PM_FIELD;\r
+                break;\r
+            case HOUR1_FIELD:\r
+                fieldID = java.text.DateFormat.HOUR1_FIELD;\r
+                break;\r
+            case HOUR0_FIELD:\r
+                fieldID = java.text.DateFormat.HOUR0_FIELD;\r
+                break;\r
+            case TIMEZONE_FIELD:\r
+                fieldID = java.text.DateFormat.TIMEZONE_FIELD;\r
+                break;\r
+\r
+            case YEAR_WOY_FIELD:\r
+            case DOW_LOCAL_FIELD:\r
+            case EXTENDED_YEAR_FIELD:\r
+            case JULIAN_DAY_FIELD:\r
+            case MILLISECONDS_IN_DAY_FIELD:\r
+            case TIMEZONE_RFC_FIELD:\r
+            case TIMEZONE_GENERIC_FIELD:\r
+            case STANDALONE_DAY_FIELD:\r
+            case STANDALONE_MONTH_FIELD:\r
+            case QUARTER_FIELD:\r
+            case STANDALONE_QUARTER_FIELD:\r
+            case TIMEZONE_SPECIAL_FIELD:\r
+                throw new UnsupportedOperationException("Format Field ID not supported by com.ibm.icu.base");\r
+\r
+            default:\r
+                // just let it go\r
+                break;\r
+            }\r
+        }\r
+\r
+        if (fieldAttribute != null) {\r
+            // map field\r
+            if (fieldAttribute.equals(Field.AM_PM)) {\r
+                fieldAttribute = java.text.DateFormat.Field.AM_PM;\r
+            } else if (fieldAttribute.equals(Field.DAY_OF_MONTH)) {\r
+                fieldAttribute = java.text.DateFormat.Field.DAY_OF_MONTH;\r
+            } else if (fieldAttribute.equals(Field.DAY_OF_WEEK)) {\r
+                fieldAttribute = java.text.DateFormat.Field.DAY_OF_WEEK;\r
+            } else if (fieldAttribute.equals(Field.DAY_OF_WEEK_IN_MONTH)) {\r
+                fieldAttribute = java.text.DateFormat.Field.DAY_OF_WEEK_IN_MONTH;\r
+            } else if (fieldAttribute.equals(Field.DAY_OF_YEAR)) {\r
+                fieldAttribute = java.text.DateFormat.Field.DAY_OF_YEAR;\r
+            } else if (fieldAttribute.equals(Field.ERA)) {\r
+                fieldAttribute = java.text.DateFormat.Field.ERA;\r
+            } else if (fieldAttribute.equals(Field.HOUR_OF_DAY0)) {\r
+                fieldAttribute = java.text.DateFormat.Field.HOUR_OF_DAY0;\r
+            } else if (fieldAttribute.equals(Field.HOUR_OF_DAY1)) {\r
+                fieldAttribute = java.text.DateFormat.Field.HOUR_OF_DAY1;\r
+            } else if (fieldAttribute.equals(Field.HOUR0)) {\r
+                fieldAttribute = java.text.DateFormat.Field.HOUR0;\r
+            } else if (fieldAttribute.equals(Field.HOUR1)) {\r
+                fieldAttribute = java.text.DateFormat.Field.HOUR1;\r
+            } else if (fieldAttribute.equals(Field.MILLISECOND)) {\r
+                fieldAttribute = java.text.DateFormat.Field.MILLISECOND;\r
+            } else if (fieldAttribute.equals(Field.MINUTE)) {\r
+                fieldAttribute = java.text.DateFormat.Field.MINUTE;\r
+            } else if (fieldAttribute.equals(Field.MONTH)) {\r
+                fieldAttribute = java.text.DateFormat.Field.MONTH;\r
+            } else if (fieldAttribute.equals(Field.SECOND)) {\r
+                fieldAttribute = java.text.DateFormat.Field.SECOND;\r
+            } else if (fieldAttribute.equals(Field.TIME_ZONE)) {\r
+                fieldAttribute = java.text.DateFormat.Field.TIME_ZONE;\r
+            } else if (fieldAttribute.equals(Field.WEEK_OF_MONTH)) {\r
+                fieldAttribute = java.text.DateFormat.Field.WEEK_OF_MONTH;\r
+            } else if (fieldAttribute.equals(Field.WEEK_OF_YEAR)) {\r
+                fieldAttribute = java.text.DateFormat.Field.WEEK_OF_YEAR;\r
+            } else if (fieldAttribute.equals(Field.YEAR)) {\r
+                fieldAttribute = java.text.DateFormat.Field.YEAR;\r
+            } else if (fieldAttribute.equals(Field.DOW_LOCAL)\r
+                    || fieldAttribute.equals(Field.EXTENDED_YEAR)\r
+                    || fieldAttribute.equals(Field.JULIAN_DAY)\r
+                    || fieldAttribute.equals(Field.MILLISECONDS_IN_DAY)\r
+                    || fieldAttribute.equals(Field.YEAR_WOY)\r
+                    || fieldAttribute.equals(Field.QUARTER)) {\r
+                // Not supported\r
+                throw new UnsupportedOperationException("Format Field not supported by com.ibm.icu.base");\r
+            }\r
+\r
+            jdkPos = new FieldPosition(fieldAttribute, fieldID);\r
+        } else {\r
+            jdkPos = new FieldPosition(fieldID);\r
+        }\r
+\r
+        jdkPos.setBeginIndex(icuPos.getBeginIndex());\r
+        jdkPos.setEndIndex(icuPos.getEndIndex());\r
+\r
+        return jdkPos;\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormatSymbols.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DateFormatSymbols.java
new file mode 100644 (file)
index 0000000..ab0f9c9
--- /dev/null
@@ -0,0 +1,840 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.text;\r
+\r
+import java.io.Serializable;\r
+import java.util.Locale;\r
+import java.util.MissingResourceException;\r
+import java.util.ResourceBundle;\r
+\r
+import com.ibm.icu.util.Calendar;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+/**\r
+ * {@icuenhanced java.text.DateFormatSymbols}.{@icu _usage_}\r
+ *\r
+ * <p><code>DateFormatSymbols</code> is a public class for encapsulating\r
+ * localizable date-time formatting data, such as the names of the\r
+ * months, the names of the days of the week, and the time zone data.\r
+ * <code>DateFormat</code> and <code>SimpleDateFormat</code> both use\r
+ * <code>DateFormatSymbols</code> to encapsulate this information.\r
+ *\r
+ * <p>Typically you shouldn't use <code>DateFormatSymbols</code> directly.\r
+ * Rather, you are encouraged to create a date-time formatter with the\r
+ * <code>DateFormat</code> class's factory methods: <code>getTimeInstance</code>,\r
+ * <code>getDateInstance</code>, or <code>getDateTimeInstance</code>.\r
+ * These methods automatically create a <code>DateFormatSymbols</code> for\r
+ * the formatter so that you don't have to. After the\r
+ * formatter is created, you may modify its format pattern using the\r
+ * <code>setPattern</code> method. For more information about\r
+ * creating formatters using <code>DateFormat</code>'s factory methods,\r
+ * see {@link DateFormat}.\r
+ *\r
+ * <p>If you decide to create a date-time formatter with a specific\r
+ * format pattern for a specific locale, you can do so with:\r
+ * <blockquote>\r
+ * <pre>\r
+ * new SimpleDateFormat(aPattern, new DateFormatSymbols(aLocale)).\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * <p><code>DateFormatSymbols</code> objects are clonable. When you obtain\r
+ * a <code>DateFormatSymbols</code> object, feel free to modify the\r
+ * date-time formatting data. For instance, you can replace the localized\r
+ * date-time format pattern characters with the ones that you feel easy\r
+ * to remember. Or you can change the representative cities\r
+ * to your favorite ones.\r
+ *\r
+ * <p>New <code>DateFormatSymbols</code> subclasses may be added to support\r
+ * <code>SimpleDateFormat</code> for date-time formatting for additional locales.\r
+ *\r
+ * @see          DateFormat\r
+ * @see          SimpleDateFormat\r
+ * @see          com.ibm.icu.util.SimpleTimeZone\r
+ * @author       Chen-Lieh Huang\r
+ * @stable ICU 2.0\r
+ */\r
+public class DateFormatSymbols implements Serializable, Cloneable {\r
+\r
+    private static final long serialVersionUID = 1L;\r
+    \r
+    /** @internal */\r
+    public java.text.DateFormatSymbols dfs;\r
+        \r
+    /** @internal */\r
+    public DateFormatSymbols(java.text.DateFormatSymbols delegate) {\r
+        this.dfs = delegate;\r
+    }\r
+\r
+    // TODO make sure local pattern char string is 18 characters long,\r
+    // that is, that it encompasses the new 'u' char for\r
+    // EXTENDED_YEAR.  Two options: 1. Make sure resource data is\r
+    // correct; 2. Make code add in 'u' at end if len == 17.\r
+\r
+    // Constants for context\r
+    /**\r
+     * {@icu} Constant for context.\r
+     * @stable ICU 3.6\r
+     */\r
+    public static final int FORMAT = 0;\r
+\r
+    /**\r
+     * {@icu} Constant for context.\r
+     * @stable ICU 3.6\r
+     */\r
+    public static final int STANDALONE = 1;\r
+\r
+    /**\r
+     * {@icu} Constant for context.\r
+     * @internal\r
+     * @deprecated This API is ICU internal only.\r
+     */\r
+    public static final int DT_CONTEXT_COUNT = 2;\r
+\r
+    // Constants for width\r
+\r
+    /**\r
+     * {@icu} Constant for width.\r
+     * @stable ICU 3.6\r
+     */\r
+    public static final int ABBREVIATED = 0;\r
+\r
+    /**\r
+     * {@icu} Constant for width.\r
+     * @stable ICU 3.6\r
+     */\r
+    public static final int WIDE = 1;\r
+\r
+    /**\r
+     * {@icu} Constant for width.\r
+     * @stable ICU 3.6\r
+     */\r
+    public static final int NARROW = 2;\r
+\r
+    /**\r
+     * {@icu} Constant for width.\r
+     * @internal\r
+     * @deprecated This API is ICU internal only.\r
+     */\r
+    public static final int DT_WIDTH_COUNT = 3;\r
+\r
+    /**\r
+     * Constructs a DateFormatSymbols object by loading format data from\r
+     * resources for the default locale.\r
+     *\r
+     * @throws java.util.MissingResourceException if the resources for the default locale\r
+     *          cannot be found or cannot be loaded.\r
+     * @stable ICU 2.0\r
+     */\r
+    public DateFormatSymbols()\r
+    {\r
+        this(new java.text.DateFormatSymbols());\r
+    }\r
+\r
+    /**\r
+     * Constructs a DateFormatSymbols object by loading format data from\r
+     * resources for the given locale.\r
+     *\r
+     * @throws java.util.MissingResourceException if the resources for the specified\r
+     *          locale cannot be found or cannot be loaded.\r
+     * @stable ICU 2.0\r
+     */\r
+    public DateFormatSymbols(Locale locale)\r
+    {\r
+        this(new java.text.DateFormatSymbols(locale));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Constructs a DateFormatSymbols object by loading format data from\r
+     * resources for the given ulocale.\r
+     *\r
+     * @throws java.util.MissingResourceException if the resources for the specified\r
+     *          locale cannot be found or cannot be loaded.\r
+     * @stable ICU 3.2\r
+     */\r
+    public DateFormatSymbols(ULocale locale)\r
+    {\r
+        this(new java.text.DateFormatSymbols(locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Returns a DateFormatSymbols instance for the default locale.\r
+     *\r
+     * {@icunote} Unlike <code>java.text.DateFormatSymbols#getInstance</code>,\r
+     * this method simply returns <code>new com.ibm.icu.text.DateFormatSymbols()</code>.\r
+     * ICU does not support <code>DateFormatSymbolsProvider</code> introduced in Java 6\r
+     * or its equivalent implementation for now.\r
+     *\r
+     * @return A DateFormatSymbols instance.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static DateFormatSymbols getInstance() {\r
+        return new DateFormatSymbols(java.text.DateFormatSymbols.getInstance());\r
+    }\r
+\r
+    /**\r
+     * Returns a DateFormatSymbols instance for the given locale.\r
+     *\r
+     * {@icunote} Unlike <code>java.text.DateFormatSymbols#getInstance</code>,\r
+     * this method simply returns <code>new com.ibm.icu.text.DateFormatSymbols(locale)</code>.\r
+     * ICU does not support <code>DateFormatSymbolsProvider</code> introduced in Java 6\r
+     * or its equivalent implementation for now.\r
+     *\r
+     * @param locale the locale.\r
+     * @return A DateFormatSymbols instance.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static DateFormatSymbols getInstance(Locale locale) {\r
+        return new DateFormatSymbols(java.text.DateFormatSymbols.getInstance(locale));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a DateFormatSymbols instance for the given locale.\r
+     *\r
+     * {@icunote} Unlike <code>java.text.DateFormatSymbols#getInstance</code>,\r
+     * this method simply returns <code>new com.ibm.icu.text.DateFormatSymbols(locale)</code>.\r
+     * ICU does not support <code>DateFormatSymbolsProvider</code> introduced in Java 6\r
+     * or its equivalent implementation for now.\r
+     *\r
+     * @param locale the locale.\r
+     * @return A DateFormatSymbols instance.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static DateFormatSymbols getInstance(ULocale locale) {\r
+        return new DateFormatSymbols(java.text.DateFormatSymbols.getInstance(locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Returns an array of all locales for which the <code>getInstance</code> methods of\r
+     * this class can return localized instances.\r
+     *\r
+     * {@icunote} Unlike <code>java.text.DateFormatSymbols#getAvailableLocales</code>,\r
+     * this method simply returns the array of <code>Locale</code>s available in this\r
+     * class.  ICU does not support <code>DateFormatSymbolsProvider</code> introduced in\r
+     * Java 6 or its equivalent implementation for now.\r
+     *\r
+     * @return An array of <code>Locale</code>s for which localized\r
+     * <code>DateFormatSymbols</code> instances are available.\r
+     * @stable ICU 3.8\r
+     */\r
+    public static Locale[] getAvailableLocales() {\r
+        return java.text.DateFormatSymbols.getAvailableLocales();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns an array of all locales for which the <code>getInstance</code>\r
+     * methods of this class can return localized instances.\r
+     *\r
+     * {@icunote} Unlike <code>java.text.DateFormatSymbols#getAvailableLocales</code>,\r
+     * this method simply returns the array of <code>ULocale</code>s available in this\r
+     * class.  ICU does not support <code>DateFormatSymbolsProvider</code> introduced in\r
+     * Java 6 or its equivalent implementation for now.\r
+     *\r
+     * @return An array of <code>ULocale</code>s for which localized\r
+     * <code>DateFormatSymbols</code> instances are available.\r
+     * @draft ICU 3.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static ULocale[] getAvailableULocales() {\r
+        Locale[] locales = java.text.DateFormatSymbols.getAvailableLocales();\r
+        ULocale[] ulocales = new ULocale[locales.length];\r
+        for (int i = 0; i < locales.length; ++i) {\r
+            ulocales[i] = ULocale.forLocale(locales[i]);\r
+        }\r
+        return ulocales;\r
+    }\r
+\r
+    /**\r
+     * Returns era strings. For example: "AD" and "BC".\r
+     * @return the era strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String[] getEras() {\r
+        return dfs.getEras();\r
+    }\r
+\r
+    /**\r
+     * Sets era strings. For example: "AD" and "BC".\r
+     * @param newEras the new era strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setEras(String[] newEras) {\r
+        dfs.setEras(newEras);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns era name strings. For example: "Anno Domini" and "Before Christ".\r
+     * @return the era strings.\r
+     * @stable ICU 3.4\r
+     */\r
+    public String[] getEraNames() {\r
+        return getEras(); // Java has no distinction between era strings and era name strings\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets era name strings. For example: "Anno Domini" and "Before Christ".\r
+     * @param newEraNames the new era strings.\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setEraNames(String[] newEraNames) {\r
+        setEras(newEraNames); // Java has no distinction between era strings and era name strings\r
+    }\r
+\r
+    /**\r
+     * Returns month strings. For example: "January", "February", etc.\r
+     * @return the month strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String[] getMonths() {\r
+        return dfs.getMonths();\r
+    }\r
+\r
+    /**\r
+     * Returns month strings. For example: "January", "February", etc.\r
+     * @param context    The month context, FORMAT or STANDALONE.\r
+     * @param width      The width or the returned month string,\r
+     *                   either WIDE, ABBREVIATED, or NARROW.\r
+     * @return the month strings.\r
+     * @stable ICU 3.4\r
+     */\r
+    public String[] getMonths(int context, int width) {\r
+        // JDK does not support context / narrow months\r
+        switch (width) {\r
+        case WIDE:\r
+            return dfs.getMonths();\r
+\r
+        case ABBREVIATED:\r
+        case NARROW:\r
+            return dfs.getShortMonths();\r
+\r
+        default:\r
+            throw new IllegalArgumentException("Unsupported width argument value");\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Sets month strings. For example: "January", "February", etc.\r
+     * @param newMonths the new month strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMonths(String[] newMonths) {\r
+        dfs.setMonths(newMonths);\r
+    }\r
+\r
+    /**\r
+     * Sets month strings. For example: "January", "February", etc.\r
+     * @param newMonths the new month strings.\r
+     * @param context    The formatting context, FORMAT or STANDALONE.\r
+     * @param width      The width of the month string,\r
+     *                   either WIDE, ABBREVIATED, or NARROW.\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setMonths(String[] newMonths, int context, int width) {\r
+        // JDK does not support context / narrow months\r
+        switch (width) {\r
+        case WIDE:\r
+            dfs.setMonths(newMonths);\r
+            break;\r
+\r
+        case ABBREVIATED:\r
+        case NARROW:\r
+            dfs.setShortMonths(newMonths);\r
+            break;\r
+\r
+        default:\r
+            throw new IllegalArgumentException("Unsupported width argument value");\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Returns short month strings. For example: "Jan", "Feb", etc.\r
+     * @return the short month strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String[] getShortMonths() {\r
+        return dfs.getShortMonths();\r
+    }\r
+\r
+    /**\r
+     * Sets short month strings. For example: "Jan", "Feb", etc.\r
+     * @param newShortMonths the new short month strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setShortMonths(String[] newShortMonths) {\r
+        dfs.setShortMonths(newShortMonths);\r
+    }\r
+\r
+    /**\r
+     * Returns weekday strings. For example: "Sunday", "Monday", etc.\r
+     * @return the weekday strings. Use <code>Calendar.SUNDAY</code>,\r
+     * <code>Calendar.MONDAY</code>, etc. to index the result array.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String[] getWeekdays() {\r
+        return dfs.getWeekdays();\r
+    }\r
+\r
+    /**\r
+     * Returns weekday strings. For example: "Sunday", "Monday", etc.\r
+     * @return the weekday strings. Use <code>Calendar.SUNDAY</code>,\r
+     * <code>Calendar.MONDAY</code>, etc. to index the result array.\r
+     * @param context    Formatting context, either FORMAT or STANDALONE.\r
+     * @param width      Width of strings to be returned, either\r
+     *                   WIDE, ABBREVIATED, or NARROW\r
+     * @stable ICU 3.4\r
+     */\r
+    public String[] getWeekdays(int context, int width) {\r
+        // JDK does not support context / narrow weekdays\r
+        switch (width) {\r
+        case WIDE:\r
+            return dfs.getWeekdays();\r
+\r
+        case ABBREVIATED:\r
+        case NARROW:\r
+            return dfs.getShortWeekdays();\r
+\r
+        default:\r
+            throw new IllegalArgumentException("Unsupported width argument value");\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Sets weekday strings. For example: "Sunday", "Monday", etc.\r
+     * @param newWeekdays The new weekday strings.\r
+     * @param context     The formatting context, FORMAT or STANDALONE.\r
+     * @param width       The width of the strings,\r
+     *                    either WIDE, ABBREVIATED, or NARROW.\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setWeekdays(String[] newWeekdays, int context, int width) {\r
+        // JDK does not support context / narrow weekdays\r
+        switch (width) {\r
+        case WIDE:\r
+            dfs.setWeekdays(newWeekdays);\r
+            break;\r
+\r
+        case ABBREVIATED:\r
+        case NARROW:\r
+            dfs.setShortWeekdays(newWeekdays);\r
+            break;\r
+\r
+        default:\r
+            throw new IllegalArgumentException("Unsupported width argument value");\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Sets weekday strings. For example: "Sunday", "Monday", etc.\r
+     * @param newWeekdays the new weekday strings. The array should\r
+     * be indexed by <code>Calendar.SUNDAY</code>,\r
+     * <code>Calendar.MONDAY</code>, etc.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setWeekdays(String[] newWeekdays) {\r
+        dfs.setWeekdays(newWeekdays);\r
+    }\r
+\r
+    /**\r
+     * Returns short weekday strings. For example: "Sun", "Mon", etc.\r
+     * @return the short weekday strings. Use <code>Calendar.SUNDAY</code>,\r
+     * <code>Calendar.MONDAY</code>, etc. to index the result array.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String[] getShortWeekdays() {\r
+        return dfs.getShortWeekdays();\r
+    }\r
+\r
+    /**\r
+     * Sets short weekday strings. For example: "Sun", "Mon", etc.\r
+     * @param newShortWeekdays the new short weekday strings. The array should\r
+     * be indexed by <code>Calendar.SUNDAY</code>,\r
+     * <code>Calendar.MONDAY</code>, etc.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setShortWeekdays(String[] newShortWeekdays) {\r
+        dfs.setShortWeekdays(newShortWeekdays);\r
+    }\r
+    /**\r
+     * {@icu} Returns quarter strings. For example: "1st Quarter", "2nd Quarter", etc.\r
+     * @param context    The quarter context, FORMAT or STANDALONE.\r
+     * @param width      The width or the returned quarter string,\r
+     *                   either WIDE or ABBREVIATED. There are no NARROW quarters.\r
+     * @return the quarter strings.\r
+     * @stable ICU 3.6\r
+     */\r
+    public String[] getQuarters(int context, int width) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets quarter strings. For example: "1st Quarter", "2nd Quarter", etc.\r
+     * @param newQuarters the new quarter strings.\r
+     * @param context    The formatting context, FORMAT or STANDALONE.\r
+     * @param width      The width of the quarter string,\r
+     *                   either WIDE or ABBREVIATED. There are no NARROW quarters.\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setQuarters(String[] newQuarters, int context, int width) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns am/pm strings. For example: "AM" and "PM".\r
+     * @return the weekday strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String[] getAmPmStrings() {\r
+        return dfs.getAmPmStrings();\r
+    }\r
+\r
+    /**\r
+     * Sets am/pm strings. For example: "AM" and "PM".\r
+     * @param newAmpms the new ampm strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setAmPmStrings(String[] newAmpms) {\r
+        dfs.setAmPmStrings(newAmpms);\r
+    }\r
+\r
+    /**\r
+     * Returns timezone strings.\r
+     * @return the timezone strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String[][] getZoneStrings() {\r
+        return dfs.getZoneStrings();\r
+    }\r
+\r
+    /**\r
+     * Sets timezone strings.\r
+     * @param newZoneStrings the new timezone strings.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setZoneStrings(String[][] newZoneStrings) {\r
+        dfs.setZoneStrings(newZoneStrings);\r
+    }\r
+\r
+    /**\r
+     * Returns localized date-time pattern characters. For example: 'u', 't', etc.\r
+     *\r
+     * <p>Note: ICU no longer provides localized date-time pattern characters for a locale\r
+     * starting ICU 3.8.  This method returns the non-localized date-time pattern\r
+     * characters unless user defined localized data is set by setLocalPatternChars.\r
+     * @return the localized date-time pattern characters.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getLocalPatternChars() {\r
+        return dfs.getLocalPatternChars();\r
+    }\r
+\r
+    /**\r
+     * Sets localized date-time pattern characters. For example: 'u', 't', etc.\r
+     * @param newLocalPatternChars the new localized date-time\r
+     * pattern characters.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setLocalPatternChars(String newLocalPatternChars) {\r
+        dfs.setLocalPatternChars(newLocalPatternChars);\r
+    }\r
+\r
+    /**\r
+     * Overrides clone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone()\r
+    {\r
+        return new DateFormatSymbols((java.text.DateFormatSymbols)dfs.clone());\r
+    }\r
+\r
+    /**\r
+     * Override hashCode.\r
+     * Generates a hash code for the DateFormatSymbols object.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int hashCode() {\r
+        return dfs.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Overrides equals.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean equals(Object obj)\r
+    {\r
+        try {\r
+            return dfs.equals(((DateFormatSymbols)obj).dfs);\r
+        }\r
+        catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+\r
+    /**\r
+     * Returns the {@link DateFormatSymbols} object that should be used to format a\r
+     * calendar system's dates in the given locale.\r
+     * <p>\r
+     * <b>Subclassing:</b><br>\r
+     * When creating a new Calendar subclass, you must create the\r
+     * {@link ResourceBundle ResourceBundle}\r
+     * containing its {@link DateFormatSymbols DateFormatSymbols} in a specific place.\r
+     * The resource bundle name is based on the calendar's fully-specified\r
+     * class name, with ".resources" inserted at the end of the package name\r
+     * (just before the class name) and "Symbols" appended to the end.\r
+     * For example, the bundle corresponding to "com.ibm.icu.util.HebrewCalendar"\r
+     * is "com.ibm.icu.impl.data.HebrewCalendarSymbols".\r
+     * <p>\r
+     * Within the ResourceBundle, this method searches for five keys:\r
+     * <ul>\r
+     * <li><b>DayNames</b> -\r
+     *      An array of strings corresponding to each possible\r
+     *      value of the <code>DAY_OF_WEEK</code> field.  Even though\r
+     *      <code>DAY_OF_WEEK</code> starts with <code>SUNDAY</code> = 1,\r
+     *      This array is 0-based; the name for Sunday goes in the\r
+     *      first position, at index 0.  If this key is not found\r
+     *      in the bundle, the day names are inherited from the\r
+     *      default <code>DateFormatSymbols</code> for the requested locale.\r
+     *\r
+     * <li><b>DayAbbreviations</b> -\r
+     *      An array of abbreviated day names corresponding\r
+     *      to the values in the "DayNames" array.  If this key\r
+     *      is not found in the resource bundle, the "DayNames"\r
+     *      values are used instead.  If neither key is found,\r
+     *      the day abbreviations are inherited from the default\r
+     *      <code>DateFormatSymbols</code> for the locale.\r
+     *\r
+     * <li><b>MonthNames</b> -\r
+     *      An array of strings corresponding to each possible\r
+     *      value of the <code>MONTH</code> field.  If this key is not found\r
+     *      in the bundle, the month names are inherited from the\r
+     *      default <code>DateFormatSymbols</code> for the requested locale.\r
+     *\r
+     * <li><b>MonthAbbreviations</b> -\r
+     *      An array of abbreviated day names corresponding\r
+     *      to the values in the "MonthNames" array.  If this key\r
+     *      is not found in the resource bundle, the "MonthNames"\r
+     *      values are used instead.  If neither key is found,\r
+     *      the day abbreviations are inherited from the default\r
+     *      <code>DateFormatSymbols</code> for the locale.\r
+     *\r
+     * <li><b>Eras</b> -\r
+     *      An array of strings corresponding to each possible\r
+     *      value of the <code>ERA</code> field.  If this key is not found\r
+     *      in the bundle, the era names are inherited from the\r
+     *      default <code>DateFormatSymbols</code> for the requested locale.\r
+     * </ul>\r
+     * <p>\r
+     * @param cal       The calendar system whose date format symbols are desired.\r
+     * @param locale    The locale whose symbols are desired.\r
+     *\r
+     * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale)\r
+     * @stable ICU 2.0\r
+     */\r
+    public DateFormatSymbols(Calendar cal, Locale locale) {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the {@link DateFormatSymbols} object that should be used to format a\r
+     * calendar system's dates in the given locale.\r
+     * <p>\r
+     * <b>Subclassing:</b><br>\r
+     * When creating a new Calendar subclass, you must create the\r
+     * {@link ResourceBundle ResourceBundle}\r
+     * containing its {@link DateFormatSymbols DateFormatSymbols} in a specific place.\r
+     * The resource bundle name is based on the calendar's fully-specified\r
+     * class name, with ".resources" inserted at the end of the package name\r
+     * (just before the class name) and "Symbols" appended to the end.\r
+     * For example, the bundle corresponding to "com.ibm.icu.util.HebrewCalendar"\r
+     * is "com.ibm.icu.impl.data.HebrewCalendarSymbols".\r
+     * <p>\r
+     * Within the ResourceBundle, this method searches for five keys:\r
+     * <ul>\r
+     * <li><b>DayNames</b> -\r
+     *      An array of strings corresponding to each possible\r
+     *      value of the <code>DAY_OF_WEEK</code> field.  Even though\r
+     *      <code>DAY_OF_WEEK</code> starts with <code>SUNDAY</code> = 1,\r
+     *      This array is 0-based; the name for Sunday goes in the\r
+     *      first position, at index 0.  If this key is not found\r
+     *      in the bundle, the day names are inherited from the\r
+     *      default <code>DateFormatSymbols</code> for the requested locale.\r
+     *\r
+     * <li><b>DayAbbreviations</b> -\r
+     *      An array of abbreviated day names corresponding\r
+     *      to the values in the "DayNames" array.  If this key\r
+     *      is not found in the resource bundle, the "DayNames"\r
+     *      values are used instead.  If neither key is found,\r
+     *      the day abbreviations are inherited from the default\r
+     *      <code>DateFormatSymbols</code> for the locale.\r
+     *\r
+     * <li><b>MonthNames</b> -\r
+     *      An array of strings corresponding to each possible\r
+     *      value of the <code>MONTH</code> field.  If this key is not found\r
+     *      in the bundle, the month names are inherited from the\r
+     *      default <code>DateFormatSymbols</code> for the requested locale.\r
+     *\r
+     * <li><b>MonthAbbreviations</b> -\r
+     *      An array of abbreviated day names corresponding\r
+     *      to the values in the "MonthNames" array.  If this key\r
+     *      is not found in the resource bundle, the "MonthNames"\r
+     *      values are used instead.  If neither key is found,\r
+     *      the day abbreviations are inherited from the default\r
+     *      <code>DateFormatSymbols</code> for the locale.\r
+     *\r
+     * <li><b>Eras</b> -\r
+     *      An array of strings corresponding to each possible\r
+     *      value of the <code>ERA</code> field.  If this key is not found\r
+     *      in the bundle, the era names are inherited from the\r
+     *      default <code>DateFormatSymbols</code> for the requested locale.\r
+     * </ul>\r
+     * <p>\r
+     * @param cal       The calendar system whose date format symbols are desired.\r
+     * @param locale    The ulocale whose symbols are desired.\r
+     *\r
+     * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale)\r
+     * @stable ICU 3.2\r
+     */\r
+    public DateFormatSymbols(Calendar cal, ULocale locale) {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Variant of DateFormatSymbols(Calendar, Locale) that takes the Calendar class\r
+     * instead of a Calandar instance.\r
+     * @see #DateFormatSymbols(Calendar, Locale)\r
+     * @stable ICU 2.2\r
+     */\r
+    public DateFormatSymbols(Class<? extends Calendar> calendarClass, Locale locale) {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Variant of DateFormatSymbols(Calendar, ULocale) that takes the Calendar class\r
+     * instead of a Calandar instance.\r
+     * @see #DateFormatSymbols(Calendar, Locale)\r
+     * @stable ICU 3.2\r
+     */\r
+    public DateFormatSymbols(Class<? extends Calendar> calendarClass, ULocale locale) {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Fetches a custom calendar's DateFormatSymbols out of the given resource\r
+     * bundle.  Symbols that are not overridden are inherited from the\r
+     * default DateFormatSymbols for the locale.\r
+     * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale)\r
+     * @stable ICU 2.0\r
+     */\r
+    public DateFormatSymbols(ResourceBundle bundle, Locale locale) {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Fetches a custom calendar's DateFormatSymbols out of the given resource\r
+     * bundle.  Symbols that are not overridden are inherited from the\r
+     * default DateFormatSymbols for the locale.\r
+     * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale)\r
+     * @stable ICU 3.2\r
+     */\r
+    public DateFormatSymbols(ResourceBundle bundle, ULocale locale) {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Finds the ResourceBundle containing the date format information for\r
+     * a specified calendar subclass in a given locale.\r
+     * <p>\r
+     * The resource bundle name is based on the calendar's fully-specified\r
+     * class name, with ".resources" inserted at the end of the package name\r
+     * (just before the class name) and "Symbols" appended to the end.\r
+     * For example, the bundle corresponding to "com.ibm.icu.util.HebrewCalendar"\r
+     * is "com.ibm.icu.impl.data.HebrewCalendarSymbols".\r
+     * <p>\r
+     * <b>Note:</b>Because of the structural changes in the ICU locale bundle,\r
+     * this API no longer works as described.  This method always returns null.\r
+     * @deprecated ICU 4.0\r
+     */\r
+    // This API was formerly @stable ICU 2.0\r
+    static public ResourceBundle getDateFormatBundle(Class<? extends Calendar> calendarClass,\r
+                                                     Locale locale) throws MissingResourceException {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");    }\r
+\r
+    /**\r
+     * Finds the ResourceBundle containing the date format information for\r
+     * a specified calendar subclass in a given locale.\r
+     * <p>\r
+     * The resource bundle name is based on the calendar's fully-specified\r
+     * class name, with ".resources" inserted at the end of the package name\r
+     * (just before the class name) and "Symbols" appended to the end.\r
+     * For example, the bundle corresponding to "com.ibm.icu.util.HebrewCalendar"\r
+     * is "com.ibm.icu.impl.data.HebrewCalendarSymbols".\r
+     * <p>\r
+     * <b>Note:</b>Because of the structural changes in the ICU locale bundle,\r
+     * this API no longer works as described.  This method always returns null.\r
+     * @deprecated ICU 4.0\r
+     */\r
+    // This API was formerly @stable ICU 3.2\r
+    static public ResourceBundle getDateFormatBundle(Class<? extends Calendar> calendarClass,\r
+                                                     ULocale locale) throws MissingResourceException {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");    }\r
+\r
+    /**\r
+     * Variant of getDateFormatBundle(java.lang.Class, java.util.Locale) that takes\r
+     * a Calendar instance instead of a Calendar class.\r
+     * <p>\r
+     * <b>Note:</b>Because of the structural changes in the ICU locale bundle,\r
+     * this API no longer works as described.  This method always returns null.\r
+     * @see #getDateFormatBundle(java.lang.Class, java.util.Locale)\r
+     * @deprecated ICU 4.0\r
+     */\r
+    // This API was formerly @stable ICU 2.2\r
+    public static ResourceBundle getDateFormatBundle(Calendar cal, Locale locale) throws MissingResourceException {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");    }\r
+\r
+    /**\r
+     * Variant of getDateFormatBundle(java.lang.Class, java.util.Locale) that takes\r
+     * a Calendar instance instead of a Calendar class.\r
+     * <p>\r
+     * <b>Note:</b>Because of the structural changes in the ICU locale bundle,\r
+     * this API no longer works as described.  This method always returns null.\r
+     * @see #getDateFormatBundle(java.lang.Class, java.util.Locale)\r
+     * @deprecated ICU 4.0\r
+     */\r
+    // This API was formerly @stable ICU 3.2\r
+    public static ResourceBundle getDateFormatBundle(Calendar cal, ULocale locale) throws MissingResourceException {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");    }\r
+\r
+    /**\r
+     * Returns the locale that was used to create this object, or null.\r
+     * This may may differ from the locale requested at the time of\r
+     * this object's creation.  For example, if an object is created\r
+     * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be\r
+     * drawn from <tt>en</tt> (the <i>actual</i> locale), and\r
+     * <tt>en_US</tt> may be the most specific locale that exists (the\r
+     * <i>valid</i> locale).\r
+     *\r
+     * <p>Note: This method will be implemented in ICU 3.0; ICU 2.8\r
+     * contains a partial preview implementation.  The * <i>actual</i>\r
+     * locale is returned correctly, but the <i>valid</i> locale is\r
+     * not, in most cases.\r
+     * @param type type of information requested, either {@link\r
+     * com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link\r
+     * com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.\r
+     * @return the information specified by <i>type</i>, or null if\r
+     * this object was not constructed from locale data.\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public final ULocale getLocale(ULocale.Type type) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormat.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormat.java
new file mode 100644 (file)
index 0000000..21021b0
--- /dev/null
@@ -0,0 +1,1762 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.text;\r
+\r
+import java.math.BigInteger;\r
+import java.text.AttributedCharacterIterator;\r
+import java.text.AttributedCharacterIterator.Attribute;\r
+import java.text.AttributedString;\r
+import java.text.CharacterIterator;\r
+import java.text.FieldPosition;\r
+import java.text.ParsePosition;\r
+import java.util.Map;\r
+import java.util.Map.Entry;\r
+\r
+import com.ibm.icu.math.BigDecimal;\r
+import com.ibm.icu.math.MathContext;\r
+import com.ibm.icu.util.Currency;\r
+import com.ibm.icu.util.CurrencyAmount;\r
+\r
+/**\r
+ * {@icuenhanced java.text.DecimalFormat}.{@icu _usage_}\r
+ *\r
+ * <code>DecimalFormat</code> is a concrete subclass of {@link NumberFormat} that formats\r
+ * decimal numbers. It has a variety of features designed to make it possible to parse and\r
+ * format numbers in any locale, including support for Western, Arabic, or Indic digits.\r
+ * It also supports different flavors of numbers, including integers ("123"), fixed-point\r
+ * numbers ("123.4"), scientific notation ("1.23E4"), percentages ("12%"), and currency\r
+ * amounts ("$123.00", "USD123.00", "123.00 US dollars").  All of these flavors can be\r
+ * easily localized.\r
+ *\r
+ * <p>To obtain a {@link NumberFormat} for a specific locale (including the default\r
+ * locale) call one of <code>NumberFormat</code>'s factory methods such as {@link\r
+ * NumberFormat#getInstance}. Do not call the <code>DecimalFormat</code> constructors\r
+ * directly, unless you know what you are doing, since the {@link NumberFormat} factory\r
+ * methods may return subclasses other than <code>DecimalFormat</code>. If you need to\r
+ * customize the format object, do something like this:\r
+ *\r
+ * <blockquote><pre>\r
+ * NumberFormat f = NumberFormat.getInstance(loc);\r
+ * if (f instanceof DecimalFormat) {\r
+ *     ((DecimalFormat) f).setDecimalSeparatorAlwaysShown(true);\r
+ * }</pre></blockquote>\r
+ *\r
+ * <p><strong>Example Usage</strong>\r
+ *\r
+ * Print out a number using the localized number, currency, and percent\r
+ * format for each locale.\r
+ *\r
+ * <blockquote><pre>\r
+ * Locale[] locales = NumberFormat.getAvailableLocales();\r
+ * double myNumber = -1234.56;\r
+ * NumberFormat format;\r
+ * for (int j=0; j<3; ++j) {\r
+ *     System.out.println("FORMAT");\r
+ *     for (int i = 0; i < locales.length; ++i) {\r
+ *         if (locales[i].getCountry().length() == 0) {\r
+ *            // Skip language-only locales\r
+ *            continue;\r
+ *         }\r
+ *         System.out.print(locales[i].getDisplayName());\r
+ *         switch (j) {\r
+ *         case 0:\r
+ *             format = NumberFormat.getInstance(locales[i]); break;\r
+ *         case 1:\r
+ *             format = NumberFormat.getCurrencyInstance(locales[i]); break;\r
+ *         default:\r
+ *             format = NumberFormat.getPercentInstance(locales[i]); break;\r
+ *         }\r
+ *         try {\r
+ *             // Assume format is a DecimalFormat\r
+ *             System.out.print(": " + ((DecimalFormat) format).toPattern()\r
+ *                              + " -> " + form.format(myNumber));\r
+ *         } catch (Exception e) {}\r
+ *         try {\r
+ *             System.out.println(" -> " + format.parse(form.format(myNumber)));\r
+ *         } catch (ParseException e) {}\r
+ *     }\r
+ * }</pre></blockquote>\r
+ *\r
+ * <p>Another example use getInstance(style).<br/>\r
+ * Print out a number using the localized number, currency, percent,\r
+ * scientific, integer, iso currency, and plural currency format for each locale.\r
+ *\r
+ * <blockquote><pre>\r
+ * ULocale locale = new ULocale("en_US");\r
+ * double myNumber = 1234.56;\r
+ * for (int j=NumberFormat.NUMBERSTYLE; j<=NumberFormat.PLURALCURRENCYSTYLE; ++j) {\r
+ *     NumberFormat format = NumberFormat.getInstance(locale, j);\r
+ *     try {\r
+ *         // Assume format is a DecimalFormat\r
+ *         System.out.print(": " + ((DecimalFormat) format).toPattern()\r
+ *                          + " -> " + form.format(myNumber));\r
+ *     } catch (Exception e) {}\r
+ *     try {\r
+ *         System.out.println(" -> " + format.parse(form.format(myNumber)));\r
+ *     } catch (ParseException e) {}\r
+ * }</pre></blockquote>\r
+ *\r
+ * <h4>Patterns</h4>\r
+ *\r
+ * <p>A <code>DecimalFormat</code> consists of a <em>pattern</em> and a set of\r
+ * <em>symbols</em>.  The pattern may be set directly using {@link #applyPattern}, or\r
+ * indirectly using other API methods which manipulate aspects of the pattern, such as the\r
+ * minimum number of integer digits.  The symbols are stored in a {@link\r
+ * DecimalFormatSymbols} object.  When using the {@link NumberFormat} factory methods, the\r
+ * pattern and symbols are read from ICU's locale data.\r
+ *\r
+ * <h4>Special Pattern Characters</h4>\r
+ *\r
+ * <p>Many characters in a pattern are taken literally; they are matched during parsing\r
+ * and output unchanged during formatting.  Special characters, on the other hand, stand\r
+ * for other characters, strings, or classes of characters.  For example, the '#'\r
+ * character is replaced by a localized digit.  Often the replacement character is the\r
+ * same as the pattern character; in the U.S. locale, the ',' grouping character is\r
+ * replaced by ','.  However, the replacement is still happening, and if the symbols are\r
+ * modified, the grouping character changes.  Some special characters affect the behavior\r
+ * of the formatter by their presence; for example, if the percent character is seen, then\r
+ * the value is multiplied by 100 before being displayed.\r
+ *\r
+ * <p>To insert a special character in a pattern as a literal, that is, without any\r
+ * special meaning, the character must be quoted.  There are some exceptions to this which\r
+ * are noted below.\r
+ *\r
+ * <p>The characters listed here are used in non-localized patterns.  Localized patterns\r
+ * use the corresponding characters taken from this formatter's {@link\r
+ * DecimalFormatSymbols} object instead, and these characters lose their special status.\r
+ * Two exceptions are the currency sign and quote, which are not localized.\r
+ *\r
+ * <blockquote>\r
+ * <table border=0 cellspacing=3 cellpadding=0 summary="Chart showing symbol,\r
+ *  location, localized, and meaning.">\r
+ *   <tr bgcolor="#ccccff">\r
+ *     <th align=left>Symbol\r
+ *     <th align=left>Location\r
+ *     <th align=left>Localized?\r
+ *     <th align=left>Meaning\r
+ *   <tr valign=top>\r
+ *     <td><code>0</code>\r
+ *     <td>Number\r
+ *     <td>Yes\r
+ *     <td>Digit\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>1-9</code>\r
+ *     <td>Number\r
+ *     <td>Yes\r
+ *     <td>'1' through '9' indicate rounding.\r
+ *   <tr valign=top>\r
+ *     <td><code>@</code>\r
+ *     <td>Number\r
+ *     <td>No\r
+ *     <td>Significant digit\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>#</code>\r
+ *     <td>Number\r
+ *     <td>Yes\r
+ *     <td>Digit, zero shows as absent\r
+ *   <tr valign=top>\r
+ *     <td><code>.</code>\r
+ *     <td>Number\r
+ *     <td>Yes\r
+ *     <td>Decimal separator or monetary decimal separator\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>-</code>\r
+ *     <td>Number\r
+ *     <td>Yes\r
+ *     <td>Minus sign\r
+ *   <tr valign=top>\r
+ *     <td><code>,</code>\r
+ *     <td>Number\r
+ *     <td>Yes\r
+ *     <td>Grouping separator\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>E</code>\r
+ *     <td>Number\r
+ *     <td>Yes\r
+ *     <td>Separates mantissa and exponent in scientific notation.\r
+ *         <em>Need not be quoted in prefix or suffix.</em>\r
+ *   <tr valign=top>\r
+ *     <td><code>+</code>\r
+ *     <td>Exponent\r
+ *     <td>Yes\r
+ *     <td>Prefix positive exponents with localized plus sign.\r
+ *         <em>Need not be quoted in prefix or suffix.</em>\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>;</code>\r
+ *     <td>Subpattern boundary\r
+ *     <td>Yes\r
+ *     <td>Separates positive and negative subpatterns\r
+ *   <tr valign=top>\r
+ *     <td><code>%</code>\r
+ *     <td>Prefix or suffix\r
+ *     <td>Yes\r
+ *     <td>Multiply by 100 and show as percentage\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>&#92;u2030</code>\r
+ *     <td>Prefix or suffix\r
+ *     <td>Yes\r
+ *     <td>Multiply by 1000 and show as per mille\r
+ *   <tr valign=top>\r
+ *     <td><code>&#164;</code> (<code>&#92;u00A4</code>)\r
+ *     <td>Prefix or suffix\r
+ *     <td>No\r
+ *     <td>Currency sign, replaced by currency symbol.  If\r
+ *         doubled, replaced by international currency symbol.\r
+ *         If tripled, replaced by currency plural names, for example,\r
+ *         "US dollar" or "US dollars" for America.\r
+ *         If present in a pattern, the monetary decimal separator\r
+ *         is used instead of the decimal separator.\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>'</code>\r
+ *     <td>Prefix or suffix\r
+ *     <td>No\r
+ *     <td>Used to quote special characters in a prefix or suffix,\r
+ *         for example, <code>"'#'#"</code> formats 123 to\r
+ *         <code>"#123"</code>.  To create a single quote\r
+ *         itself, use two in a row: <code>"# o''clock"</code>.\r
+ *   <tr valign=top>\r
+ *     <td><code>*</code>\r
+ *     <td>Prefix or suffix boundary\r
+ *     <td>Yes\r
+ *     <td>Pad escape, precedes pad character\r
+ * </table>\r
+ * </blockquote>\r
+ *\r
+ * <p>A <code>DecimalFormat</code> pattern contains a postive and negative subpattern, for\r
+ * example, "#,##0.00;(#,##0.00)".  Each subpattern has a prefix, a numeric part, and a\r
+ * suffix.  If there is no explicit negative subpattern, the negative subpattern is the\r
+ * localized minus sign prefixed to the positive subpattern. That is, "0.00" alone is\r
+ * equivalent to "0.00;-0.00".  If there is an explicit negative subpattern, it serves\r
+ * only to specify the negative prefix and suffix; the number of digits, minimal digits,\r
+ * and other characteristics are ignored in the negative subpattern. That means that\r
+ * "#,##0.0#;(#)" has precisely the same result as "#,##0.0#;(#,##0.0#)".\r
+ *\r
+ * <p>The prefixes, suffixes, and various symbols used for infinity, digits, thousands\r
+ * separators, decimal separators, etc. may be set to arbitrary values, and they will\r
+ * appear properly during formatting.  However, care must be taken that the symbols and\r
+ * strings do not conflict, or parsing will be unreliable.  For example, either the\r
+ * positive and negative prefixes or the suffixes must be distinct for {@link #parse} to\r
+ * be able to distinguish positive from negative values.  Another example is that the\r
+ * decimal separator and thousands separator should be distinct characters, or parsing\r
+ * will be impossible.\r
+ *\r
+ * <p>The <em>grouping separator</em> is a character that separates clusters of integer\r
+ * digits to make large numbers more legible.  It commonly used for thousands, but in some\r
+ * locales it separates ten-thousands.  The <em>grouping size</em> is the number of digits\r
+ * between the grouping separators, such as 3 for "100,000,000" or 4 for "1 0000\r
+ * 0000". There are actually two different grouping sizes: One used for the least\r
+ * significant integer digits, the <em>primary grouping size</em>, and one used for all\r
+ * others, the <em>secondary grouping size</em>.  In most locales these are the same, but\r
+ * sometimes they are different. For example, if the primary grouping interval is 3, and\r
+ * the secondary is 2, then this corresponds to the pattern "#,##,##0", and the number\r
+ * 123456789 is formatted as "12,34,56,789".  If a pattern contains multiple grouping\r
+ * separators, the interval between the last one and the end of the integer defines the\r
+ * primary grouping size, and the interval between the last two defines the secondary\r
+ * grouping size. All others are ignored, so "#,##,###,####" == "###,###,####" ==\r
+ * "##,#,###,####".\r
+ *\r
+ * <p>Illegal patterns, such as "#.#.#" or "#.###,###", will cause\r
+ * <code>DecimalFormat</code> to throw an {@link IllegalArgumentException} with a message\r
+ * that describes the problem.\r
+ *\r
+ * <h4>Pattern BNF</h4>\r
+ *\r
+ * <pre>\r
+ * pattern    := subpattern (';' subpattern)?\r
+ * subpattern := prefix? number exponent? suffix?\r
+ * number     := (integer ('.' fraction)?) | sigDigits\r
+ * prefix     := '&#92;u0000'..'&#92;uFFFD' - specialCharacters\r
+ * suffix     := '&#92;u0000'..'&#92;uFFFD' - specialCharacters\r
+ * integer    := '#'* '0'* '0'\r
+ * fraction   := '0'* '#'*\r
+ * sigDigits  := '#'* '@' '@'* '#'*\r
+ * exponent   := 'E' '+'? '0'* '0'\r
+ * padSpec    := '*' padChar\r
+ * padChar    := '&#92;u0000'..'&#92;uFFFD' - quote\r
+ * &#32;\r
+ * Notation:\r
+ *   X*       0 or more instances of X\r
+ *   X?       0 or 1 instances of X\r
+ *   X|Y      either X or Y\r
+ *   C..D     any character from C up to D, inclusive\r
+ *   S-T      characters in S, except those in T\r
+ * </pre>\r
+ * The first subpattern is for positive numbers. The second (optional)\r
+ * subpattern is for negative numbers.\r
+ *\r
+ * <p>Not indicated in the BNF syntax above:\r
+ *\r
+ * <ul>\r
+ *\r
+ * <li>The grouping separator ',' can occur inside the integer and sigDigits\r
+ * elements, between any two pattern characters of that element, as long as the integer or\r
+ * sigDigits element is not followed by the exponent element.\r
+ *\r
+ * <li>Two grouping intervals are recognized: That between the decimal point and the first\r
+ * grouping symbol, and that between the first and second grouping symbols. These\r
+ * intervals are identical in most locales, but in some locales they differ. For example,\r
+ * the pattern &quot;#,##,###&quot; formats the number 123456789 as\r
+ * &quot;12,34,56,789&quot;.\r
+ *\r
+ * <li>The pad specifier <code>padSpec</code> may appear before the prefix, after the\r
+ * prefix, before the suffix, after the suffix, or not at all.\r
+ *\r
+ * <li>In place of '0', the digits '1' through '9' may be used to indicate a rounding\r
+ * increment.\r
+ *\r
+ * </ul>\r
+ *\r
+ * <h4>Parsing</h4>\r
+ *\r
+ * <p><code>DecimalFormat</code> parses all Unicode characters that represent decimal\r
+ * digits, as defined by {@link UCharacter#digit}.  In addition,\r
+ * <code>DecimalFormat</code> also recognizes as digits the ten consecutive characters\r
+ * starting with the localized zero digit defined in the {@link DecimalFormatSymbols}\r
+ * object.  During formatting, the {@link DecimalFormatSymbols}-based digits are output.\r
+ *\r
+ * <p>During parsing, grouping separators are ignored.\r
+ *\r
+ * <p>For currency parsing, the formatter is able to parse every currency style formats no\r
+ * matter which style the formatter is constructed with.  For example, a formatter\r
+ * instance gotten from NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can\r
+ * parse formats such as "USD1.00" and "3.00 US dollars".\r
+ *\r
+ * <p>If {@link #parse(String, ParsePosition)} fails to parse a string, it returns\r
+ * <code>null</code> and leaves the parse position unchanged.  The convenience method\r
+ * {@link #parse(String)} indicates parse failure by throwing a {@link\r
+ * java.text.ParseException}.\r
+ *\r
+ * <h4>Formatting</h4>\r
+ *\r
+ * <p>Formatting is guided by several parameters, all of which can be specified either\r
+ * using a pattern or using the API.  The following description applies to formats that do\r
+ * not use <a href="#sci">scientific notation</a> or <a href="#sigdig">significant\r
+ * digits</a>.\r
+ *\r
+ * <ul><li>If the number of actual integer digits exceeds the <em>maximum integer\r
+ * digits</em>, then only the least significant digits are shown.  For example, 1997 is\r
+ * formatted as "97" if the maximum integer digits is set to 2.\r
+ *\r
+ * <li>If the number of actual integer digits is less than the <em>minimum integer\r
+ * digits</em>, then leading zeros are added.  For example, 1997 is formatted as "01997"\r
+ * if the minimum integer digits is set to 5.\r
+ *\r
+ * <li>If the number of actual fraction digits exceeds the <em>maximum fraction\r
+ * digits</em>, then half-even rounding it performed to the maximum fraction digits.  For\r
+ * example, 0.125 is formatted as "0.12" if the maximum fraction digits is 2.  This\r
+ * behavior can be changed by specifying a rounding increment and a rounding mode.\r
+ *\r
+ * <li>If the number of actual fraction digits is less than the <em>minimum fraction\r
+ * digits</em>, then trailing zeros are added.  For example, 0.125 is formatted as\r
+ * "0.1250" if the mimimum fraction digits is set to 4.\r
+ *\r
+ * <li>Trailing fractional zeros are not displayed if they occur <em>j</em> positions\r
+ * after the decimal, where <em>j</em> is less than the maximum fraction digits. For\r
+ * example, 0.10004 is formatted as "0.1" if the maximum fraction digits is four or less.\r
+ * </ul>\r
+ *\r
+ * <p><strong>Special Values</strong>\r
+ *\r
+ * <p><code>NaN</code> is represented as a single character, typically\r
+ * <code>&#92;uFFFD</code>.  This character is determined by the {@link\r
+ * DecimalFormatSymbols} object.  This is the only value for which the prefixes and\r
+ * suffixes are not used.\r
+ *\r
+ * <p>Infinity is represented as a single character, typically <code>&#92;u221E</code>,\r
+ * with the positive or negative prefixes and suffixes applied.  The infinity character is\r
+ * determined by the {@link DecimalFormatSymbols} object.\r
+ *\r
+ * <a name="sci"><h4>Scientific Notation</h4></a>\r
+ *\r
+ * <p>Numbers in scientific notation are expressed as the product of a mantissa and a\r
+ * power of ten, for example, 1234 can be expressed as 1.234 x 10<sup>3</sup>. The\r
+ * mantissa is typically in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0),\r
+ * but it need not be.  <code>DecimalFormat</code> supports arbitrary mantissas.\r
+ * <code>DecimalFormat</code> can be instructed to use scientific notation through the API\r
+ * or through the pattern.  In a pattern, the exponent character immediately followed by\r
+ * one or more digit characters indicates scientific notation.  Example: "0.###E0" formats\r
+ * the number 1234 as "1.234E3".\r
+ *\r
+ * <ul>\r
+ *\r
+ * <li>The number of digit characters after the exponent character gives the minimum\r
+ * exponent digit count.  There is no maximum.  Negative exponents are formatted using the\r
+ * localized minus sign, <em>not</em> the prefix and suffix from the pattern.  This allows\r
+ * patterns such as "0.###E0 m/s".  To prefix positive exponents with a localized plus\r
+ * sign, specify '+' between the exponent and the digits: "0.###E+0" will produce formats\r
+ * "1E+1", "1E+0", "1E-1", etc.  (In localized patterns, use the localized plus sign\r
+ * rather than '+'.)\r
+ *\r
+ * <li>The minimum number of integer digits is achieved by adjusting the exponent.\r
+ * Example: 0.00123 formatted with "00.###E0" yields "12.3E-4".  This only happens if\r
+ * there is no maximum number of integer digits.  If there is a maximum, then the minimum\r
+ * number of integer digits is fixed at one.\r
+ *\r
+ * <li>The maximum number of integer digits, if present, specifies the exponent grouping.\r
+ * The most common use of this is to generate <em>engineering notation</em>, in which the\r
+ * exponent is a multiple of three, e.g., "##0.###E0".  The number 12345 is formatted\r
+ * using "##0.####E0" as "12.345E3".\r
+ *\r
+ * <li>When using scientific notation, the formatter controls the digit counts using\r
+ * significant digits logic.  The maximum number of significant digits limits the total\r
+ * number of integer and fraction digits that will be shown in the mantissa; it does not\r
+ * affect parsing.  For example, 12345 formatted with "##0.##E0" is "12.3E3".  See the\r
+ * section on significant digits for more details.\r
+ *\r
+ * <li>The number of significant digits shown is determined as follows: If\r
+ * areSignificantDigitsUsed() returns false, then the minimum number of significant digits\r
+ * shown is one, and the maximum number of significant digits shown is the sum of the\r
+ * <em>minimum integer</em> and <em>maximum fraction</em> digits, and is unaffected by the\r
+ * maximum integer digits.  If this sum is zero, then all significant digits are shown.\r
+ * If areSignificantDigitsUsed() returns true, then the significant digit counts are\r
+ * specified by getMinimumSignificantDigits() and getMaximumSignificantDigits().  In this\r
+ * case, the number of integer digits is fixed at one, and there is no exponent grouping.\r
+ *\r
+ * <li>Exponential patterns may not contain grouping separators.\r
+ *\r
+ * </ul>\r
+ *\r
+ * <a name="sigdig"><h4>Significant Digits</h4></a>\r
+ *\r
+ * <code>DecimalFormat</code> has two ways of controlling how many digits are shows: (a)\r
+ * significant digits counts, or (b) integer and fraction digit counts.  Integer and\r
+ * fraction digit counts are described above.  When a formatter is using significant\r
+ * digits counts, the number of integer and fraction digits is not specified directly, and\r
+ * the formatter settings for these counts are ignored.  Instead, the formatter uses\r
+ * however many integer and fraction digits are required to display the specified number\r
+ * of significant digits.  Examples:\r
+ *\r
+ * <blockquote>\r
+ * <table border=0 cellspacing=3 cellpadding=0>\r
+ *   <tr bgcolor="#ccccff">\r
+ *     <th align=left>Pattern\r
+ *     <th align=left>Minimum significant digits\r
+ *     <th align=left>Maximum significant digits\r
+ *     <th align=left>Number\r
+ *     <th align=left>Output of format()\r
+ *   <tr valign=top>\r
+ *     <td><code>@@@</code>\r
+ *     <td>3\r
+ *     <td>3\r
+ *     <td>12345\r
+ *     <td><code>12300</code>\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>@@@</code>\r
+ *     <td>3\r
+ *     <td>3\r
+ *     <td>0.12345\r
+ *     <td><code>0.123</code>\r
+ *   <tr valign=top>\r
+ *     <td><code>@@##</code>\r
+ *     <td>2\r
+ *     <td>4\r
+ *     <td>3.14159\r
+ *     <td><code>3.142</code>\r
+ *   <tr valign=top bgcolor="#eeeeff">\r
+ *     <td><code>@@##</code>\r
+ *     <td>2\r
+ *     <td>4\r
+ *     <td>1.23004\r
+ *     <td><code>1.23</code>\r
+ * </table>\r
+ * </blockquote>\r
+ *\r
+ * <ul>\r
+ *\r
+ * <li>Significant digit counts may be expressed using patterns that specify a minimum and\r
+ * maximum number of significant digits.  These are indicated by the <code>'@'</code> and\r
+ * <code>'#'</code> characters.  The minimum number of significant digits is the number of\r
+ * <code>'@'</code> characters.  The maximum number of significant digits is the number of\r
+ * <code>'@'</code> characters plus the number of <code>'#'</code> characters following on\r
+ * the right.  For example, the pattern <code>"@@@"</code> indicates exactly 3 significant\r
+ * digits.  The pattern <code>"@##"</code> indicates from 1 to 3 significant digits.\r
+ * Trailing zero digits to the right of the decimal separator are suppressed after the\r
+ * minimum number of significant digits have been shown.  For example, the pattern\r
+ * <code>"@##"</code> formats the number 0.1203 as <code>"0.12"</code>.\r
+ *\r
+ * <li>If a pattern uses significant digits, it may not contain a decimal separator, nor\r
+ * the <code>'0'</code> pattern character.  Patterns such as <code>"@00"</code> or\r
+ * <code>"@.###"</code> are disallowed.\r
+ *\r
+ * <li>Any number of <code>'#'</code> characters may be prepended to the left of the\r
+ * leftmost <code>'@'</code> character.  These have no effect on the minimum and maximum\r
+ * significant digits counts, but may be used to position grouping separators.  For\r
+ * example, <code>"#,#@#"</code> indicates a minimum of one significant digits, a maximum\r
+ * of two significant digits, and a grouping size of three.\r
+ *\r
+ * <li>In order to enable significant digits formatting, use a pattern containing the\r
+ * <code>'@'</code> pattern character.  Alternatively, call {@link\r
+ * #setSignificantDigitsUsed setSignificantDigitsUsed(true)}.\r
+ *\r
+ * <li>In order to disable significant digits formatting, use a pattern that does not\r
+ * contain the <code>'@'</code> pattern character. Alternatively, call {@link\r
+ * #setSignificantDigitsUsed setSignificantDigitsUsed(false)}.\r
+ *\r
+ * <li>The number of significant digits has no effect on parsing.\r
+ *\r
+ * <li>Significant digits may be used together with exponential notation. Such patterns\r
+ * are equivalent to a normal exponential pattern with a minimum and maximum integer digit\r
+ * count of one, a minimum fraction digit count of <code>getMinimumSignificantDigits() -\r
+ * 1</code>, and a maximum fraction digit count of <code>getMaximumSignificantDigits() -\r
+ * 1</code>. For example, the pattern <code>"@@###E0"</code> is equivalent to\r
+ * <code>"0.0###E0"</code>.\r
+ *\r
+ * <li>If signficant digits are in use, then the integer and fraction digit counts, as set\r
+ * via the API, are ignored.  If significant digits are not in use, then the signficant\r
+ * digit counts, as set via the API, are ignored.\r
+ *\r
+ * </ul>\r
+ *\r
+ * <h4>Padding</h4>\r
+ *\r
+ * <p><code>DecimalFormat</code> supports padding the result of {@link #format} to a\r
+ * specific width.  Padding may be specified either through the API or through the pattern\r
+ * syntax.  In a pattern the pad escape character, followed by a single pad character,\r
+ * causes padding to be parsed and formatted.  The pad escape character is '*' in\r
+ * unlocalized patterns, and can be localized using {@link\r
+ * DecimalFormatSymbols#setPadEscape}.  For example, <code>"$*x#,##0.00"</code> formats\r
+ * 123 to <code>"$xx123.00"</code>, and 1234 to <code>"$1,234.00"</code>.\r
+ *\r
+ * <ul>\r
+ *\r
+ * <li>When padding is in effect, the width of the positive subpattern, including prefix\r
+ * and suffix, determines the format width.  For example, in the pattern <code>"* #0\r
+ * o''clock"</code>, the format width is 10.\r
+ *\r
+ * <li>The width is counted in 16-bit code units (Java <code>char</code>s).\r
+ *\r
+ * <li>Some parameters which usually do not matter have meaning when padding is used,\r
+ * because the pattern width is significant with padding.  In the pattern "*\r
+ * ##,##,#,##0.##", the format width is 14.  The initial characters "##,##," do not affect\r
+ * the grouping size or maximum integer digits, but they do affect the format width.\r
+ *\r
+ * <li>Padding may be inserted at one of four locations: before the prefix, after the\r
+ * prefix, before the suffix, or after the suffix.  If padding is specified in any other\r
+ * location, {@link #applyPattern} throws an {@link IllegalArgumentException}.  If there\r
+ * is no prefix, before the prefix and after the prefix are equivalent, likewise for the\r
+ * suffix.\r
+ *\r
+ * <li>When specified in a pattern, the 16-bit <code>char</code> immediately following the\r
+ * pad escape is the pad character. This may be any character, including a special pattern\r
+ * character. That is, the pad escape <em>escapes</em> the following character. If there\r
+ * is no character after the pad escape, then the pattern is illegal.\r
+ *\r
+ * </ul>\r
+ *\r
+ * <p>\r
+ * <strong>Rounding</strong>\r
+ *\r
+ * <p><code>DecimalFormat</code> supports rounding to a specific increment.  For example,\r
+ * 1230 rounded to the nearest 50 is 1250.  1.234 rounded to the nearest 0.65 is 1.3.  The\r
+ * rounding increment may be specified through the API or in a pattern.  To specify a\r
+ * rounding increment in a pattern, include the increment in the pattern itself.  "#,#50"\r
+ * specifies a rounding increment of 50.  "#,##0.05" specifies a rounding increment of\r
+ * 0.05.\r
+ *\r
+ * <ul>\r
+ *\r
+ * <li>Rounding only affects the string produced by formatting.  It does not affect\r
+ * parsing or change any numerical values.\r
+ *\r
+ * <li>A <em>rounding mode</em> determines how values are rounded; see the {@link\r
+ * com.ibm.icu.math.BigDecimal} documentation for a description of the modes.  Rounding\r
+ * increments specified in patterns use the default mode, {@link\r
+ * com.ibm.icu.math.BigDecimal#ROUND_HALF_EVEN}.\r
+ *\r
+ * <li>Some locales use rounding in their currency formats to reflect the smallest\r
+ * currency denomination.\r
+ *\r
+ * <li>In a pattern, digits '1' through '9' specify rounding, but otherwise behave\r
+ * identically to digit '0'.\r
+ *\r
+ * </ul>\r
+ *\r
+ * <h4>Synchronization</h4>\r
+ *\r
+ * <p><code>DecimalFormat</code> objects are not synchronized.  Multiple threads should\r
+ * not access one formatter concurrently.\r
+ *\r
+ * @see          java.text.Format\r
+ * @see          NumberFormat\r
+ * @author       Mark Davis\r
+ * @author       Alan Liu\r
+ * @stable ICU 2.0\r
+ */\r
+public class DecimalFormat extends NumberFormat {\r
+\r
+    private static final long serialVersionUID = 1L;\r
+    /**\r
+     * @internal\r
+     * @param delegate the NumberFormat to which to delegate\r
+     */\r
+    public DecimalFormat(java.text.DecimalFormat delegate) {\r
+        super(delegate);\r
+    }\r
+\r
+    /**\r
+     * Creates a DecimalFormat using the default pattern and symbols for the default\r
+     * locale. This is a convenient way to obtain a DecimalFormat when\r
+     * internationalization is not the main concern.\r
+     *\r
+     * <p>To obtain standard formats for a given locale, use the factory methods on\r
+     * NumberFormat such as getNumberInstance.  These factories will return the most\r
+     * appropriate sub-class of NumberFormat for a given locale.\r
+     *\r
+     * @see NumberFormat#getInstance\r
+     * @see NumberFormat#getNumberInstance\r
+     * @see NumberFormat#getCurrencyInstance\r
+     * @see NumberFormat#getPercentInstance\r
+     * @stable ICU 2.0\r
+     */\r
+    public DecimalFormat() {\r
+        this(new java.text.DecimalFormat());\r
+    }\r
+\r
+    /**\r
+     * Creates a DecimalFormat from the given pattern and the symbols for the default\r
+     * locale. This is a convenient way to obtain a DecimalFormat when\r
+     * internationalization is not the main concern.\r
+     *\r
+     * <p>To obtain standard formats for a given locale, use the factory methods on\r
+     * NumberFormat such as getNumberInstance.  These factories will return the most\r
+     * appropriate sub-class of NumberFormat for a given locale.\r
+     *\r
+     * @param pattern A non-localized pattern string.\r
+     * @throws IllegalArgumentException if the given pattern is invalid.\r
+     * @see NumberFormat#getInstance\r
+     * @see NumberFormat#getNumberInstance\r
+     * @see NumberFormat#getCurrencyInstance\r
+     * @see NumberFormat#getPercentInstance\r
+     * @stable ICU 2.0\r
+     */\r
+    public DecimalFormat(String pattern) {\r
+        this(new java.text.DecimalFormat(pattern));\r
+    }\r
+\r
+    /**\r
+     * Creates a DecimalFormat from the given pattern and symbols. Use this constructor\r
+     * when you need to completely customize the behavior of the format.\r
+     *\r
+     * <p>To obtain standard formats for a given locale, use the factory methods on\r
+     * NumberFormat such as getInstance or getCurrencyInstance. If you need only minor\r
+     * adjustments to a standard format, you can modify the format returned by a\r
+     * NumberFormat factory method.\r
+     *\r
+     * @param pattern a non-localized pattern string\r
+     * @param symbols the set of symbols to be used\r
+     * @exception IllegalArgumentException if the given pattern is invalid\r
+     * @see NumberFormat#getInstance\r
+     * @see NumberFormat#getNumberInstance\r
+     * @see NumberFormat#getCurrencyInstance\r
+     * @see NumberFormat#getPercentInstance\r
+     * @see DecimalFormatSymbols\r
+     * @stable ICU 2.0\r
+     */\r
+    public DecimalFormat(String pattern, DecimalFormatSymbols symbols) {\r
+        this(new java.text.DecimalFormat(pattern, symbols.dfs));\r
+    }\r
+\r
+    /**\r
+     * Creates a DecimalFormat from the given pattern, symbols, information used for\r
+     * currency plural format, and format style. Use this constructor when you need to\r
+     * completely customize the behavior of the format.\r
+     *\r
+     * <p>To obtain standard formats for a given locale, use the factory methods on\r
+     * NumberFormat such as getInstance or getCurrencyInstance.\r
+     *\r
+     * <p>If you need only minor adjustments to a standard format, you can modify the\r
+     * format returned by a NumberFormat factory method using the setters.\r
+     *\r
+     * <p>If you want to completely customize a decimal format, using your own\r
+     * DecimalFormatSymbols (such as group separators) and your own information for\r
+     * currency plural formatting (such as plural rule and currency plural patterns), you\r
+     * can use this constructor.\r
+     *\r
+     * @param pattern a non-localized pattern string\r
+     * @param symbols the set of symbols to be used\r
+     * @param infoInput the information used for currency plural format, including\r
+     * currency plural patterns and plural rules.\r
+     * @param style the decimal formatting style, it is one of the following values:\r
+     * NumberFormat.NUMBERSTYLE; NumberFormat.CURRENCYSTYLE; NumberFormat.PERCENTSTYLE;\r
+     * NumberFormat.SCIENTIFICSTYLE; NumberFormat.INTEGERSTYLE;\r
+     * NumberFormat.ISOCURRENCYSTYLE; NumberFormat.PLURALCURRENCYSTYLE;\r
+     * @stable ICU 4.2\r
+     */\r
+    public DecimalFormat(String pattern, DecimalFormatSymbols symbols, CurrencyPluralInfo infoInput,\r
+                         int style) {\r
+        throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@inheritDoc}\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(double number, StringBuffer result, FieldPosition fieldPosition) {\r
+        return super.format(number, result, fieldPosition);\r
+    }\r
+\r
+    /**\r
+     * @stable ICU 2.0\r
+     */\r
+    // [Spark/CDL] Delegate to format_long_StringBuffer_FieldPosition_boolean\r
+    public StringBuffer format(long number, StringBuffer result, FieldPosition fieldPosition) {\r
+        return super.format(number, result, fieldPosition);\r
+    }\r
+\r
+    /**\r
+     * Formats a BigInteger number.\r
+     *\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(BigInteger number, StringBuffer result,\r
+                               FieldPosition fieldPosition) {\r
+        return super.format(number, result, fieldPosition);\r
+    }\r
+\r
+    /**\r
+     * Formats a BigDecimal number.\r
+     *\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(java.math.BigDecimal number, StringBuffer result,\r
+                               FieldPosition fieldPosition) {\r
+        return super.format(number, result, fieldPosition);\r
+    }\r
+\r
+    /**\r
+     * Formats a BigDecimal number.\r
+     *\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(BigDecimal number, StringBuffer result,\r
+                               FieldPosition fieldPosition) {\r
+        return super.format(number, result, fieldPosition);\r
+    }\r
+\r
+    /**\r
+     * Parses the given string, returning a <code>Number</code> object to represent the\r
+     * parsed value. <code>Double</code> objects are returned to represent non-integral\r
+     * values which cannot be stored in a <code>BigDecimal</code>. These are\r
+     * <code>NaN</code>, infinity, -infinity, and -0.0. If {@link #isParseBigDecimal()} is\r
+     * false (the default), all other values are returned as <code>Long</code>,\r
+     * <code>BigInteger</code>, or <code>BigDecimal</code> values, in that order of\r
+     * preference. If {@link #isParseBigDecimal()} is true, all other values are returned\r
+     * as <code>BigDecimal</code> valuse. If the parse fails, null is returned.\r
+     *\r
+     * @param text the string to be parsed\r
+     * @param parsePosition defines the position where parsing is to begin, and upon\r
+     * return, the position where parsing left off. If the position has not changed upon\r
+     * return, then parsing failed.\r
+     * @return a <code>Number</code> object with the parsed value or\r
+     * <code>null</code> if the parse failed\r
+     * @stable ICU 2.0\r
+     */\r
+    public Number parse(String text, ParsePosition parsePosition) {\r
+        return super.parse(text, parsePosition);\r
+    }\r
+\r
+    /**\r
+     * Parses text from the given string as a CurrencyAmount. Unlike the parse() method,\r
+     * this method will attempt to parse a generic currency name, searching for a match of\r
+     * this object's locale's currency display names, or for a 3-letter ISO currency\r
+     * code. This method will fail if this format is not a currency format, that is, if it\r
+     * does not contain the currency pattern symbol (U+00A4) in its prefix or suffix.\r
+     *\r
+     * @param text the string to parse\r
+     * @param pos input-output position; on input, the position within text to match; must\r
+     *  have 0 <= pos.getIndex() < text.length(); on output, the position after the last\r
+     *  matched character. If the parse fails, the position in unchanged upon output.\r
+     * @return a CurrencyAmount, or null upon failure\r
+     */\r
+    CurrencyAmount parseCurrency(String text, ParsePosition pos) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns a copy of the decimal format symbols used by this format.\r
+     *\r
+     * @return desired DecimalFormatSymbols\r
+     * @see DecimalFormatSymbols\r
+     * @stable ICU 2.0\r
+     */\r
+    public DecimalFormatSymbols getDecimalFormatSymbols() {\r
+        return new DecimalFormatSymbols(((java.text.DecimalFormat)numberFormat).getDecimalFormatSymbols());\r
+    }\r
+\r
+    /**\r
+     * Sets the decimal format symbols used by this format. The format uses a copy of the\r
+     * provided symbols.\r
+     *\r
+     * @param newSymbols desired DecimalFormatSymbols\r
+     * @see DecimalFormatSymbols\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {\r
+        ((java.text.DecimalFormat)numberFormat).setDecimalFormatSymbols(newSymbols.dfs);\r
+    }\r
+\r
+    /**\r
+     * Returns the positive prefix.\r
+     *\r
+     * <p>Examples: +123, $123, sFr123\r
+     * @return the prefix\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getPositivePrefix() {\r
+        return ((java.text.DecimalFormat)numberFormat).getPositivePrefix();\r
+    }\r
+\r
+    /**\r
+     * Sets the positive prefix.\r
+     *\r
+     * <p>Examples: +123, $123, sFr123\r
+     * @param newValue the prefix\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setPositivePrefix(String newValue) {\r
+        ((java.text.DecimalFormat)numberFormat).setPositivePrefix(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the negative prefix.\r
+     *\r
+     * <p>Examples: -123, ($123) (with negative suffix), sFr-123\r
+     *\r
+     * @return the prefix\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getNegativePrefix() {\r
+        return ((java.text.DecimalFormat)numberFormat).getNegativePrefix();\r
+    }\r
+\r
+    /**\r
+     * Sets the negative prefix.\r
+     *\r
+     * <p>Examples: -123, ($123) (with negative suffix), sFr-123\r
+     * @param newValue the prefix\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setNegativePrefix(String newValue) {\r
+        ((java.text.DecimalFormat)numberFormat).setNegativePrefix(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the positive suffix.\r
+     *\r
+     * <p>Example: 123%\r
+     *\r
+     * @return the suffix\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getPositiveSuffix() {\r
+        return ((java.text.DecimalFormat)numberFormat).getPositiveSuffix();\r
+    }\r
+\r
+    /**\r
+     * Sets the positive suffix.\r
+     *\r
+     * <p>Example: 123%\r
+     * @param newValue the suffix\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setPositiveSuffix(String newValue) {\r
+        ((java.text.DecimalFormat)numberFormat).setPositiveSuffix(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the negative suffix.\r
+     *\r
+     * <p>Examples: -123%, ($123) (with positive suffixes)\r
+     *\r
+     * @return the suffix\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getNegativeSuffix() {\r
+        return ((java.text.DecimalFormat)numberFormat).getNegativeSuffix();\r
+    }\r
+\r
+    /**\r
+     * Sets the positive suffix.\r
+     *\r
+     * <p>Examples: 123%\r
+     * @param newValue the suffix\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setNegativeSuffix(String newValue) {\r
+        ((java.text.DecimalFormat)numberFormat).setNegativeSuffix(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the multiplier for use in percent, permill, etc. For a percentage, set the\r
+     * suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent\r
+     * symbol). For a permill, set the suffixes to have "\u2031" and the multiplier to be\r
+     * 1000.\r
+     *\r
+     * <p>Examples: with 100, 1.23 -> "123", and "123" -> 1.23\r
+     *\r
+     * @return the multiplier\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getMultiplier() {\r
+        return ((java.text.DecimalFormat)numberFormat).getMultiplier();\r
+    }\r
+\r
+    /**\r
+     * Sets the multiplier for use in percent, permill, etc. For a percentage, set the\r
+     * suffixes to have "%" and the multiplier to be 100. (For Arabic, use arabic percent\r
+     * symbol). For a permill, set the suffixes to have "\u2031" and the multiplier to be\r
+     * 1000.\r
+     *\r
+     * <p>Examples: with 100, 1.23 -> "123", and "123" -> 1.23\r
+     *\r
+     * @param newValue the multiplier\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMultiplier(int newValue) {\r
+        ((java.text.DecimalFormat)numberFormat).setMultiplier(newValue);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the rounding increment.\r
+     *\r
+     * @return A positive rounding increment, or <code>null</code> if rounding is not in\r
+     * effect.\r
+     * @see #setRoundingIncrement\r
+     * @see #getRoundingMode\r
+     * @see #setRoundingMode\r
+     * @stable ICU 2.0\r
+     */\r
+    public BigDecimal getRoundingIncrement() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the rounding increment. This method also controls whether rounding is\r
+     * enabled.\r
+     *\r
+     * @param newValue A positive rounding increment, or <code>null</code> or\r
+     * <code>BigDecimal(0.0)</code> to disable rounding.\r
+     * @throws IllegalArgumentException if <code>newValue</code> is < 0.0\r
+     * @see #getRoundingIncrement\r
+     * @see #getRoundingMode\r
+     * @see #setRoundingMode\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setRoundingIncrement(java.math.BigDecimal newValue) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the rounding increment. This method also controls whether rounding is\r
+     * enabled.\r
+     *\r
+     * @param newValue A positive rounding increment, or <code>null</code> or\r
+     * <code>BigDecimal(0.0)</code> to disable rounding.\r
+     * @throws IllegalArgumentException if <code>newValue</code> is < 0.0\r
+     * @see #getRoundingIncrement\r
+     * @see #getRoundingMode\r
+     * @see #setRoundingMode\r
+     * @stable ICU 3.6\r
+     */\r
+    public void setRoundingIncrement(BigDecimal newValue) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the rounding increment. This method also controls whether rounding is\r
+     * enabled.\r
+     *\r
+     * @param newValue A positive rounding increment, or 0.0 to disable rounding.\r
+     * @throws IllegalArgumentException if <code>newValue</code> is < 0.0\r
+     * @see #getRoundingIncrement\r
+     * @see #getRoundingMode\r
+     * @see #setRoundingMode\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setRoundingIncrement(double newValue) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the rounding mode.\r
+     *\r
+     * @return A rounding mode, between <code>BigDecimal.ROUND_UP</code> and\r
+     * <code>BigDecimal.ROUND_UNNECESSARY</code>.\r
+     * @see #setRoundingIncrement\r
+     * @see #getRoundingIncrement\r
+     * @see #setRoundingMode\r
+     * @see java.math.BigDecimal\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getRoundingMode() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Sets the rounding mode. This has no effect unless the rounding increment is greater\r
+     * than zero.\r
+     *\r
+     * @param roundingMode A rounding mode, between <code>BigDecimal.ROUND_UP</code> and\r
+     * <code>BigDecimal.ROUND_UNNECESSARY</code>.\r
+     * @exception IllegalArgumentException if <code>roundingMode</code> is unrecognized.\r
+     * @see #setRoundingIncrement\r
+     * @see #getRoundingIncrement\r
+     * @see #getRoundingMode\r
+     * @see java.math.BigDecimal\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setRoundingMode(int roundingMode) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the width to which the output of <code>format()</code> is padded. The width is\r
+     * counted in 16-bit code units.\r
+     *\r
+     * @return the format width, or zero if no padding is in effect\r
+     * @see #setFormatWidth\r
+     * @see #getPadCharacter\r
+     * @see #setPadCharacter\r
+     * @see #getPadPosition\r
+     * @see #setPadPosition\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getFormatWidth() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Sets the width to which the output of <code>format()</code> is\r
+     * padded. The width is counted in 16-bit code units.  This method\r
+     * also controls whether padding is enabled.\r
+     *\r
+     * @param width the width to which to pad the result of\r
+     * <code>format()</code>, or zero to disable padding\r
+     * @exception IllegalArgumentException if <code>width</code> is < 0\r
+     * @see #getFormatWidth\r
+     * @see #getPadCharacter\r
+     * @see #setPadCharacter\r
+     * @see #getPadPosition\r
+     * @see #setPadPosition\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setFormatWidth(int width) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the character used to pad to the format width. The default is ' '.\r
+     *\r
+     * @return the pad character\r
+     * @see #setFormatWidth\r
+     * @see #getFormatWidth\r
+     * @see #setPadCharacter\r
+     * @see #getPadPosition\r
+     * @see #setPadPosition\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getPadCharacter() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the character used to pad to the format width. If padding is not\r
+     * enabled, then this will take effect if padding is later enabled.\r
+     *\r
+     * @param padChar the pad character\r
+     * @see #setFormatWidth\r
+     * @see #getFormatWidth\r
+     * @see #getPadCharacter\r
+     * @see #getPadPosition\r
+     * @see #setPadPosition\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setPadCharacter(char padChar) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the position at which padding will take place. This is the location at\r
+     * which padding will be inserted if the result of <code>format()</code> is shorter\r
+     * than the format width.\r
+     *\r
+     * @return the pad position, one of <code>PAD_BEFORE_PREFIX</code>,\r
+     *         <code>PAD_AFTER_PREFIX</code>, <code>PAD_BEFORE_SUFFIX</code>, or\r
+     *         <code>PAD_AFTER_SUFFIX</code>.\r
+     * @see #setFormatWidth\r
+     * @see #getFormatWidth\r
+     * @see #setPadCharacter\r
+     * @see #getPadCharacter\r
+     * @see #setPadPosition\r
+     * @see #PAD_BEFORE_PREFIX\r
+     * @see #PAD_AFTER_PREFIX\r
+     * @see #PAD_BEFORE_SUFFIX\r
+     * @see #PAD_AFTER_SUFFIX\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getPadPosition() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the position at which padding will take place. This is the location at\r
+     * which padding will be inserted if the result of <code>format()</code> is shorter\r
+     * than the format width. This has no effect unless padding is enabled.\r
+     *\r
+     * @param padPos the pad position, one of <code>PAD_BEFORE_PREFIX</code>,\r
+     * <code>PAD_AFTER_PREFIX</code>, <code>PAD_BEFORE_SUFFIX</code>, or\r
+     * <code>PAD_AFTER_SUFFIX</code>.\r
+     * @exception IllegalArgumentException if the pad position in unrecognized\r
+     * @see #setFormatWidth\r
+     * @see #getFormatWidth\r
+     * @see #setPadCharacter\r
+     * @see #getPadCharacter\r
+     * @see #getPadPosition\r
+     * @see #PAD_BEFORE_PREFIX\r
+     * @see #PAD_AFTER_PREFIX\r
+     * @see #PAD_BEFORE_SUFFIX\r
+     * @see #PAD_AFTER_SUFFIX\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setPadPosition(int padPos) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns whether or not scientific notation is used.\r
+     *\r
+     * @return true if this object formats and parses scientific notation\r
+     * @see #setScientificNotation\r
+     * @see #getMinimumExponentDigits\r
+     * @see #setMinimumExponentDigits\r
+     * @see #isExponentSignAlwaysShown\r
+     * @see #setExponentSignAlwaysShown\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isScientificNotation() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets whether or not scientific notation is used. When scientific notation is\r
+     * used, the effective maximum number of integer digits is <= 8. If the maximum number\r
+     * of integer digits is set to more than 8, the effective maximum will be 1. This\r
+     * allows this call to generate a 'default' scientific number format without\r
+     * additional changes.\r
+     *\r
+     * @param useScientific true if this object formats and parses scientific notation\r
+     * @see #isScientificNotation\r
+     * @see #getMinimumExponentDigits\r
+     * @see #setMinimumExponentDigits\r
+     * @see #isExponentSignAlwaysShown\r
+     * @see #setExponentSignAlwaysShown\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setScientificNotation(boolean useScientific) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the minimum exponent digits that will be shown.\r
+     *\r
+     * @return the minimum exponent digits that will be shown\r
+     * @see #setScientificNotation\r
+     * @see #isScientificNotation\r
+     * @see #setMinimumExponentDigits\r
+     * @see #isExponentSignAlwaysShown\r
+     * @see #setExponentSignAlwaysShown\r
+     * @stable ICU 2.0\r
+     */\r
+    public byte getMinimumExponentDigits() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the minimum exponent digits that will be shown. This has no effect\r
+     * unless scientific notation is in use.\r
+     *\r
+     * @param minExpDig a value >= 1 indicating the fewest exponent\r
+     * digits that will be shown\r
+     * @exception IllegalArgumentException if <code>minExpDig</code> < 1\r
+     * @see #setScientificNotation\r
+     * @see #isScientificNotation\r
+     * @see #getMinimumExponentDigits\r
+     * @see #isExponentSignAlwaysShown\r
+     * @see #setExponentSignAlwaysShown\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMinimumExponentDigits(byte minExpDig) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns whether the exponent sign is always shown.\r
+     *\r
+     * @return true if the exponent is always prefixed with either the localized minus\r
+     * sign or the localized plus sign, false if only negative exponents are prefixed with\r
+     * the localized minus sign.\r
+     * @see #setScientificNotation\r
+     * @see #isScientificNotation\r
+     * @see #setMinimumExponentDigits\r
+     * @see #getMinimumExponentDigits\r
+     * @see #setExponentSignAlwaysShown\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isExponentSignAlwaysShown() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets whether the exponent sign is always shown. This has no effect unless\r
+     * scientific notation is in use.\r
+     *\r
+     * @param expSignAlways true if the exponent is always prefixed with either the\r
+     * localized minus sign or the localized plus sign, false if only negative exponents\r
+     * are prefixed with the localized minus sign.\r
+     * @see #setScientificNotation\r
+     * @see #isScientificNotation\r
+     * @see #setMinimumExponentDigits\r
+     * @see #getMinimumExponentDigits\r
+     * @see #isExponentSignAlwaysShown\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setExponentSignAlwaysShown(boolean expSignAlways) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the grouping size. Grouping size is the number of digits between grouping\r
+     * separators in the integer portion of a number. For example, in the number\r
+     * "123,456.78", the grouping size is 3.\r
+     *\r
+     * @see #setGroupingSize\r
+     * @see NumberFormat#isGroupingUsed\r
+     * @see DecimalFormatSymbols#getGroupingSeparator\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getGroupingSize() {\r
+        return ((java.text.DecimalFormat)numberFormat).getGroupingSize();\r
+    }\r
+\r
+    /**\r
+     * Sets the grouping size. Grouping size is the number of digits between grouping\r
+     * separators in the integer portion of a number. For example, in the number\r
+     * "123,456.78", the grouping size is 3.\r
+     *\r
+     * @see #getGroupingSize\r
+     * @see NumberFormat#setGroupingUsed\r
+     * @see DecimalFormatSymbols#setGroupingSeparator\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setGroupingSize(int newValue) {\r
+        ((java.text.DecimalFormat)numberFormat).setGroupingSize(newValue);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the secondary grouping size. In some locales one grouping interval\r
+     * is used for the least significant integer digits (the primary grouping size), and\r
+     * another is used for all others (the secondary grouping size). A formatter\r
+     * supporting a secondary grouping size will return a positive integer unequal to the\r
+     * primary grouping size returned by <code>getGroupingSize()</code>. For example, if\r
+     * the primary grouping size is 4, and the secondary grouping size is 2, then the\r
+     * number 123456789 formats as "1,23,45,6789", and the pattern appears as "#,##,###0".\r
+     *\r
+     * @return the secondary grouping size, or a value less than one if there is none\r
+     * @see #setSecondaryGroupingSize\r
+     * @see NumberFormat#isGroupingUsed\r
+     * @see DecimalFormatSymbols#getGroupingSeparator\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getSecondaryGroupingSize() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the secondary grouping size. If set to a value less than 1, then\r
+     * secondary grouping is turned off, and the primary grouping size is used for all\r
+     * intervals, not just the least significant.\r
+     *\r
+     * @see #getSecondaryGroupingSize\r
+     * @see NumberFormat#setGroupingUsed\r
+     * @see DecimalFormatSymbols#setGroupingSeparator\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setSecondaryGroupingSize(int newValue) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the MathContext used by this format.\r
+     *\r
+     * @return desired MathContext\r
+     * @see #getMathContext\r
+     * @stable ICU 4.2\r
+     */\r
+    public MathContext getMathContextICU() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the MathContext used by this format.\r
+     *\r
+     * @return desired MathContext\r
+     * @see #getMathContext\r
+     * @stable ICU 4.2\r
+     */\r
+    public java.math.MathContext getMathContext() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the MathContext used by this format.\r
+     *\r
+     * @param newValue desired MathContext\r
+     * @see #getMathContext\r
+     * @stable ICU 4.2\r
+     */\r
+    public void setMathContextICU(MathContext newValue) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the MathContext used by this format.\r
+     *\r
+     * @param newValue desired MathContext\r
+     * @see #getMathContext\r
+     * @stable ICU 4.2\r
+     */\r
+    public void setMathContext(java.math.MathContext newValue) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the behavior of the decimal separator with integers. (The decimal\r
+     * separator will always appear with decimals.)  <p> Example: Decimal ON: 12345 ->\r
+     * 12345.; OFF: 12345 -> 12345\r
+     *\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isDecimalSeparatorAlwaysShown() {\r
+        return ((java.text.DecimalFormat)numberFormat).isDecimalSeparatorAlwaysShown();\r
+    }\r
+\r
+    /**\r
+     * Sets the behavior of the decimal separator with integers. (The decimal separator\r
+     * will always appear with decimals.)\r
+     *\r
+     * <p>This only affects formatting, and only where there might be no digits after the\r
+     * decimal point, e.g., if true, 3456.00 -> "3,456." if false, 3456.00 -> "3456" This\r
+     * is independent of parsing. If you want parsing to stop at the decimal point, use\r
+     * setParseIntegerOnly.\r
+     *\r
+     * <p>\r
+     * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345\r
+     *\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setDecimalSeparatorAlwaysShown(boolean newValue) {\r
+        ((java.text.DecimalFormat)numberFormat).setDecimalSeparatorAlwaysShown(newValue);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a copy of the CurrencyPluralInfo used by this format. It might\r
+     * return null if the decimal format is not a plural type currency decimal\r
+     * format. Plural type currency decimal format means either the pattern in the decimal\r
+     * format contains 3 currency signs, or the decimal format is initialized with\r
+     * PLURALCURRENCYSTYLE.\r
+     *\r
+     * @return desired CurrencyPluralInfo\r
+     * @see CurrencyPluralInfo\r
+     * @stable ICU 4.2\r
+     */\r
+    public CurrencyPluralInfo getCurrencyPluralInfo() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the CurrencyPluralInfo used by this format. The format uses a copy of\r
+     * the provided information.\r
+     *\r
+     * @param newInfo desired CurrencyPluralInfo\r
+     * @see CurrencyPluralInfo\r
+     * @stable ICU 4.2\r
+     */\r
+    public void setCurrencyPluralInfo(CurrencyPluralInfo newInfo) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Overrides clone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone() {\r
+        return new DecimalFormatSymbols((java.text.DecimalFormatSymbols)numberFormat.clone());\r
+    }\r
+\r
+    /**\r
+     * Overrides equals.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean equals(Object obj) {\r
+        return super.equals(obj);\r
+    }\r
+\r
+    /**\r
+     * Overrides hashCode.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int hashCode() {\r
+        return super.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Synthesizes a pattern string that represents the current state of this Format\r
+     * object.\r
+     *\r
+     * @see #applyPattern\r
+     * @stable ICU 2.0\r
+     */\r
+    public String toPattern() {\r
+        return ((java.text.DecimalFormat)numberFormat).toPattern();\r
+    }\r
+\r
+    /**\r
+     * Synthesizes a localized pattern string that represents the current state of this\r
+     * Format object.\r
+     *\r
+     * @see #applyPattern\r
+     * @stable ICU 2.0\r
+     */\r
+    public String toLocalizedPattern() {\r
+        return ((java.text.DecimalFormat)numberFormat).toLocalizedPattern();\r
+    }\r
+\r
+    /**\r
+     * Formats the object to an attributed string, and return the corresponding iterator.\r
+     *\r
+     * @stable ICU 3.6\r
+     */\r
+    public AttributedCharacterIterator formatToCharacterIterator(Object obj) {\r
+        AttributedCharacterIterator it = numberFormat.formatToCharacterIterator(obj);\r
+\r
+        // Extract formatted String first\r
+        StringBuilder sb = new StringBuilder();\r
+        for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {\r
+            sb.append(c);\r
+        }\r
+\r
+        // Create AttributedString\r
+        AttributedString attrstr = new AttributedString(sb.toString());\r
+\r
+        // Map JDK Field to ICU Field\r
+        int idx = 0;\r
+        it.first();\r
+        while (idx < it.getEndIndex()) {\r
+            int end = it.getRunLimit();\r
+            Map<Attribute, Object> attributes = it.getAttributes();\r
+            if (attributes != null) {\r
+                for (Entry<Attribute, Object> entry : attributes.entrySet()) {\r
+                    Attribute attr = entry.getKey();\r
+                    Object val = entry.getValue();\r
+                    if (attr.equals(java.text.NumberFormat.Field.CURRENCY)) {\r
+                        val = attr = Field.CURRENCY;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.DECIMAL_SEPARATOR)) {\r
+                        val = attr = Field.DECIMAL_SEPARATOR;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.EXPONENT)) {\r
+                        val = attr = Field.EXPONENT;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.EXPONENT_SIGN)) {\r
+                        val = attr = Field.EXPONENT_SIGN;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.EXPONENT_SYMBOL)) {\r
+                        val = attr = Field.EXPONENT_SYMBOL;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.FRACTION)) {\r
+                        val = attr = Field.FRACTION;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.GROUPING_SEPARATOR)) {\r
+                        val = attr = Field.GROUPING_SEPARATOR;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.INTEGER)) {\r
+                        val = attr = Field.INTEGER;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.PERCENT)) {\r
+                        val = attr = Field.PERCENT;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.PERMILLE)) {\r
+                        val = attr = Field.PERMILLE;\r
+                    } else if (attr.equals(java.text.NumberFormat.Field.SIGN)) {\r
+                        val = attr = Field.SIGN;\r
+                    }\r
+                    attrstr.addAttribute(attr, val, idx, end);\r
+                }\r
+            }\r
+            idx = end;\r
+            while (it.getIndex() < idx) {\r
+                it.next();\r
+            }\r
+        }\r
+\r
+        return attrstr.getIterator();\r
+    }\r
+\r
+    /**\r
+     * Applies the given pattern to this Format object. A pattern is a short-hand\r
+     * specification for the various formatting properties. These properties can also be\r
+     * changed individually through the various setter methods.\r
+     *\r
+     * <p>There is no limit to integer digits are set by this routine, since that is the\r
+     * typical end-user desire; use setMaximumInteger if you want to set a real value. For\r
+     * negative numbers, use a second pattern, separated by a semicolon\r
+     *\r
+     * <p>Example "#,#00.0#" -> 1,234.56\r
+     *\r
+     * <p>This means a minimum of 2 integer digits, 1 fraction digit, and a maximum of 2\r
+     * fraction digits.\r
+     *\r
+     * <p>Example: "#,#00.0#;(#,#00.0#)" for negatives in parentheses.\r
+     *\r
+     * <p>In negative patterns, the minimum and maximum counts are ignored; these are\r
+     * presumed to be set in the positive pattern.\r
+     *\r
+     * @stable ICU 2.0\r
+     */\r
+    public void applyPattern(String pattern) {\r
+        ((java.text.DecimalFormat)numberFormat).applyPattern(pattern);\r
+    }\r
+\r
+    /**\r
+     * Applies the given pattern to this Format object. The pattern is assumed to be in a\r
+     * localized notation. A pattern is a short-hand specification for the various\r
+     * formatting properties. These properties can also be changed individually through\r
+     * the various setter methods.\r
+     *\r
+     * <p>There is no limit to integer digits are set by this routine, since that is the\r
+     * typical end-user desire; use setMaximumInteger if you want to set a real value. For\r
+     * negative numbers, use a second pattern, separated by a semicolon\r
+     *\r
+     * <p>Example "#,#00.0#" -> 1,234.56\r
+     *\r
+     * <p>This means a minimum of 2 integer digits, 1 fraction digit, and a maximum of 2\r
+     * fraction digits.\r
+     *\r
+     * <p>Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.\r
+     *\r
+     * <p>In negative patterns, the minimum and maximum counts are ignored; these are\r
+     * presumed to be set in the positive pattern.\r
+     *\r
+     * @stable ICU 2.0\r
+     */\r
+    public void applyLocalizedPattern(String pattern) {\r
+        ((java.text.DecimalFormat)numberFormat).applyLocalizedPattern(pattern);\r
+    }\r
+\r
+    /**\r
+     * Sets the maximum number of digits allowed in the integer portion of a number. This\r
+     * override limits the integer digit count to 309.\r
+     *\r
+     * @see NumberFormat#setMaximumIntegerDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMaximumIntegerDigits(int newValue) {\r
+        super.setMaximumIntegerDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * Sets the minimum number of digits allowed in the integer portion of a number. This\r
+     * override limits the integer digit count to 309.\r
+     *\r
+     * @see NumberFormat#setMinimumIntegerDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMinimumIntegerDigits(int newValue) {\r
+        super.setMinimumIntegerDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the minimum number of significant digits that will be\r
+     * displayed. This value has no effect unless {@link #areSignificantDigitsUsed()}\r
+     * returns true.\r
+     *\r
+     * @return the fewest significant digits that will be shown\r
+     * @stable ICU 3.0\r
+     */\r
+    public int getMinimumSignificantDigits() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the maximum number of significant digits that will be\r
+     * displayed. This value has no effect unless {@link #areSignificantDigitsUsed()}\r
+     * returns true.\r
+     *\r
+     * @return the most significant digits that will be shown\r
+     * @stable ICU 3.0\r
+     */\r
+    public int getMaximumSignificantDigits() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the minimum number of significant digits that will be displayed. If\r
+     * <code>min</code> is less than one then it is set to one. If the maximum significant\r
+     * digits count is less than <code>min</code>, then it is set to\r
+     * <code>min</code>. This value has no effect unless {@link #areSignificantDigitsUsed()}\r
+     * returns true.\r
+     *\r
+     * @param min the fewest significant digits to be shown\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setMinimumSignificantDigits(int min) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the maximum number of significant digits that will be displayed. If\r
+     * <code>max</code> is less than one then it is set to one. If the minimum significant\r
+     * digits count is greater than <code>max</code>, then it is set to\r
+     * <code>max</code>. This value has no effect unless {@link #areSignificantDigitsUsed()}\r
+     * returns true.\r
+     *\r
+     * @param max the most significant digits to be shown\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setMaximumSignificantDigits(int max) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns true if significant digits are in use or false if integer and\r
+     * fraction digit counts are in use.\r
+     *\r
+     * @return true if significant digits are in use\r
+     * @stable ICU 3.0\r
+     */\r
+    public boolean areSignificantDigitsUsed() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets whether significant digits are in use, or integer and fraction digit\r
+     * counts are in use.\r
+     *\r
+     * @param useSignificantDigits true to use significant digits, or false to use integer\r
+     * and fraction digit counts\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setSignificantDigitsUsed(boolean useSignificantDigits) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Sets the <tt>Currency</tt> object used to display currency amounts. This takes\r
+     * effect immediately, if this format is a currency format. If this format is not a\r
+     * currency format, then the currency object is used if and when this object becomes a\r
+     * currency format through the application of a new pattern.\r
+     *\r
+     * @param theCurrency new currency object to use. Must not be null.\r
+     * @stable ICU 2.2\r
+     */\r
+    public void setCurrency(Currency theCurrency) {\r
+        super.setCurrency(theCurrency);\r
+    }\r
+\r
+    /**\r
+     * Sets the maximum number of digits allowed in the fraction portion of a number. This\r
+     * override limits the fraction digit count to 340.\r
+     *\r
+     * @see NumberFormat#setMaximumFractionDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMaximumFractionDigits(int newValue) {\r
+        super.setMaximumFractionDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * Sets the minimum number of digits allowed in the fraction portion of a number. This\r
+     * override limits the fraction digit count to 340.\r
+     *\r
+     * @see NumberFormat#setMinimumFractionDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMinimumFractionDigits(int newValue) {\r
+        super.setMinimumFractionDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * Sets whether {@link #parse(String, ParsePosition)} returns BigDecimal. The\r
+     * default value is false.\r
+     *\r
+     * @param value true if {@link #parse(String, ParsePosition)}\r
+     * returns BigDecimal.\r
+     * @stable ICU 3.6\r
+     */\r
+    public void setParseBigDecimal(boolean value) {\r
+        ((java.text.DecimalFormat)numberFormat).setParseBigDecimal(value);\r
+    }\r
+\r
+    /**\r
+     * Returns whether {@link #parse(String, ParsePosition)} returns BigDecimal.\r
+     *\r
+     * @return true if {@link #parse(String, ParsePosition)} returns BigDecimal.\r
+     * @stable ICU 3.6\r
+     */\r
+    public boolean isParseBigDecimal() {\r
+        return ((java.text.DecimalFormat)numberFormat).isParseBigDecimal();\r
+    }\r
+\r
+    // ----------------------------------------------------------------------\r
+    // CONSTANTS\r
+    // ----------------------------------------------------------------------\r
+\r
+    /**\r
+     * {@icu} Constant for {@link #getPadPosition()} and {@link #setPadPosition(int)} to\r
+     * specify pad characters inserted before the prefix.\r
+     *\r
+     * @see #setPadPosition\r
+     * @see #getPadPosition\r
+     * @see #PAD_AFTER_PREFIX\r
+     * @see #PAD_BEFORE_SUFFIX\r
+     * @see #PAD_AFTER_SUFFIX\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int PAD_BEFORE_PREFIX = 0;\r
+\r
+    /**\r
+     * {@icu} Constant for {@link #getPadPosition()} and {@link #setPadPosition(int)} to\r
+     * specify pad characters inserted after the prefix.\r
+     *\r
+     * @see #setPadPosition\r
+     * @see #getPadPosition\r
+     * @see #PAD_BEFORE_PREFIX\r
+     * @see #PAD_BEFORE_SUFFIX\r
+     * @see #PAD_AFTER_SUFFIX\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int PAD_AFTER_PREFIX = 1;\r
+\r
+    /**\r
+     * {@icu} Constant for {@link #getPadPosition()} and {@link #setPadPosition(int)} to\r
+     * specify pad characters inserted before the suffix.\r
+     *\r
+     * @see #setPadPosition\r
+     * @see #getPadPosition\r
+     * @see #PAD_BEFORE_PREFIX\r
+     * @see #PAD_AFTER_PREFIX\r
+     * @see #PAD_AFTER_SUFFIX\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int PAD_BEFORE_SUFFIX = 2;\r
+\r
+    /**\r
+     * {@icu} Constant for {@link #getPadPosition()} and {@link #setPadPosition(int)} to\r
+     * specify pad characters inserted after the suffix.\r
+     *\r
+     * @see #setPadPosition\r
+     * @see #getPadPosition\r
+     * @see #PAD_BEFORE_PREFIX\r
+     * @see #PAD_AFTER_PREFIX\r
+     * @see #PAD_BEFORE_SUFFIX\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int PAD_AFTER_SUFFIX = 3;\r
+}\r
+\r
+// eof\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormatSymbols.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/DecimalFormatSymbols.java
new file mode 100644 (file)
index 0000000..9436fa6
--- /dev/null
@@ -0,0 +1,350 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.text;\r
+\r
+\r
+import java.io.Serializable;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.util.ULocale;\r
+\r
+/**\r
+ * This class represents the set of symbols (such as the decimal separator, the\r
+ * grouping separator, and so on) needed by <code>DecimalFormat</code> to format\r
+ * numbers. <code>DecimalFormat</code> creates for itself an instance of\r
+ * <code>DecimalFormatSymbols</code> from its locale data.  If you need to\r
+ * change any of these symbols, you can get the\r
+ * <code>DecimalFormatSymbols</code> object from your <code>DecimalFormat</code>\r
+ * and modify it.\r
+ *\r
+ * <p><strong>This is an enhanced version of <code>DecimalFormatSymbols</code> that\r
+ * is based on the standard version in the JDK.  New or changed functionality\r
+ * is labeled\r
+ * <strong><font face=helvetica color=red>NEW</font></strong>.</strong>\r
+ *\r
+ * @see          java.util.Locale\r
+ * @see          DecimalFormat\r
+ * @author       Mark Davis\r
+ * @author       Alan Liu\r
+ * @stable ICU 2.0\r
+ */\r
+final public class DecimalFormatSymbols implements Cloneable, Serializable {\r
+\r
+    private static final long serialVersionUID =1L;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    public final java.text.DecimalFormatSymbols dfs;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    public DecimalFormatSymbols(java.text.DecimalFormatSymbols delegate) {\r
+        this.dfs = delegate;\r
+    }\r
+        \r
+    /**\r
+     * Create a DecimalFormatSymbols object for the default locale.\r
+     * @stable ICU 2.0\r
+     */\r
+    public DecimalFormatSymbols() {\r
+        this(new java.text.DecimalFormatSymbols());\r
+    }\r
+        \r
+    /**\r
+     * Create a DecimalFormatSymbols object for the given locale.\r
+     * @param locale the locale\r
+     * @stable ICU 2.0\r
+     */\r
+    public DecimalFormatSymbols(Locale locale) {\r
+        this(new java.text.DecimalFormatSymbols(locale));\r
+    }\r
+        \r
+    /**\r
+     * Create a DecimalFormatSymbols object for the given locale.\r
+     * @param locale the locale\r
+     * @stable ICU 3.2\r
+     */\r
+    public DecimalFormatSymbols(ULocale locale) {\r
+        this(new java.text.DecimalFormatSymbols(locale.toLocale()));\r
+    }\r
+        \r
+    /**\r
+     * Return the character used for zero. Different for Arabic, etc.\r
+     * @return the character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getZeroDigit() {\r
+        return dfs.getZeroDigit();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used for zero.\r
+     * @param zeroDigit the zero character.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setZeroDigit(char zeroDigit) {\r
+        dfs.setZeroDigit(zeroDigit);\r
+    }\r
+        \r
+    /**\r
+     * Return the character used for thousands separator. Different for French, etc.\r
+     * @return the thousands character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getGroupingSeparator() {\r
+        return dfs.getGroupingSeparator();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used for thousands separator. Different for French, etc.\r
+     * @param groupingSeparator the thousands character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setGroupingSeparator(char groupingSeparator) {\r
+        dfs.setGroupingSeparator(groupingSeparator);\r
+    }\r
+        \r
+    /**\r
+     * Return the character used for decimal sign. Different for French, etc.\r
+     * @return the decimal character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getDecimalSeparator() {\r
+        return dfs.getDecimalSeparator();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used for decimal sign. Different for French, etc.\r
+     * @param decimalSeparator the decimal character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setDecimalSeparator(char decimalSeparator) {\r
+        dfs.setDecimalSeparator(decimalSeparator);\r
+    }\r
+        \r
+    /**\r
+     * Return the character used for mille percent sign. Different for Arabic, etc.\r
+     * @return the mille percent character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getPerMill() {\r
+        return dfs.getPerMill();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used for mille percent sign. Different for Arabic, etc.\r
+     * @param perMill the mille percent character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setPerMill(char perMill) {\r
+        dfs.setPerMill(perMill);\r
+    }\r
+        \r
+    /**\r
+     * Return the character used for percent sign. Different for Arabic, etc.\r
+     * @return the percent character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getPercent() {\r
+        return dfs.getPercent();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used for percent sign. Different for Arabic, etc.\r
+     * @param percent the percent character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setPercent(char percent) {\r
+        dfs.setPercent(percent);\r
+    }\r
+        \r
+    /**\r
+     * Return the character used for a digit in a pattern.\r
+     * @return the digit pattern character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getDigit() {\r
+        return dfs.getDigit();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used for a digit in a pattern.\r
+     * @param digit the digit pattern character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setDigit(char digit) {\r
+        dfs.setDigit(digit);\r
+    }\r
+        \r
+    /**\r
+     * Return the character used to separate positive and negative subpatterns\r
+     * in a pattern.\r
+     * @return the pattern separator character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getPatternSeparator() {\r
+        return dfs.getPatternSeparator();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used to separate positive and negative subpatterns\r
+     * in a pattern.\r
+     * @param patternSeparator the pattern separator character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setPatternSeparator(char patternSeparator) {\r
+        dfs.setPatternSeparator(patternSeparator);\r
+    }\r
+        \r
+    /**\r
+     * Return the String used to represent infinity. Almost always left\r
+     * unchanged.\r
+     * @return the Infinity string\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getInfinity() {\r
+        return dfs.getInfinity();\r
+    }\r
+        \r
+    /**\r
+     * Set the String used to represent infinity. Almost always left\r
+     * unchanged.\r
+     * @param infinity the Infinity String\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setInfinity(String infinity) {\r
+        dfs.setInfinity(infinity);\r
+    }\r
+        \r
+    /**\r
+     * Return the String used to represent NaN. Almost always left\r
+     * unchanged.\r
+     * @return the NaN String\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getNaN() {\r
+        return dfs.getNaN();\r
+    }\r
+        \r
+    /**\r
+     * Set the String used to represent NaN. Almost always left\r
+     * unchanged.\r
+     * @param NaN the NaN String\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setNaN(String NaN) {\r
+        dfs.setNaN(NaN);\r
+    }\r
+        \r
+    /**\r
+     * Return the character used to represent minus sign. If no explicit\r
+     * negative format is specified, one is formed by prefixing\r
+     * minusSign to the positive format.\r
+     * @return the minus sign character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getMinusSign() {\r
+        return dfs.getMinusSign();\r
+    }\r
+        \r
+    /**\r
+     * Set the character used to represent minus sign. If no explicit\r
+     * negative format is specified, one is formed by prefixing\r
+     * minusSign to the positive format.\r
+     * @param minusSign the minus sign character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMinusSign(char minusSign) {\r
+        dfs.setMinusSign(minusSign);\r
+    }\r
+        \r
+    /**\r
+     * Return the string denoting the local currency.\r
+     * @return the local currency String.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getCurrencySymbol() {\r
+        return dfs.getCurrencySymbol();\r
+    }\r
+        \r
+    /**\r
+     * Set the string denoting the local currency.\r
+     * @param currency the local currency String.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setCurrencySymbol(String currency) {\r
+        dfs.setCurrencySymbol(currency);\r
+    }\r
+        \r
+    /**\r
+     * Return the international string denoting the local currency.\r
+     * @return the international string denoting the local currency\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getInternationalCurrencySymbol() {\r
+        return dfs.getInternationalCurrencySymbol();\r
+    }\r
+        \r
+    /**\r
+     * Set the international string denoting the local currency.\r
+     * @param currency the international string denoting the local currency.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setInternationalCurrencySymbol(String currency) {\r
+        dfs.setInternationalCurrencySymbol(currency);\r
+    }\r
+        \r
+    /**\r
+     * Return the monetary decimal separator.\r
+     * @return the monetary decimal separator character\r
+     * @stable ICU 2.0\r
+     */\r
+    public char getMonetaryDecimalSeparator() {\r
+        return dfs.getMonetaryDecimalSeparator();\r
+    }\r
+        \r
+    /**\r
+     * Set the monetary decimal separator.\r
+     * @param sep the monetary decimal separator character\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMonetaryDecimalSeparator(char sep) {\r
+        dfs.setMonetaryDecimalSeparator(sep);\r
+    }\r
+        \r
+    /**\r
+     * Standard override.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone() {\r
+        return new DecimalFormatSymbols((java.text.DecimalFormatSymbols)dfs.clone());\r
+    }\r
+        \r
+    /**\r
+     * Override equals.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean equals(Object obj) {\r
+        try {\r
+            return dfs.equals(((DecimalFormatSymbols)obj).dfs);\r
+        }\r
+        catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+        \r
+    /**\r
+     * Override hashCode\r
+     * @stable ICU 2.0\r
+     */\r
+    public int hashCode() {\r
+        return dfs.hashCode();\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/MessageFormat.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/MessageFormat.java
new file mode 100644 (file)
index 0000000..91bec49
--- /dev/null
@@ -0,0 +1,1415 @@
+/*\r
+**********************************************************************\r
+* Copyright (c) 2004-2011, International Business Machines\r
+* Corporation and others.  All Rights Reserved.\r
+**********************************************************************\r
+* Author: Alan Liu\r
+* Created: April 6, 2004\r
+* Since: ICU 3.0\r
+**********************************************************************\r
+*/\r
+package com.ibm.icu.text;\r
+\r
+import java.io.InvalidObjectException;\r
+import java.text.AttributedCharacterIterator;\r
+import java.text.AttributedCharacterIterator.Attribute;\r
+import java.text.AttributedString;\r
+import java.text.CharacterIterator;\r
+import java.text.ChoiceFormat;\r
+import java.text.FieldPosition;\r
+import java.text.Format;\r
+import java.text.ParseException;\r
+import java.text.ParsePosition;\r
+import java.util.Locale;\r
+import java.util.Map;\r
+import java.util.Map.Entry;\r
+import java.util.Set;\r
+\r
+import com.ibm.icu.util.ULocale;\r
+\r
+/**\r
+ * {@icuenhanced java.text.MessageFormat}.{@icu _usage_}\r
+ *\r
+ * <p>MessageFormat produces concatenated messages in a language-neutral\r
+ * way. Use this whenever concatenating strings that are displayed to\r
+ * end users.\r
+ *\r
+ * <p>A MessageFormat contains an array of <em>subformats</em> arranged\r
+ * within a <em>template string</em>.  Together, the subformats and\r
+ * template string determine how the MessageFormat will operate during\r
+ * formatting and parsing.\r
+ *\r
+ * <p>Typically, both the subformats and the template string are\r
+ * specified at once in a <em>pattern</em>.  By using different\r
+ * patterns for different locales, messages may be localized.\r
+ *\r
+ * <p>When formatting, MessageFormat takes a collection of arguments\r
+ * and produces a user-readable string.  The arguments may be passed\r
+ * as an array or as a Map.  Each argument is matched up with its\r
+ * corresponding subformat, which then formats it into a string.  The\r
+ * resulting strings are then assembled within the string template of\r
+ * the MessageFormat to produce the final output string.\r
+ *\r
+ * <p><strong>Note:</strong>\r
+ * <code>MessageFormat</code> differs from the other <code>Format</code>\r
+ * classes in that you create a <code>MessageFormat</code> object with one\r
+ * of its constructors (not with a <code>getInstance</code> style factory\r
+ * method). The factory methods aren't necessary because <code>MessageFormat</code>\r
+ * itself doesn't implement locale-specific behavior. Any locale-specific\r
+ * behavior is defined by the pattern that you provide and the\r
+ * subformats used for inserted arguments.\r
+ *\r
+ * <p><strong>Note:</strong>\r
+ * In ICU 3.8 MessageFormat supports named arguments.  If a named argument\r
+ * is used, all arguments must be named.  Names start with a character in\r
+ * <code>:ID_START:</code> and continue with characters in <code>:ID_CONTINUE:</code>,\r
+ * in particular they do not start with a digit.  If named arguments\r
+ * are used, {@link #usesNamedArguments()} will return true.\r
+ *\r
+ * <p>The other new methods supporting named arguments are\r
+ * {@link #setFormatsByArgumentName(Map)},\r
+ * {@link #setFormatByArgumentName(String, Format)},\r
+ * {@link #format(Map, StringBuffer, FieldPosition)},\r
+ * {@link #format(String, Map)}, {@link #parseToMap(String, ParsePosition)},\r
+ * and {@link #parseToMap(String)}.  These methods are all compatible\r
+ * with patterns that do not used named arguments-- in these cases\r
+ * the keys in the input or output <code>Map</code>s use\r
+ * <code>String</code>s that name the argument indices, e.g. "0",\r
+ * "1", "2"... etc.\r
+ *\r
+ * <p>When named arguments are used, certain methods on MessageFormat that take or\r
+ * return arrays will throw an exception, since it is not possible to\r
+ * identify positions in an array using a name.  These methods are\r
+ * {@link #setFormatsByArgumentIndex(Format[])},\r
+ * {@link #setFormatByArgumentIndex(int, Format)},\r
+ * {@link #getFormatsByArgumentIndex()},\r
+ * {@link #getFormats()},\r
+ * {@link #format(Object[], StringBuffer, FieldPosition)},\r
+ * {@link #format(String, Object[])},\r
+ * {@link #parse(String, ParsePosition)}, and\r
+ * {@link #parse(String)}.\r
+ * These APIs all have corresponding new versions as listed above.\r
+ *\r
+ * <p>The API {@link #format(Object, StringBuffer, FieldPosition)} has\r
+ * been modified so that the <code>Object</code> argument can be\r
+ * either an <code>Object</code> array or a <code>Map</code>.  If this\r
+ * format uses named arguments, this argument must not be an\r
+ * <code>Object</code> array otherwise an exception will be thrown.\r
+ * If the argument is a <code>Map</code> it can be used with Strings that\r
+ * represent indices as described above.\r
+ *\r
+ * <h4><a name="patterns">Patterns and Their Interpretation</a></h4>\r
+ *\r
+ * <code>MessageFormat</code> uses patterns of the following form:\r
+ * <blockquote><pre>\r
+ * <i>MessageFormatPattern:</i>\r
+ *         <i>String</i>\r
+ *         <i>MessageFormatPattern</i> <i>FormatElement</i> <i>String</i>\r
+ *\r
+ * <i>FormatElement:</i>\r
+ *         { <i>ArgumentIndexOrName</i> }\r
+ *         { <i>ArgumentIndexOrName</i> , <i>FormatType</i> }\r
+ *         { <i>ArgumentIndexOrName</i> , <i>FormatType</i> , <i>FormatStyle</i> }\r
+ *\r
+ * <i>ArgumentIndexOrName: one of </i>\r
+ *         ['0'-'9']+\r
+ *         [:ID_START:][:ID_CONTINUE:]*\r
+ *\r
+ * <i>FormatType: one of </i>\r
+ *         number date time choice spellout ordinal duration plural\r
+ *\r
+ * <i>FormatStyle:</i>\r
+ *         short\r
+ *         medium\r
+ *         long\r
+ *         full\r
+ *         integer\r
+ *         currency\r
+ *         percent\r
+ *         <i>SubformatPattern</i>\r
+ *         <i>RulesetName</i>\r
+ *\r
+ * <i>String:</i>\r
+ *         <i>StringPart<sub>opt</sub></i>\r
+ *         <i>String</i> <i>StringPart</i>\r
+ *\r
+ * <i>StringPart:</i>\r
+ *         ''\r
+ *         ' <i>QuotedString</i> '\r
+ *         <i>UnquotedString</i>\r
+ *\r
+ * <i>SubformatPattern:</i>\r
+ *         <i>SubformatPatternPart<sub>opt</sub></i>\r
+ *         <i>SubformatPattern</i> <i>SubformatPatternPart</i>\r
+ *\r
+ * <i>SubFormatPatternPart:</i>\r
+ *         ' <i>QuotedPattern</i> '\r
+ *         <i>UnquotedPattern</i>\r
+ * </pre></blockquote>\r
+ *\r
+ * <i>RulesetName:</i>\r
+ *         <i>UnquotedString</i>\r
+ *\r
+ * <p>Within a <i>String</i>, <code>"''"</code> represents a single\r
+ * quote. A <i>QuotedString</i> can contain arbitrary characters\r
+ * except single quotes; the surrounding single quotes are removed.\r
+ * An <i>UnquotedString</i> can contain arbitrary characters\r
+ * except single quotes and left curly brackets. Thus, a string that\r
+ * should result in the formatted message "'{0}'" can be written as\r
+ * <code>"'''{'0}''"</code> or <code>"'''{0}'''"</code>.\r
+ *\r
+ * <p>Within a <i>SubformatPattern</i>, different rules apply.\r
+ * A <i>QuotedPattern</i> can contain arbitrary characters\r
+ * except single quotes; but the surrounding single quotes are\r
+ * <strong>not</strong> removed, so they may be interpreted by the\r
+ * subformat. For example, <code>"{1,number,$'#',##}"</code> will\r
+ * produce a number format with the pound-sign quoted, with a result\r
+ * such as: "$#31,45".\r
+ * An <i>UnquotedPattern</i> can contain arbitrary characters\r
+ * except single quotes, but curly braces within it must be balanced.\r
+ * For example, <code>"ab {0} de"</code> and <code>"ab '}' de"</code>\r
+ * are valid subformat patterns, but <code>"ab {0'}' de"</code> and\r
+ * <code>"ab } de"</code> are not.\r
+ *\r
+ * <p><dl><dt><b>Warning:</b><dd>The rules for using quotes within message\r
+ * format patterns unfortunately have shown to be somewhat confusing.\r
+ * In particular, it isn't always obvious to localizers whether single\r
+ * quotes need to be doubled or not. Make sure to inform localizers about\r
+ * the rules, and tell them (for example, by using comments in resource\r
+ * bundle source files) which strings will be processed by MessageFormat.\r
+ * Note that localizers may need to use single quotes in translated\r
+ * strings where the original version doesn't have them.\r
+ *\r
+ * <br>Note also that the simplest way to avoid the problem is to\r
+ * use the real apostrophe (single quote) character \u2019 (') for\r
+ * human-readable text, and to use the ASCII apostrophe (\u0027 ' )\r
+ * only in program syntax, like quoting in MessageFormat.\r
+ * See the annotations for U+0027 Apostrophe in The Unicode Standard.</p>\r
+ * </dl>\r
+ *\r
+ * <p>The <i>ArgumentIndex</i> value is a non-negative integer written\r
+ * using the digits '0' through '9', and represents an index into the\r
+ * <code>arguments</code> array passed to the <code>format</code> methods\r
+ * or the result array returned by the <code>parse</code> methods.\r
+ *\r
+ * <p>The <i>FormatType</i> and <i>FormatStyle</i> values are used to create\r
+ * a <code>Format</code> instance for the format element. The following\r
+ * table shows how the values map to Format instances. Combinations not\r
+ * shown in the table are illegal. A <i>SubformatPattern</i> must\r
+ * be a valid pattern string for the Format subclass used.\r
+ *\r
+ * <p><table border=1>\r
+ *    <tr>\r
+ *       <th>Format Type\r
+ *       <th>Format Style\r
+ *       <th>Subformat Created\r
+ *    <tr>\r
+ *       <td colspan=2><i>(none)</i>\r
+ *       <td><code>null</code>\r
+ *    <tr>\r
+ *       <td rowspan=5><code>number</code>\r
+ *       <td><i>(none)</i>\r
+ *       <td><code>NumberFormat.getInstance(getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>integer</code>\r
+ *       <td><code>NumberFormat.getIntegerInstance(getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>currency</code>\r
+ *       <td><code>NumberFormat.getCurrencyInstance(getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>percent</code>\r
+ *       <td><code>NumberFormat.getPercentInstance(getLocale())</code>\r
+ *    <tr>\r
+ *       <td><i>SubformatPattern</i>\r
+ *       <td><code>new DecimalFormat(subformatPattern, new DecimalFormatSymbols(getLocale()))</code>\r
+ *    <tr>\r
+ *       <td rowspan=6><code>date</code>\r
+ *       <td><i>(none)</i>\r
+ *       <td><code>DateFormat.getDateInstance(DateFormat.DEFAULT, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>short</code>\r
+ *       <td><code>DateFormat.getDateInstance(DateFormat.SHORT, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>medium</code>\r
+ *       <td><code>DateFormat.getDateInstance(DateFormat.DEFAULT, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>long</code>\r
+ *       <td><code>DateFormat.getDateInstance(DateFormat.LONG, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>full</code>\r
+ *       <td><code>DateFormat.getDateInstance(DateFormat.FULL, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><i>SubformatPattern</i>\r
+ *       <td><code>new SimpleDateFormat(subformatPattern, getLocale())\r
+ *    <tr>\r
+ *       <td rowspan=6><code>time</code>\r
+ *       <td><i>(none)</i>\r
+ *       <td><code>DateFormat.getTimeInstance(DateFormat.DEFAULT, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>short</code>\r
+ *       <td><code>DateFormat.getTimeInstance(DateFormat.SHORT, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>medium</code>\r
+ *       <td><code>DateFormat.getTimeInstance(DateFormat.DEFAULT, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>long</code>\r
+ *       <td><code>DateFormat.getTimeInstance(DateFormat.LONG, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><code>full</code>\r
+ *       <td><code>DateFormat.getTimeInstance(DateFormat.FULL, getLocale())</code>\r
+ *    <tr>\r
+ *       <td><i>SubformatPattern</i>\r
+ *       <td><code>new SimpleDateFormat(subformatPattern, getLocale())\r
+ *    <tr>\r
+ *       <td><code>choice</code>\r
+ *       <td><i>SubformatPattern</i>\r
+ *       <td><code>new ChoiceFormat(subformatPattern)</code>\r
+ *    <tr>\r
+ *       <td><code>spellout</code>\r
+ *       <td><i>RulesetName (optional)</i>\r
+ *       <td><code>new RuleBasedNumberFormat(getLocale(), RuleBasedNumberFormat.SPELLOUT)\r
+ *           <br/>&nbsp;&nbsp;&nbsp;&nbsp;.setDefaultRuleset(ruleset);</code>\r
+ *    <tr>\r
+ *       <td><code>ordinal</code>\r
+ *       <td><i>RulesetName (optional)</i>\r
+ *       <td><code>new RuleBasedNumberFormat(getLocale(), RuleBasedNumberFormat.ORDINAL)\r
+ *           <br/>&nbsp;&nbsp;&nbsp;&nbsp;.setDefaultRuleset(ruleset);</code>\r
+ *    <tr>\r
+ *       <td><code>duration</code>\r
+ *       <td><i>RulesetName (optional)</i>\r
+ *       <td><code>new RuleBasedNumberFormat(getLocale(), RuleBasedNumberFormat.DURATION)\r
+ *           <br/>&nbsp;&nbsp;&nbsp;&nbsp;.setDefaultRuleset(ruleset);</code>\r
+ *    <tr>\r
+ *       <td><code>plural</code>\r
+ *       <td><i>SubformatPattern</i>\r
+ *       <td><code>new PluralFormat(subformatPattern)</code>\r
+ *    <tr>\r
+ *       <td><code>select</code>\r
+ *       <td><i>SubformatPattern</i>\r
+ *       <td><code>new SelectFormat(subformatPattern)</code>\r
+ * </table>\r
+ * <p>\r
+ *\r
+ * <h4>Usage Information</h4>\r
+ *\r
+ * <p>Here are some examples of usage:\r
+ * <blockquote>\r
+ * <pre>\r
+ * Object[] arguments = {\r
+ *     new Integer(7),\r
+ *     new Date(System.currentTimeMillis()),\r
+ *     "a disturbance in the Force"\r
+ * };\r
+ *\r
+ * String result = MessageFormat.format(\r
+ *     "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}.",\r
+ *     arguments);\r
+ *\r
+ * <em>output</em>: At 12:30 PM on Jul 3, 2053, there was a disturbance\r
+ *           in the Force on planet 7.\r
+ *\r
+ * </pre>\r
+ * </blockquote>\r
+ * Typically, the message format will come from resources, and the\r
+ * arguments will be dynamically set at runtime.\r
+ *\r
+ * <p>Example 2:\r
+ * <blockquote>\r
+ * <pre>\r
+ * Object[] testArgs = {new Long(3), "MyDisk"};\r
+ *\r
+ * MessageFormat form = new MessageFormat(\r
+ *     "The disk \"{1}\" contains {0} file(s).");\r
+ *\r
+ * System.out.println(form.format(testArgs));\r
+ *\r
+ * // output, with different testArgs\r
+ * <em>output</em>: The disk "MyDisk" contains 0 file(s).\r
+ * <em>output</em>: The disk "MyDisk" contains 1 file(s).\r
+ * <em>output</em>: The disk "MyDisk" contains 1,273 file(s).\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * <p>For more sophisticated patterns, you can use a <code>ChoiceFormat</code> to get\r
+ * output such as:\r
+ * <blockquote>\r
+ * <pre>\r
+ * MessageFormat form = new MessageFormat("The disk \"{1}\" contains {0}.");\r
+ * double[] filelimits = {0,1,2};\r
+ * String[] filepart = {"no files","one file","{0,number} files"};\r
+ * ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);\r
+ * form.setFormatByArgumentIndex(0, fileform);\r
+ *\r
+ * Object[] testArgs = {new Long(12373), "MyDisk"};\r
+ *\r
+ * System.out.println(form.format(testArgs));\r
+ *\r
+ * // output, with different testArgs\r
+ * output: The disk "MyDisk" contains no files.\r
+ * output: The disk "MyDisk" contains one file.\r
+ * output: The disk "MyDisk" contains 1,273 files.\r
+ * </pre>\r
+ * </blockquote>\r
+ * You can either do this programmatically, as in the above example,\r
+ * or by using a pattern (see\r
+ * {@link ChoiceFormat}\r
+ * for more information) as in:\r
+ * <blockquote>\r
+ * <pre>\r
+ * form.applyPattern(\r
+ *    "There {0,choice,0#are no files|1#is one file|1&lt;are {0,number,integer} files}.");\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * <p><strong>Note:</strong> As we see above, the string produced\r
+ * by a <code>ChoiceFormat</code> in <code>MessageFormat</code> is treated specially;\r
+ * occurances of '{' are used to indicated subformats, and cause recursion.\r
+ * If you create both a <code>MessageFormat</code> and <code>ChoiceFormat</code>\r
+ * programmatically (instead of using the string patterns), then be careful not to\r
+ * produce a format that recurses on itself, which will cause an infinite loop.\r
+ *\r
+ * <p>When a single argument is parsed more than once in the string, the last match\r
+ * will be the final result of the parsing.  For example,\r
+ * <pre>\r
+ * MessageFormat mf = new MessageFormat("{0,number,#.##}, {0,number,#.#}");\r
+ * Object[] objs = {new Double(3.1415)};\r
+ * String result = mf.format( objs );\r
+ * // result now equals "3.14, 3.1"\r
+ * objs = null;\r
+ * objs = mf.parse(result, new ParsePosition(0));\r
+ * // objs now equals {new Double(3.1)}\r
+ * </pre>\r
+ *\r
+ * <p>Likewise, parsing with a MessageFormat object using patterns containing\r
+ * multiple occurances of the same argument would return the last match.  For\r
+ * example,\r
+ * <pre>\r
+ * MessageFormat mf = new MessageFormat("{0}, {0}, {0}");\r
+ * String forParsing = "x, y, z";\r
+ * Object[] objs = mf.parse(forParsing, new ParsePosition(0));\r
+ * // result now equals {new String("z")}\r
+ * </pre>\r
+ *\r
+ * <h4><a name="synchronization">Synchronization</a></h4>\r
+ *\r
+ * <p>Message formats are not synchronized.\r
+ * It is recommended to create separate format instances for each thread.\r
+ * If multiple threads access a format concurrently, it must be synchronized\r
+ * externally.\r
+ *\r
+ * @see          java.util.Locale\r
+ * @see          Format\r
+ * @see          NumberFormat\r
+ * @see          DecimalFormat\r
+ * @see          ChoiceFormat\r
+ * @see          PluralFormat\r
+ * @see          SelectFormat\r
+ * @author       Mark Davis\r
+ * @stable ICU 3.0\r
+ */\r
+public class MessageFormat extends UFormat {\r
+    static final long serialVersionUID = 1L;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    public final java.text.MessageFormat messageFormat;\r
+        \r
+    /**\r
+     * @internal\r
+     * @param delegate the DateFormat to which to delegate\r
+     */\r
+    public MessageFormat(java.text.MessageFormat delegate) {\r
+        wrapNestedFormatters(delegate);\r
+        this.messageFormat = delegate;\r
+    }\r
+\r
+    /**\r
+     * Constructs a MessageFormat for the default locale and the\r
+     * specified pattern.\r
+     * The constructor first sets the locale, then parses the pattern and\r
+     * creates a list of subformats for the format elements contained in it.\r
+     * Patterns and their interpretation are specified in the\r
+     * <a href="#patterns">class description</a>.\r
+     *\r
+     * @param pattern the pattern for this message format\r
+     * @exception IllegalArgumentException if the pattern is invalid\r
+     * @stable ICU 3.0\r
+     */\r
+    public MessageFormat(String pattern) {\r
+        this(new java.text.MessageFormat(pattern));\r
+    }\r
+\r
+    /**\r
+     * Constructs a MessageFormat for the specified locale and\r
+     * pattern.\r
+     * The constructor first sets the locale, then parses the pattern and\r
+     * creates a list of subformats for the format elements contained in it.\r
+     * Patterns and their interpretation are specified in the\r
+     * <a href="#patterns">class description</a>.\r
+     *\r
+     * @param pattern the pattern for this message format\r
+     * @param locale the locale for this message format\r
+     * @exception IllegalArgumentException if the pattern is invalid\r
+     * @stable ICU 3.0\r
+     */\r
+    public MessageFormat(String pattern, Locale locale) {\r
+        this(new java.text.MessageFormat(pattern, locale));\r
+    }\r
+\r
+    /**\r
+     * Constructs a MessageFormat for the specified locale and\r
+     * pattern.\r
+     * The constructor first sets the locale, then parses the pattern and\r
+     * creates a list of subformats for the format elements contained in it.\r
+     * Patterns and their interpretation are specified in the\r
+     * <a href="#patterns">class description</a>.\r
+     *\r
+     * @param pattern the pattern for this message format\r
+     * @param locale the locale for this message format\r
+     * @exception IllegalArgumentException if the pattern is invalid\r
+     * @stable ICU 3.2\r
+     */\r
+    public MessageFormat(String pattern, ULocale locale) {\r
+        this(new java.text.MessageFormat(pattern, locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Sets the locale to be used when creating or comparing subformats.\r
+     * This affects subsequent calls to the {@link #applyPattern applyPattern}\r
+     * and {@link #toPattern toPattern} methods as well as to the\r
+     * <code>format</code> and\r
+     * {@link #formatToCharacterIterator formatToCharacterIterator} methods.\r
+     *\r
+     * @param locale the locale to be used when creating or comparing subformats\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setLocale(Locale locale) {\r
+        messageFormat.setLocale(locale);\r
+    }\r
+\r
+    /**\r
+     * Sets the locale to be used when creating or comparing subformats.\r
+     * This affects subsequent calls to the {@link #applyPattern applyPattern}\r
+     * and {@link #toPattern toPattern} methods as well as to the\r
+     * <code>format</code> and\r
+     * {@link #formatToCharacterIterator formatToCharacterIterator} methods.\r
+     *\r
+     * @param locale the locale to be used when creating or comparing subformats\r
+     * @stable ICU 3.2\r
+     */\r
+    public void setLocale(ULocale locale) {\r
+        messageFormat.setLocale(locale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * Returns the locale that's used when creating or comparing subformats.\r
+     *\r
+     * @return the locale used when creating or comparing subformats\r
+     * @stable ICU 3.0\r
+     */\r
+    public Locale getLocale() {\r
+        return messageFormat.getLocale();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the locale that's used when creating or comparing subformats.\r
+     *\r
+     * @return the locale used when creating or comparing subformats\r
+     * @stable ICU 3.2\r
+     */\r
+    public ULocale getULocale() {\r
+        return ULocale.forLocale(messageFormat.getLocale());\r
+    }\r
+\r
+    /**\r
+     * Sets the pattern used by this message format.\r
+     * The method parses the pattern and creates a list of subformats\r
+     * for the format elements contained in it.\r
+     * Patterns and their interpretation are specified in the\r
+     * <a href="#patterns">class description</a>.\r
+     * <p>\r
+     * The pattern must contain only named or only numeric arguments,\r
+     * mixing them is not allowed.\r
+     *\r
+     * @param pttrn the pattern for this message format\r
+     * @throws IllegalArgumentException if the pattern is invalid\r
+     * @stable ICU 3.0\r
+     */\r
+    public void applyPattern(String pttrn) {\r
+        messageFormat.applyPattern(pttrn);\r
+        wrapNestedFormatters(messageFormat);\r
+    }\r
+\r
+    /**\r
+     * Returns a pattern representing the current state of the message format.\r
+     * The string is constructed from internal information and therefore\r
+     * does not necessarily equal the previously applied pattern.\r
+     *\r
+     * @return a pattern representing the current state of the message format\r
+     * @stable ICU 3.0\r
+     */\r
+    public String toPattern() {\r
+        String pattern = savedPattern == null ? messageFormat.toPattern() : savedPattern;\r
+        return pattern;\r
+    }\r
+\r
+    /**\r
+     * Sets the formats to use for the values passed into\r
+     * <code>format</code> methods or returned from <code>parse</code>\r
+     * methods. The indices of elements in <code>newFormats</code>\r
+     * correspond to the argument indices used in the previously set\r
+     * pattern string.\r
+     * The order of formats in <code>newFormats</code> thus corresponds to\r
+     * the order of elements in the <code>arguments</code> array passed\r
+     * to the <code>format</code> methods or the result array returned\r
+     * by the <code>parse</code> methods.\r
+     * <p>\r
+     * If an argument index is used for more than one format element\r
+     * in the pattern string, then the corresponding new format is used\r
+     * for all such format elements. If an argument index is not used\r
+     * for any format element in the pattern string, then the\r
+     * corresponding new format is ignored. If fewer formats are provided\r
+     * than needed, then only the formats for argument indices less\r
+     * than <code>newFormats.length</code> are replaced.\r
+     *\r
+     * This method is only supported if the format does not use\r
+     * named arguments, otherwise an IllegalArgumentException is thrown.\r
+     *\r
+     * @param newFormats the new formats to use\r
+     * @throws NullPointerException if <code>newFormats</code> is null\r
+     * @throws IllegalArgumentException if this formatter uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setFormatsByArgumentIndex(Format[] newFormats) {\r
+        messageFormat.setFormatsByArgumentIndex(newFormats);\r
+        savedPattern = null;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the formats to use for the values passed into\r
+     * <code>format</code> methods or returned from <code>parse</code>\r
+     * methods. The keys in <code>newFormats</code> are the argument\r
+     * names in the previously set pattern string, and the values\r
+     * are the formats.\r
+     * <p>\r
+     * Only argument names from the pattern string are considered.\r
+     * Extra keys in <code>newFormats</code> that do not correspond\r
+     * to an argument name are ignored.  Similarly, if there is no\r
+     * format in newFormats for an argument name, the formatter\r
+     * for that argument remains unchanged.\r
+     * <p>\r
+     * This may be called on formats that do not use named arguments.\r
+     * In this case the map will be queried for key Strings that\r
+     * represent argument indices, e.g. "0", "1", "2" etc.\r
+     *\r
+     * @param newFormats a map from String to Format providing new\r
+     *        formats for named arguments.\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setFormatsByArgumentName(Map<String, Format> newFormats) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Sets the formats to use for the format elements in the\r
+     * previously set pattern string.\r
+     * The order of formats in <code>newFormats</code> corresponds to\r
+     * the order of format elements in the pattern string.\r
+     * <p>\r
+     * If more formats are provided than needed by the pattern string,\r
+     * the remaining ones are ignored. If fewer formats are provided\r
+     * than needed, then only the first <code>newFormats.length</code>\r
+     * formats are replaced.\r
+     * <p>\r
+     * Since the order of format elements in a pattern string often\r
+     * changes during localization, it is generally better to use the\r
+     * {@link #setFormatsByArgumentIndex setFormatsByArgumentIndex}\r
+     * method, which assumes an order of formats corresponding to the\r
+     * order of elements in the <code>arguments</code> array passed to\r
+     * the <code>format</code> methods or the result array returned by\r
+     * the <code>parse</code> methods.\r
+     *\r
+     * @param newFormats the new formats to use\r
+     * @exception NullPointerException if <code>newFormats</code> is null\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setFormats(Format[] newFormats) {\r
+        messageFormat.setFormats(newFormats);\r
+        savedPattern = null;\r
+    }\r
+\r
+    /**\r
+     * Sets the format to use for the format elements within the\r
+     * previously set pattern string that use the given argument\r
+     * index.\r
+     * The argument index is part of the format element definition and\r
+     * represents an index into the <code>arguments</code> array passed\r
+     * to the <code>format</code> methods or the result array returned\r
+     * by the <code>parse</code> methods.\r
+     * <p>\r
+     * If the argument index is used for more than one format element\r
+     * in the pattern string, then the new format is used for all such\r
+     * format elements. If the argument index is not used for any format\r
+     * element in the pattern string, then the new format is ignored.\r
+     *\r
+     * This method is only supported when exclusively numbers are used for\r
+     * argument names. Otherwise an IllegalArgumentException is thrown.\r
+     *\r
+     * @param argumentIndex the argument index for which to use the new format\r
+     * @param newFormat the new format to use\r
+     * @throws IllegalArgumentException if this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) {\r
+        messageFormat.setFormatByArgumentIndex(argumentIndex, newFormat);\r
+        savedPattern = null;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the format to use for the format elements within the\r
+     * previously set pattern string that use the given argument\r
+     * name.\r
+     * <p>\r
+     * If the argument name is used for more than one format element\r
+     * in the pattern string, then the new format is used for all such\r
+     * format elements. If the argument name is not used for any format\r
+     * element in the pattern string, then the new format is ignored.\r
+     * <p>\r
+     * This API may be used on formats that do not use named arguments.\r
+     * In this case <code>argumentName</code> should be a String that names\r
+     * an argument index, e.g. "0", "1", "2"... etc.  If it does not name\r
+     * a valid index, the format will be ignored.  No error is thrown.\r
+     *\r
+     * @param argumentName the name of the argument to change\r
+     * @param newFormat the new format to use\r
+     * @stable ICU 3.8\r
+     */\r
+    public void setFormatByArgumentName(String argumentName, Format newFormat) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Sets the format to use for the format element with the given\r
+     * format element index within the previously set pattern string.\r
+     * The format element index is the zero-based number of the format\r
+     * element counting from the start of the pattern string.\r
+     * <p>\r
+     * Since the order of format elements in a pattern string often\r
+     * changes during localization, it is generally better to use the\r
+     * {@link #setFormatByArgumentIndex setFormatByArgumentIndex}\r
+     * method, which accesses format elements based on the argument\r
+     * index they specify.\r
+     *\r
+     * @param formatElementIndex the index of a format element within the pattern\r
+     * @param newFormat the format to use for the specified format element\r
+     * @exception ArrayIndexOutOfBoundsException if formatElementIndex is equal to or\r
+     *            larger than the number of format elements in the pattern string\r
+     * @stable ICU 3.0\r
+     */\r
+    public void setFormat(int formatElementIndex, Format newFormat) {\r
+        messageFormat.setFormat(formatElementIndex, newFormat);\r
+        savedPattern = null;\r
+    }\r
+\r
+    /**\r
+     * Returns the formats used for the values passed into\r
+     * <code>format</code> methods or returned from <code>parse</code>\r
+     * methods. The indices of elements in the returned array\r
+     * correspond to the argument indices used in the previously set\r
+     * pattern string.\r
+     * The order of formats in the returned array thus corresponds to\r
+     * the order of elements in the <code>arguments</code> array passed\r
+     * to the <code>format</code> methods or the result array returned\r
+     * by the <code>parse</code> methods.\r
+     * <p>\r
+     * If an argument index is used for more than one format element\r
+     * in the pattern string, then the format used for the last such\r
+     * format element is returned in the array. If an argument index\r
+     * is not used for any format element in the pattern string, then\r
+     * null is returned in the array.\r
+     *\r
+     * This method is only supported when exclusively numbers are used for\r
+     * argument names. Otherwise an IllegalArgumentException is thrown.\r
+     *\r
+     * @return the formats used for the arguments within the pattern\r
+     * @throws IllegalArgumentException if this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public Format[] getFormatsByArgumentIndex() {\r
+        return messageFormat.getFormatsByArgumentIndex();\r
+    }\r
+\r
+    /**\r
+     * Returns the formats used for the format elements in the\r
+     * previously set pattern string.\r
+     * The order of formats in the returned array corresponds to\r
+     * the order of format elements in the pattern string.\r
+     * <p>\r
+     * Since the order of format elements in a pattern string often\r
+     * changes during localization, it's generally better to use the\r
+     * {@link #getFormatsByArgumentIndex()}\r
+     * method, which assumes an order of formats corresponding to the\r
+     * order of elements in the <code>arguments</code> array passed to\r
+     * the <code>format</code> methods or the result array returned by\r
+     * the <code>parse</code> methods.\r
+     *\r
+     * This method is only supported when exclusively numbers are used for\r
+     * argument names. Otherwise an IllegalArgumentException is thrown.\r
+     *\r
+     * @return the formats used for the format elements in the pattern\r
+     * @throws IllegalArgumentException if this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public Format[] getFormats() {\r
+        return messageFormat.getFormats();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the format argument names. For more details, see\r
+     * {@link #setFormatByArgumentName(String, Format)}.\r
+     * @return List of names\r
+     * @internal\r
+     * @deprecated This API is ICU internal only.\r
+     */\r
+    public Set<String> getFormatArgumentNames() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the formats according to their argument names. For more details, see\r
+     * {@link #setFormatByArgumentName(String, Format)}.\r
+     * @return format associated with the name, or null if there isn't one.\r
+     * @internal\r
+     * @deprecated This API is ICU internal only.\r
+     */\r
+    public Format getFormatByArgumentName(String argumentName) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Formats an array of objects and appends the <code>MessageFormat</code>'s\r
+     * pattern, with format elements replaced by the formatted objects, to the\r
+     * provided <code>StringBuffer</code>.\r
+     * <p>\r
+     * The text substituted for the individual format elements is derived from\r
+     * the current subformat of the format element and the\r
+     * <code>arguments</code> element at the format element's argument index\r
+     * as indicated by the first matching line of the following table. An\r
+     * argument is <i>unavailable</i> if <code>arguments</code> is\r
+     * <code>null</code> or has fewer than argumentIndex+1 elements.  When\r
+     * an argument is unavailable no substitution is performed.\r
+     * <p>\r
+     * <table border=1>\r
+     *    <tr>\r
+     *       <th>Subformat\r
+     *       <th>Argument\r
+     *       <th>Formatted Text\r
+     *    <tr>\r
+     *       <td><i>any</i>\r
+     *       <td><i>unavailable</i>\r
+     *       <td><code>"{" + argumentIndex + "}"</code>\r
+     *    <tr>\r
+     *       <td><i>any</i>\r
+     *       <td><code>null</code>\r
+     *       <td><code>"null"</code>\r
+     *    <tr>\r
+     *       <td><code>instanceof ChoiceFormat</code>\r
+     *       <td><i>any</i>\r
+     *       <td><code>subformat.format(argument).indexOf('{') >= 0 ?<br>\r
+     *           (new MessageFormat(subformat.format(argument), getLocale())).format(argument) :\r
+     *           subformat.format(argument)</code>\r
+     *    <tr>\r
+     *       <td><code>!= null</code>\r
+     *       <td><i>any</i>\r
+     *       <td><code>subformat.format(argument)</code>\r
+     *    <tr>\r
+     *       <td><code>null</code>\r
+     *       <td><code>instanceof Number</code>\r
+     *       <td><code>NumberFormat.getInstance(getLocale()).format(argument)</code>\r
+     *    <tr>\r
+     *       <td><code>null</code>\r
+     *       <td><code>instanceof Date</code>\r
+     *       <td><code>DateFormat.getDateTimeInstance(DateFormat.SHORT,\r
+     *           DateFormat.SHORT, getLocale()).format(argument)</code>\r
+     *    <tr>\r
+     *       <td><code>null</code>\r
+     *       <td><code>instanceof String</code>\r
+     *       <td><code>argument</code>\r
+     *    <tr>\r
+     *       <td><code>null</code>\r
+     *       <td><i>any</i>\r
+     *       <td><code>argument.toString()</code>\r
+     * </table>\r
+     * <p>\r
+     * If <code>pos</code> is non-null, and refers to\r
+     * <code>Field.ARGUMENT</code>, the location of the first formatted\r
+     * string will be returned.\r
+     *\r
+     * This method is only supported when the format does not use named\r
+     * arguments, otherwise an IllegalArgumentException is thrown.\r
+     *\r
+     * @param arguments an array of objects to be formatted and substituted.\r
+     * @param result where text is appended.\r
+     * @param pos On input: an alignment field, if desired.\r
+     *            On output: the offsets of the alignment field.\r
+     * @throws IllegalArgumentException if an argument in the\r
+     *            <code>arguments</code> array is not of the type\r
+     *            expected by the format element(s) that use it.\r
+     * @throws IllegalArgumentException if this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public final StringBuffer format(Object[] arguments, StringBuffer result,\r
+                                     FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = messageFormat.format(arguments, result, jdkPos);\r
+        if (jdkPos != null) {\r
+            pos.setBeginIndex(jdkPos.getBeginIndex());\r
+            pos.setEndIndex(jdkPos.getEndIndex());\r
+        }\r
+        return buf;\r
+    }\r
+\r
+    /**\r
+     * Formats a map of objects and appends the <code>MessageFormat</code>'s\r
+     * pattern, with format elements replaced by the formatted objects, to the\r
+     * provided <code>StringBuffer</code>.\r
+     * <p>\r
+     * The text substituted for the individual format elements is derived from\r
+     * the current subformat of the format element and the\r
+     * <code>arguments</code> value corresopnding to the format element's\r
+     * argument name.\r
+     * <p>\r
+     * This API may be called on formats that do not use named arguments.\r
+     * In this case the the keys in <code>arguments</code> must be numeric\r
+     * strings (e.g. "0", "1", "2"...).\r
+     * <p>\r
+     * An argument is <i>unavailable</i> if <code>arguments</code> is\r
+     * <code>null</code> or does not have a value corresponding to an argument\r
+     * name in the pattern.  When an argument is unavailable no substitution\r
+     * is performed.\r
+     *\r
+     * @param arguments a map of objects to be formatted and substituted.\r
+     * @param result where text is appended.\r
+     * @param pos On input: an alignment field, if desired.\r
+     *            On output: the offsets of the alignment field.\r
+     * @throws IllegalArgumentException if an argument in the\r
+     *         <code>arguments</code> array is not of the type\r
+     *         expected by the format element(s) that use it.\r
+     * @return the passed-in StringBuffer\r
+     * @stable ICU 3.8\r
+     */\r
+    public final StringBuffer format(Map<String, Object> arguments, StringBuffer result,\r
+                                     FieldPosition pos) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Creates a MessageFormat with the given pattern and uses it\r
+     * to format the given arguments. This is equivalent to\r
+     * <blockquote>\r
+     *     <code>(new {@link #MessageFormat(String) MessageFormat}(pattern)).{@link\r
+     *     #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition)\r
+     *     format}(arguments, new StringBuffer(), null).toString()</code>\r
+     * </blockquote>\r
+     *\r
+     * @throws IllegalArgumentException if the pattern is invalid,\r
+     *            or if an argument in the <code>arguments</code> array\r
+     *            is not of the type expected by the format element(s)\r
+     *            that use it.\r
+     * @throws IllegalArgumentException if this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String format(String pattern, Object... arguments) {\r
+        return java.text.MessageFormat.format(pattern, arguments);\r
+    }\r
+\r
+    /**\r
+     * Creates a MessageFormat with the given pattern and uses it to\r
+     * format the given arguments.  The pattern must identifyarguments\r
+     * by name instead of by number.\r
+     * <p>\r
+     * @throws IllegalArgumentException if the pattern is invalid,\r
+     *         or if an argument in the <code>arguments</code> map\r
+     *         is not of the type expected by the format element(s)\r
+     *         that use it.\r
+     * @see #format(Map, StringBuffer, FieldPosition)\r
+     * @see #format(String, Object[])\r
+     * @stable ICU 3.8\r
+     */\r
+    public static String format(String pattern, Map<String, Object> arguments) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns true if this MessageFormat uses named arguments,\r
+     * and false otherwise.  See class description.\r
+     *\r
+     * @return true if named arguments are used.\r
+     * @stable ICU 3.8\r
+     */\r
+    public boolean usesNamedArguments() {\r
+        // always false with com.ibm.icu.base\r
+        return false;\r
+    }\r
+\r
+    // Overrides\r
+    /**\r
+     * Formats a map or array of objects and appends the <code>MessageFormat</code>'s\r
+     * pattern, with format elements replaced by the formatted objects, to the\r
+     * provided <code>StringBuffer</code>.\r
+     * This is equivalent to either of\r
+     * <blockquote>\r
+     *     <code>{@link #format(java.lang.Object[], java.lang.StringBuffer,\r
+     *     java.text.FieldPosition) format}((Object[]) arguments, result, pos)</code>\r
+     *     <code>{@link #format(java.util.Map, java.lang.StringBuffer,\r
+     *     java.text.FieldPosition) format}((Map) arguments, result, pos)</code>\r
+     * </blockquote>\r
+     * A map must be provided if this format uses named arguments, otherwise\r
+     * an IllegalArgumentException will be thrown.\r
+     * @param arguments a map or array of objects to be formatted\r
+     * @param result where text is appended\r
+     * @param pos On input: an alignment field, if desired\r
+     *            On output: the offsets of the alignment field\r
+     * @throws IllegalArgumentException if an argument in\r
+     *         <code>arguments</code> is not of the type\r
+     *         expected by the format element(s) that use it\r
+     * @throws IllegalArgumentException if <code>arguments<code> is\r
+     *         an array of Object and this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public final StringBuffer format(Object arguments, StringBuffer result,\r
+                                     FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = messageFormat.format(arguments, result, jdkPos);\r
+        if (jdkPos != null) {\r
+            pos.setBeginIndex(jdkPos.getBeginIndex());\r
+            pos.setEndIndex(jdkPos.getEndIndex());\r
+        }\r
+        return buf;\r
+    }\r
+\r
+    /**\r
+     * Formats an array of objects and inserts them into the\r
+     * <code>MessageFormat</code>'s pattern, producing an\r
+     * <code>AttributedCharacterIterator</code>.\r
+     * You can use the returned <code>AttributedCharacterIterator</code>\r
+     * to build the resulting String, as well as to determine information\r
+     * about the resulting String.\r
+     * <p>\r
+     * The text of the returned <code>AttributedCharacterIterator</code> is\r
+     * the same that would be returned by\r
+     * <blockquote>\r
+     *     <code>{@link #format(java.lang.Object[], java.lang.StringBuffer,\r
+     *     java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString()</code>\r
+     * </blockquote>\r
+     * <p>\r
+     * In addition, the <code>AttributedCharacterIterator</code> contains at\r
+     * least attributes indicating where text was generated from an\r
+     * argument in the <code>arguments</code> array. The keys of these attributes are of\r
+     * type <code>MessageFormat.Field</code>, their values are\r
+     * <code>Integer</code> objects indicating the index in the <code>arguments</code>\r
+     * array of the argument from which the text was generated.\r
+     * <p>\r
+     * The attributes/value from the underlying <code>Format</code>\r
+     * instances that <code>MessageFormat</code> uses will also be\r
+     * placed in the resulting <code>AttributedCharacterIterator</code>.\r
+     * This allows you to not only find where an argument is placed in the\r
+     * resulting String, but also which fields it contains in turn.\r
+     *\r
+     * @param arguments an array of objects to be formatted and substituted.\r
+     * @return AttributedCharacterIterator describing the formatted value.\r
+     * @exception NullPointerException if <code>arguments</code> is null.\r
+     * @exception IllegalArgumentException if an argument in the\r
+     *            <code>arguments</code> array is not of the type\r
+     *            expected by the format element(s) that use it.\r
+     * @stable ICU 3.8\r
+     */\r
+    public AttributedCharacterIterator formatToCharacterIterator(Object arguments) {\r
+        AttributedCharacterIterator it = messageFormat.formatToCharacterIterator(arguments);\r
+\r
+        // Extract formatted String first\r
+        StringBuilder sb = new StringBuilder();\r
+        for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {\r
+            sb.append(c);\r
+        }\r
+\r
+        // Create AttributedString\r
+        AttributedString attrstr = new AttributedString(sb.toString());\r
+\r
+        // Map JDK Field to ICU Field\r
+        int idx = 0;\r
+        it.first();\r
+        while (idx < it.getEndIndex()) {\r
+            int end = it.getRunLimit();\r
+            Map<Attribute, Object> attributes = it.getAttributes();\r
+            if (attributes != null) {\r
+                for (Entry<Attribute, Object> entry : attributes.entrySet()) {\r
+                    Attribute attr = entry.getKey();\r
+                    Object val = entry.getValue();\r
+                    if (attr.equals(java.text.MessageFormat.Field.ARGUMENT)) {\r
+                        val = attr = Field.ARGUMENT;\r
+                    }\r
+                    attrstr.addAttribute(attr, val, idx, end);\r
+                }\r
+            }\r
+            idx = end;\r
+            while (it.getIndex() < idx) {\r
+                it.next();\r
+            }\r
+        }\r
+\r
+        return attrstr.getIterator();\r
+    }\r
+\r
+    /**\r
+     * Parses the string.\r
+     *\r
+     * <p>Caveats: The parse may fail in a number of circumstances.\r
+     * For example:\r
+     * <ul>\r
+     * <li>If one of the arguments does not occur in the pattern.\r
+     * <li>If the format of an argument loses information, such as\r
+     *     with a choice format where a large number formats to "many".\r
+     * <li>Does not yet handle recursion (where\r
+     *     the substituted strings contain {n} references.)\r
+     * <li>Will not always find a match (or the correct match)\r
+     *     if some part of the parse is ambiguous.\r
+     *     For example, if the pattern "{1},{2}" is used with the\r
+     *     string arguments {"a,b", "c"}, it will format as "a,b,c".\r
+     *     When the result is parsed, it will return {"a", "b,c"}.\r
+     * <li>If a single argument is parsed more than once in the string,\r
+     *     then the later parse wins.\r
+     * </ul>\r
+     * When the parse fails, use ParsePosition.getErrorIndex() to find out\r
+     * where in the string did the parsing failed. The returned error\r
+     * index is the starting offset of the sub-patterns that the string\r
+     * is comparing with. For example, if the parsing string "AAA {0} BBB"\r
+     * is comparing against the pattern "AAD {0} BBB", the error index is\r
+     * 0. When an error occurs, the call to this method will return null.\r
+     * If the source is null, return an empty array.\r
+     * <p>\r
+     * This method is only supported with numbered arguments.  If\r
+     * the format pattern used named argument an\r
+     * IllegalArgumentException is thrown.\r
+     *\r
+     * @throws IllegalArgumentException if this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public Object[] parse(String source, ParsePosition pos) {\r
+        return messageFormat.parse(source, pos);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Parses the string, returning the results in a Map.\r
+     * This is similar to the version that returns an array\r
+     * of Object.  This supports both named and numbered\r
+     * arguments-- if numbered, the keys in the map are the\r
+     * corresponding Strings (e.g. "0", "1", "2"...).\r
+     *\r
+     * @param source the text to parse\r
+     * @param pos the position at which to start parsing.  on return,\r
+     *        contains the result of the parse.\r
+     * @return a Map containing key/value pairs for each parsed argument.\r
+     * @stable ICU 3.8\r
+     */\r
+    public Map<String, Object> parseToMap(String source, ParsePosition pos) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Parses text from the beginning of the given string to produce an object\r
+     * array.\r
+     * The method may not use the entire text of the given string.\r
+     * <p>\r
+     * See the {@link #parse(String, ParsePosition)} method for more information\r
+     * on message parsing.\r
+     *\r
+     * @param source A <code>String</code> whose beginning should be parsed.\r
+     * @return An <code>Object</code> array parsed from the string.\r
+     * @exception ParseException if the beginning of the specified string cannot be parsed.\r
+     * @exception IllegalArgumentException if this format uses named arguments\r
+     * @stable ICU 3.0\r
+     */\r
+    public Object[] parse(String source) throws ParseException {\r
+        return messageFormat.parse(source);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Parses text from the beginning of the given string to produce a map from\r
+     * argument to values. The method may not use the entire text of the given string.\r
+     *\r
+     * <p>See the {@link #parse(String, ParsePosition)} method for more information on\r
+     * message parsing.\r
+     *\r
+     * @param source A <code>String</code> whose beginning should be parsed.\r
+     * @return A <code>Map</code> parsed from the string.\r
+     * @throws ParseException if the beginning of the specified string cannot\r
+     *         be parsed.\r
+     * @see #parseToMap(String, ParsePosition)\r
+     * @stable ICU 3.8\r
+     */\r
+    public Map<String, Object> parseToMap(String source) throws ParseException {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Parses text from a string to produce an object array or Map.\r
+     * <p>\r
+     * The method attempts to parse text starting at the index given by\r
+     * <code>pos</code>.\r
+     * If parsing succeeds, then the index of <code>pos</code> is updated\r
+     * to the index after the last character used (parsing does not necessarily\r
+     * use all characters up to the end of the string), and the parsed\r
+     * object array is returned. The updated <code>pos</code> can be used to\r
+     * indicate the starting point for the next call to this method.\r
+     * If an error occurs, then the index of <code>pos</code> is not\r
+     * changed, the error index of <code>pos</code> is set to the index of\r
+     * the character where the error occurred, and null is returned.\r
+     * <p>\r
+     * See the {@link #parse(String, ParsePosition)} method for more information\r
+     * on message parsing.\r
+     *\r
+     * @param source A <code>String</code>, part of which should be parsed.\r
+     * @param pos A <code>ParsePosition</code> object with index and error\r
+     *            index information as described above.\r
+     * @return An <code>Object</code> parsed from the string, either an\r
+     *         array of Object, or a Map, depending on whether named\r
+     *         arguments are used.  This can be queried using <code>usesNamedArguments</code>.\r
+     *         In case of error, returns null.\r
+     * @throws NullPointerException if <code>pos</code> is null.\r
+     * @stable ICU 3.0\r
+     */\r
+    public Object parseObject(String source, ParsePosition pos) {\r
+        return messageFormat.parse(source, pos);\r
+    }\r
+\r
+    /**\r
+     * Overrides clone.\r
+     *\r
+     * @return a clone of this instance.\r
+     * @stable ICU 3.0\r
+     */\r
+    public Object clone() {\r
+        MessageFormat fmt = new MessageFormat((java.text.MessageFormat)messageFormat.clone());\r
+        fmt.savedPattern = savedPattern;\r
+        return fmt;\r
+    }\r
+\r
+    /**\r
+     * Overrides equals.\r
+     * @stable ICU 3.0\r
+     */\r
+    public boolean equals(Object obj) {\r
+        try {\r
+            return messageFormat.equals(((MessageFormat)obj).messageFormat);\r
+        }\r
+        catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Overrides hashCode.\r
+     * @stable ICU 3.0\r
+     */\r
+    public int hashCode() {\r
+        return messageFormat.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Defines constants that are used as attribute keys in the\r
+     * <code>AttributedCharacterIterator</code> returned\r
+     * from <code>MessageFormat.formatToCharacterIterator</code>.\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public static class Field extends Format.Field {\r
+\r
+        private static final long serialVersionUID = 7510380454602616157L;\r
+\r
+        /**\r
+         * Create a <code>Field</code> with the specified name.\r
+         *\r
+         * @param name The name of the attribute\r
+         *\r
+         * @stable ICU 3.8\r
+         */\r
+        protected Field(String name) {\r
+            super(name);\r
+        }\r
+\r
+        /**\r
+         * Resolves instances being deserialized to the predefined constants.\r
+         *\r
+         * @return resolved MessageFormat.Field constant\r
+         * @throws InvalidObjectException if the constant could not be resolved.\r
+         *\r
+         * @stable ICU 3.8\r
+         */\r
+        protected Object readResolve() throws InvalidObjectException {\r
+            if (this.getClass() != MessageFormat.Field.class) {\r
+                throw new InvalidObjectException(\r
+                    "A subclass of MessageFormat.Field must implement readResolve.");\r
+            }\r
+            if (this.getName().equals(ARGUMENT.getName())) {\r
+                return ARGUMENT;\r
+            } else {\r
+                throw new InvalidObjectException("Unknown attribute name.");\r
+            }\r
+        }\r
+\r
+        /**\r
+         * Constant identifying a portion of a message that was generated\r
+         * from an argument passed into <code>formatToCharacterIterator</code>.\r
+         * The value associated with the key will be an <code>Integer</code>\r
+         * indicating the index in the <code>arguments</code> array of the\r
+         * argument from which the text was generated.\r
+         *\r
+         * @stable ICU 3.8\r
+         */\r
+        public static final Field ARGUMENT = new Field("message argument field");\r
+\r
+    }\r
+\r
+    private static final char SINGLE_QUOTE = '\'';\r
+    private static final char CURLY_BRACE_LEFT = '{';\r
+    private static final char CURLY_BRACE_RIGHT = '}';\r
+\r
+    private static final int STATE_INITIAL = 0;\r
+    private static final int STATE_SINGLE_QUOTE = 1;\r
+    private static final int STATE_IN_QUOTE = 2;\r
+    private static final int STATE_MSG_ELEMENT = 3;\r
+\r
+    /**\r
+     * {@icu} Converts an 'apostrophe-friendly' pattern into a standard\r
+     * pattern.  Standard patterns treat all apostrophes as\r
+     * quotes, which is problematic in some languages, e.g.\r
+     * French, where apostrophe is commonly used.  This utility\r
+     * assumes that only an unpaired apostrophe immediately before\r
+     * a brace is a true quote.  Other unpaired apostrophes are paired,\r
+     * and the resulting standard pattern string is returned.\r
+     *\r
+     * <p><b>Note</b> it is not guaranteed that the returned pattern\r
+     * is indeed a valid pattern.  The only effect is to convert\r
+     * between patterns having different quoting semantics.\r
+     *\r
+     * @param pattern the 'apostrophe-friendly' patttern to convert\r
+     * @return the standard equivalent of the original pattern\r
+     * @stable ICU 3.4\r
+     */\r
+    public static String autoQuoteApostrophe(String pattern) {\r
+        StringBuilder buf = new StringBuilder(pattern.length() * 2);\r
+        int state = STATE_INITIAL;\r
+        int braceCount = 0;\r
+        for (int i = 0, j = pattern.length(); i < j; ++i) {\r
+            char c = pattern.charAt(i);\r
+            switch (state) {\r
+            case STATE_INITIAL:\r
+                switch (c) {\r
+                case SINGLE_QUOTE:\r
+                    state = STATE_SINGLE_QUOTE;\r
+                    break;\r
+                case CURLY_BRACE_LEFT:\r
+                    state = STATE_MSG_ELEMENT;\r
+                    ++braceCount;\r
+                    break;\r
+                }\r
+                break;\r
+            case STATE_SINGLE_QUOTE:\r
+                switch (c) {\r
+                case SINGLE_QUOTE:\r
+                    state = STATE_INITIAL;\r
+                    break;\r
+                case CURLY_BRACE_LEFT:\r
+                case CURLY_BRACE_RIGHT:\r
+                    state = STATE_IN_QUOTE;\r
+                    break;\r
+                default:\r
+                    buf.append(SINGLE_QUOTE);\r
+                    state = STATE_INITIAL;\r
+                    break;\r
+                }\r
+                break;\r
+            case STATE_IN_QUOTE:\r
+                switch (c) {\r
+                case SINGLE_QUOTE:\r
+                    state = STATE_INITIAL;\r
+                    break;\r
+                }\r
+                break;\r
+            case STATE_MSG_ELEMENT:\r
+                switch (c) {\r
+                case CURLY_BRACE_LEFT:\r
+                    ++braceCount;\r
+                    break;\r
+                case CURLY_BRACE_RIGHT:\r
+                    if (--braceCount == 0) {\r
+                        state = STATE_INITIAL;\r
+                    }\r
+                    break;\r
+                }\r
+                break;\r
+            ///CLOVER:OFF\r
+            default: // Never happens.\r
+                break;\r
+            ///CLOVER:ON\r
+            }\r
+            buf.append(c);\r
+        }\r
+        // End of scan\r
+        if (state == STATE_SINGLE_QUOTE || state == STATE_IN_QUOTE) {\r
+            buf.append(SINGLE_QUOTE);\r
+        }\r
+        return new String(buf);\r
+    }\r
+\r
+    private static FieldPosition toJDKFieldPosition(FieldPosition icuPos) {\r
+        if (icuPos == null) {\r
+            return null;\r
+        }\r
+\r
+        int fieldID = icuPos.getField();\r
+        Format.Field fieldAttribute = icuPos.getFieldAttribute();\r
+\r
+        FieldPosition jdkPos = null;\r
+        if (fieldAttribute != null) {\r
+            // map field\r
+            if (fieldAttribute.equals(Field.ARGUMENT)) {\r
+                fieldAttribute = java.text.MessageFormat.Field.ARGUMENT;\r
+            }\r
+            jdkPos = new FieldPosition(fieldAttribute, fieldID);\r
+        } else {\r
+            jdkPos = new FieldPosition(fieldID);\r
+        }\r
+\r
+        jdkPos.setBeginIndex(icuPos.getBeginIndex());\r
+        jdkPos.setEndIndex(icuPos.getEndIndex());\r
+\r
+        return jdkPos;\r
+\r
+    }\r
+\r
+    private void wrapNestedFormatters(java.text.MessageFormat mfmt) {\r
+        // Update nested formatters created by Java MessageFormat\r
+        // with ICU versions, so FieldPosition / AttributedText will\r
+        // use ICU formatter's definition, such as com.ibm.icu.text.NumberFormat.INTEGER_FIELD\r
+\r
+        // Replacing nested formatter may change the pattern string\r
+        // originally used. For example, "{0,integer} files" is replaced\r
+        // with "{0} files". We preserve the original pattern.\r
+        savedPattern = mfmt.toPattern();\r
+\r
+        Format[] subfmts = mfmt.getFormats();\r
+        for (int i = 0; i < subfmts.length; i++) {\r
+            if (subfmts[i] instanceof java.text.DateFormat) {\r
+                subfmts[i] = new DateFormat((java.text.DateFormat)subfmts[i]);\r
+            } else if (subfmts[i] instanceof java.text.NumberFormat) {\r
+                subfmts[i] = new NumberFormat((java.text.NumberFormat)subfmts[i]);\r
+            }\r
+        }\r
+        mfmt.setFormats(subfmts);\r
+    }\r
+\r
+    private String savedPattern;\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/NumberFormat.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/NumberFormat.java
new file mode 100644 (file)
index 0000000..62f3202
--- /dev/null
@@ -0,0 +1,1312 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.text;\r
+\r
+import java.io.InvalidObjectException;\r
+import java.math.BigInteger;\r
+import java.text.FieldPosition;\r
+import java.text.Format;\r
+import java.text.ParseException;\r
+import java.text.ParsePosition;\r
+import java.util.Locale;\r
+import java.util.Set;\r
+\r
+import com.ibm.icu.util.Currency;\r
+import com.ibm.icu.util.CurrencyAmount;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+/**\r
+ * {@icuenhanced java.text.NumberFormat}.{@icu _usage_}\r
+ *\r
+ * <code>NumberFormat</code> is the abstract base class for all number\r
+ * formats. This class provides the interface for formatting and parsing\r
+ * numbers. <code>NumberFormat</code> also provides methods for determining\r
+ * which locales have number formats, and what their names are.\r
+ *\r
+ * <code>NumberFormat</code> helps you to format and parse numbers for any locale.\r
+ * Your code can be completely independent of the locale conventions for\r
+ * decimal points, thousands-separators, or even the particular decimal\r
+ * digits used, or whether the number format is even decimal.\r
+ *\r
+ * <p>\r
+ * To format a number for the current Locale, use one of the factory\r
+ * class methods:\r
+ * <blockquote>\r
+ * <pre>\r
+ *  myString = NumberFormat.getInstance().format(myNumber);\r
+ * </pre>\r
+ * </blockquote>\r
+ * If you are formatting multiple numbers, it is\r
+ * more efficient to get the format and use it multiple times so that\r
+ * the system doesn't have to fetch the information about the local\r
+ * language and country conventions multiple times.\r
+ * <blockquote>\r
+ * <pre>\r
+ * NumberFormat nf = NumberFormat.getInstance();\r
+ * for (int i = 0; i < a.length; ++i) {\r
+ *     output.println(nf.format(myNumber[i]) + "; ");\r
+ * }\r
+ * </pre>\r
+ * </blockquote>\r
+ * To format a number for a different Locale, specify it in the\r
+ * call to <code>getInstance</code>.\r
+ * <blockquote>\r
+ * <pre>\r
+ * NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);\r
+ * </pre>\r
+ * </blockquote>\r
+ * You can also use a <code>NumberFormat</code> to parse numbers:\r
+ * <blockquote>\r
+ * <pre>\r
+ * myNumber = nf.parse(myString);\r
+ * </pre>\r
+ * </blockquote>\r
+ * Use <code>getInstance</code> or <code>getNumberInstance</code> to get the\r
+ * normal number format. Use <code>getIntegerInstance</code> to get an\r
+ * integer number format. Use <code>getCurrencyInstance</code> to get the\r
+ * currency number format. And use <code>getPercentInstance</code> to get a\r
+ * format for displaying percentages. With this format, a fraction like\r
+ * 0.53 is displayed as 53%.\r
+ *\r
+ * <p>\r
+ * Starting from ICU 4.2, you can use getInstance() by passing in a 'style'\r
+ * as parameter to get the correct instance.\r
+ * For example,\r
+ * use getInstance(...NUMBERSTYLE) to get the normal number format,\r
+ * getInstance(...PERCENTSTYLE) to get a format for displaying percentage,\r
+ * getInstance(...SCIENTIFICSTYLE) to get a format for displaying scientific number,\r
+ * getInstance(...INTEGERSTYLE) to get an integer number format,\r
+ * getInstance(...CURRENCYSTYLE) to get the currency number format,\r
+ * in which the currency is represented by its symbol, for example, "$3.00".\r
+ * getInstance(...ISOCURRENCYSTYLE)  to get the currency number format,\r
+ * in which the currency is represented by its ISO code, for example "USD3.00".\r
+ * getInstance(...PLURALCURRENCYSTYLE) to get the currency number format,\r
+ * in which the currency is represented by its full name in plural format,\r
+ * for example, "3.00 US dollars" or "1.00 US dollar".\r
+ *\r
+ *\r
+ * <p>\r
+ * You can also control the display of numbers with such methods as\r
+ * <code>setMinimumFractionDigits</code>.\r
+ * If you want even more control over the format or parsing,\r
+ * or want to give your users more control,\r
+ * you can try casting the <code>NumberFormat</code> you get from the factory methods\r
+ * to a <code>DecimalFormat</code>. This will work for the vast majority\r
+ * of locales; just remember to put it in a <code>try</code> block in case you\r
+ * encounter an unusual one.\r
+ *\r
+ * <p>\r
+ * NumberFormat is designed such that some controls\r
+ * work for formatting and others work for parsing.  The following is\r
+ * the detailed description for each these control methods,\r
+ * <p>\r
+ * setParseIntegerOnly : only affects parsing, e.g.\r
+ * if true,  "3456.78" -> 3456 (and leaves the parse position just after '6')\r
+ * if false, "3456.78" -> 3456.78 (and leaves the parse position just after '8')\r
+ * This is independent of formatting.  If you want to not show a decimal point\r
+ * where there might be no digits after the decimal point, use\r
+ * setDecimalSeparatorAlwaysShown on DecimalFormat.\r
+ * <p>\r
+ * You can also use forms of the <code>parse</code> and <code>format</code>\r
+ * methods with <code>ParsePosition</code> and <code>FieldPosition</code> to\r
+ * allow you to:\r
+ * <ul>\r
+ * <li> progressively parse through pieces of a string\r
+ * <li> align the decimal point and other areas\r
+ * </ul>\r
+ * For example, you can align numbers in two ways:\r
+ * <ol>\r
+ * <li> If you are using a monospaced font with spacing for alignment,\r
+ *      you can pass the <code>FieldPosition</code> in your format call, with\r
+ *      <code>field</code> = <code>INTEGER_FIELD</code>. On output,\r
+ *      <code>getEndIndex</code> will be set to the offset between the\r
+ *      last character of the integer and the decimal. Add\r
+ *      (desiredSpaceCount - getEndIndex) spaces at the front of the string.\r
+ *\r
+ * <li> If you are using proportional fonts,\r
+ *      instead of padding with spaces, measure the width\r
+ *      of the string in pixels from the start to <code>getEndIndex</code>.\r
+ *      Then move the pen by\r
+ *      (desiredPixelWidth - widthToAlignmentPoint) before drawing the text.\r
+ *      It also works where there is no decimal, but possibly additional\r
+ *      characters at the end, e.g., with parentheses in negative\r
+ *      numbers: "(12)" for -12.\r
+ * </ol>\r
+ *\r
+ * <h4>Synchronization</h4>\r
+ * <p>\r
+ * Number formats are generally not synchronized. It is recommended to create\r
+ * separate format instances for each thread. If multiple threads access a format\r
+ * concurrently, it must be synchronized externally.\r
+ * <p>\r
+ *\r
+ * <h4>DecimalFormat</h4>\r
+ * <p>DecimalFormat is the concrete implementation of NumberFormat, and the\r
+ * NumberFormat API is essentially an abstraction from DecimalFormat's API.\r
+ * Refer to DecimalFormat for more information about this API.</p>\r
+ *\r
+ * see          DecimalFormat\r
+ * see          java.text.ChoiceFormat\r
+ * @author       Mark Davis\r
+ * @author       Helena Shih\r
+ * @author       Alan Liu\r
+ * @stable ICU 2.0\r
+ */\r
+public class NumberFormat extends Format {\r
+    private static final long serialVersionUID = 1;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    public final java.text.NumberFormat numberFormat;\r
+        \r
+    /**\r
+     * @internal\r
+     * @param delegate the NumberFormat to which to delegate\r
+     */\r
+    public NumberFormat(java.text.NumberFormat delegate) {\r
+        this.numberFormat = delegate;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Constant to specify normal number style of format.\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int NUMBERSTYLE = 0;\r
+    /**\r
+     * {@icu} Constant to specify currency style of format which uses currency symbol\r
+     * to represent currency, for example: "$3.00".\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int CURRENCYSTYLE = 1;\r
+    /**\r
+     * {@icu} Constant to specify a style of format to display percent.\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int PERCENTSTYLE = 2;\r
+    /**\r
+     * {@icu} Constant to specify a style of format to display scientific number.\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int SCIENTIFICSTYLE = 3;\r
+    /**\r
+     * {@icu} Constant to specify a integer number style format.\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int INTEGERSTYLE = 4;\r
+    /**\r
+     * {@icu} Constant to specify currency style of format which uses currency\r
+     * ISO code to represent currency, for example: "USD3.00".\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int ISOCURRENCYSTYLE = 5;\r
+    /**\r
+     * {@icu} Constant to specify currency style of format which uses currency\r
+     * long name with plural format to represent currency, for example,\r
+     * "3.00 US Dollars".\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int PLURALCURRENCYSTYLE = 6;\r
+\r
+    /**\r
+     * Field constant used to construct a FieldPosition object. Signifies that\r
+     * the position of the integer part of a formatted number should be returned.\r
+     * @see java.text.FieldPosition\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int INTEGER_FIELD = 0;\r
+\r
+    /**\r
+     * Field constant used to construct a FieldPosition object. Signifies that\r
+     * the position of the fraction part of a formatted number should be returned.\r
+     * @see java.text.FieldPosition\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int FRACTION_FIELD = 1;\r
+\r
+    /**\r
+     * Formats a number and appends the resulting text to the given string buffer.\r
+     * {@icunote} recognizes <code>BigInteger</code>\r
+     * and <code>BigDecimal</code> objects.\r
+     * @see java.text.Format#format(Object, StringBuffer, FieldPosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(Object number,\r
+                               StringBuffer toAppendTo,\r
+                               FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = numberFormat.format(number, toAppendTo, jdkPos);\r
+        if (jdkPos != null) {\r
+            pos.setBeginIndex(jdkPos.getBeginIndex());\r
+            pos.setEndIndex(jdkPos.getEndIndex());\r
+        }\r
+        return buf;\r
+    }\r
+\r
+    /**\r
+     * Parses text from a string to produce a number.\r
+     * @param source the String to parse\r
+     * @param parsePosition the position at which to start the parse\r
+     * @return the parsed number, or null\r
+     * @see java.text.NumberFormat#parseObject(String, ParsePosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public final Object parseObject(String source,\r
+                                    ParsePosition parsePosition) {\r
+        return numberFormat.parse(source, parsePosition);\r
+    }\r
+\r
+    /**\r
+     * Specialization of format.\r
+     * @see java.text.Format#format(Object)\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String format(double number) {\r
+        return numberFormat.format(number);\r
+    }\r
+\r
+    /**\r
+     * Specialization of format.\r
+     * @see java.text.Format#format(Object)\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String format(long number) {\r
+        return numberFormat.format(number);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Convenience method to format a BigInteger.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String format(BigInteger number) {\r
+        return numberFormat.format(number);\r
+    }\r
+\r
+    /**\r
+     * Convenience method to format a BigDecimal.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String format(java.math.BigDecimal number) {\r
+        return numberFormat.format(number);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Convenience method to format an ICU BigDecimal.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String format(com.ibm.icu.math.BigDecimal number) {\r
+        return numberFormat.format(number.toBigDecimal());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Convenience method to format a CurrencyAmount.\r
+     * @stable ICU 3.0\r
+     */\r
+    public final String format(CurrencyAmount currAmt) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Specialization of format.\r
+     * @see java.text.Format#format(Object, StringBuffer, FieldPosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(double number,\r
+                                        StringBuffer toAppendTo,\r
+                                        FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = numberFormat.format(number, toAppendTo, jdkPos);\r
+        pos.setBeginIndex(jdkPos.getBeginIndex());\r
+        pos.setEndIndex(jdkPos.getEndIndex());\r
+        return buf;\r
+    }\r
+\r
+    /**\r
+     * Specialization of format.\r
+     * @see java.text.Format#format(Object, StringBuffer, FieldPosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(long number,\r
+                                        StringBuffer toAppendTo,\r
+                                        FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = numberFormat.format(number, toAppendTo, jdkPos);\r
+        pos.setBeginIndex(jdkPos.getBeginIndex());\r
+        pos.setEndIndex(jdkPos.getEndIndex());\r
+        return buf;\r
+    }\r
+    /**\r
+     * {@icu} Formats a BigInteger. Specialization of format.\r
+     * @see java.text.Format#format(Object, StringBuffer, FieldPosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(BigInteger number,\r
+                                        StringBuffer toAppendTo,\r
+                                        FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = numberFormat.format(number, toAppendTo, jdkPos);\r
+        pos.setBeginIndex(jdkPos.getBeginIndex());\r
+        pos.setEndIndex(jdkPos.getEndIndex());\r
+        return buf;\r
+    }\r
+    /**\r
+     * {@icu} Formats a BigDecimal. Specialization of format.\r
+     * @see java.text.Format#format(Object, StringBuffer, FieldPosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(java.math.BigDecimal number,\r
+                                        StringBuffer toAppendTo,\r
+                                        FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = numberFormat.format(number, toAppendTo, jdkPos);\r
+        pos.setBeginIndex(jdkPos.getBeginIndex());\r
+        pos.setEndIndex(jdkPos.getEndIndex());\r
+        return buf;\r
+    }\r
+    /**\r
+     * {@icu} Formats an ICU BigDecimal. Specialization of format.\r
+     * @see java.text.Format#format(Object, StringBuffer, FieldPosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(com.ibm.icu.math.BigDecimal number,\r
+                                        StringBuffer toAppendTo,\r
+                                        FieldPosition pos) {\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        StringBuffer buf = numberFormat.format(number.toBigDecimal(), toAppendTo, jdkPos);\r
+        pos.setBeginIndex(jdkPos.getBeginIndex());\r
+        pos.setEndIndex(jdkPos.getEndIndex());\r
+        return buf;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Formats a CurrencyAmount. Specialization of format.\r
+     * @see java.text.Format#format(Object, StringBuffer, FieldPosition)\r
+     * @stable ICU 3.0\r
+     */\r
+    public StringBuffer format(CurrencyAmount currAmt,\r
+                               StringBuffer toAppendTo,\r
+                               FieldPosition pos) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns a Long if possible (e.g., within the range [Long.MIN_VALUE,\r
+     * Long.MAX_VALUE] and with no decimals), otherwise a Double.\r
+     * If IntegerOnly is set, will stop at a decimal\r
+     * point (or equivalent; e.g., for rational numbers "1 2/3", will stop\r
+     * after the 1).\r
+     * Does not throw an exception; if no object can be parsed, index is\r
+     * unchanged!\r
+     * @see #isParseIntegerOnly\r
+     * @see java.text.Format#parseObject(String, ParsePosition)\r
+     * @stable ICU 2.0\r
+     */\r
+    public Number parse(String text, ParsePosition parsePosition) {\r
+        return numberFormat.parse(text, parsePosition);\r
+    }\r
+\r
+    /**\r
+     * Parses text from the beginning of the given string to produce a number.\r
+     * The method might not use the entire text of the given string.\r
+     *\r
+     * @param text A String whose beginning should be parsed.\r
+     * @return A Number parsed from the string.\r
+     * @throws ParseException if the beginning of the specified string\r
+     * cannot be parsed.\r
+     * @see #format\r
+     * @stable ICU 2.0\r
+     */\r
+    public Number parse(String text) throws ParseException {\r
+        return numberFormat.parse(text);\r
+    }\r
+\r
+    /**\r
+     * Parses text from the given string as a CurrencyAmount.  Unlike\r
+     * the parse() method, this method will attempt to parse a generic\r
+     * currency name, searching for a match of this object's locale's\r
+     * currency display names, or for a 3-letter ISO currency code.\r
+     * This method will fail if this format is not a currency format,\r
+     * that is, if it does not contain the currency pattern symbol\r
+     * (U+00A4) in its prefix or suffix.\r
+     *\r
+     * @param text the string to parse\r
+     * @param pos input-output position; on input, the position within\r
+     * text to match; must have 0 <= pos.getIndex() < text.length();\r
+     * on output, the position after the last matched character. If\r
+     * the parse fails, the position in unchanged upon output.\r
+     * @return a CurrencyAmount, or null upon failure\r
+     */\r
+    CurrencyAmount parseCurrency(String text, ParsePosition pos) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns true if this format will parse numbers as integers only.\r
+     * For example in the English locale, with ParseIntegerOnly true, the\r
+     * string "1234." would be parsed as the integer value 1234 and parsing\r
+     * would stop at the "." character.  The decimal separator accepted\r
+     * by the parse operation is locale-dependent and determined by the\r
+     * subclass.\r
+     * @return true if this will parse integers only\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isParseIntegerOnly() {\r
+        return numberFormat.isParseIntegerOnly();\r
+    }\r
+\r
+    /**\r
+     * Sets whether or not numbers should be parsed as integers only.\r
+     * @param value true if this should parse integers only\r
+     * @see #isParseIntegerOnly\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setParseIntegerOnly(boolean value) {\r
+        numberFormat.setParseIntegerOnly(value);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets whether strict parsing is in effect.  When this is true, the\r
+     * following conditions cause a parse failure (examples use the pattern "#,##0.#"):<ul>\r
+     * <li>Leading zeros<br>\r
+     * '00', '0123' fail the parse, but '0' and '0.001' pass</li>\r
+     * <li>Leading or doubled grouping separators<br>\r
+     * ',123' and '1,,234" fail</li>\r
+     * <li>Groups of incorrect length when grouping is used<br>\r
+     * '1,23' and '1234,567' fail, but '1234' passes</li>\r
+     * <li>Grouping separators used in numbers followed by exponents<br>\r
+     * '1,234E5' fails, but '1234E5' and '1,234E' pass ('E' is not an exponent when\r
+     * not followed by a number)</li>\r
+     * </ul>\r
+     * When strict parsing is off, leading zeros and all grouping separators are ignored.\r
+     * This is the default behavior.\r
+     * @param value True to enable strict parsing.  Default is false.\r
+     * @see #isParseStrict\r
+     * @stable ICU 3.6\r
+     */\r
+    public void setParseStrict(boolean value) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns whether strict parsing is in effect.\r
+     * @return true if strict parsing is in effect\r
+     * @see #setParseStrict\r
+     * @stable ICU 3.6\r
+     */\r
+    public boolean isParseStrict() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    //============== Locale Stuff =====================\r
+\r
+    /**\r
+     * Returns the default number format for the current default locale.\r
+     * The default format is one of the styles provided by the other\r
+     * factory methods: getNumberInstance, getIntegerInstance,\r
+     * getCurrencyInstance or getPercentInstance.\r
+     * Exactly which one is locale-dependent.\r
+     * @stable ICU 2.0\r
+     */\r
+    //Bug 4408066 [Richard/GCL]\r
+    public final static NumberFormat getInstance() {\r
+        return getInstance(ULocale.getDefault(), NUMBERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns the default number format for the specified locale.\r
+     * The default format is one of the styles provided by the other\r
+     * factory methods: getNumberInstance, getCurrencyInstance or getPercentInstance.\r
+     * Exactly which one is locale-dependent.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static NumberFormat getInstance(Locale inLocale) {\r
+        return getInstance(ULocale.forLocale(inLocale), NUMBERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the default number format for the specified locale.\r
+     * The default format is one of the styles provided by the other\r
+     * factory methods: getNumberInstance, getCurrencyInstance or getPercentInstance.\r
+     * Exactly which one is locale-dependent.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static NumberFormat getInstance(ULocale inLocale) {\r
+        return getInstance(inLocale, NUMBERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a specific style number format for default locale.\r
+     * @param style  number format style\r
+     * @stable ICU 4.2\r
+     */\r
+    public final static NumberFormat getInstance(int style) {\r
+        return getInstance(ULocale.getDefault(), style);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a specific style number format for a specific locale.\r
+     * @param inLocale  the specific locale.\r
+     * @param style     number format style\r
+     * @stable ICU 4.2\r
+     */\r
+    public static NumberFormat getInstance(Locale inLocale, int style) {\r
+        return getInstance(ULocale.forLocale(inLocale), style);\r
+    }\r
+\r
+\r
+    /**\r
+     * Returns a general-purpose number format for the current default locale.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static NumberFormat getNumberInstance() {\r
+        return getInstance(ULocale.getDefault(), NUMBERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns a general-purpose number format for the specified locale.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static NumberFormat getNumberInstance(Locale inLocale) {\r
+        return getInstance(ULocale.forLocale(inLocale), NUMBERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a general-purpose number format for the specified locale.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static NumberFormat getNumberInstance(ULocale inLocale) {\r
+        return getInstance(inLocale, NUMBERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns an integer number format for the current default locale. The\r
+     * returned number format is configured to round floating point numbers\r
+     * to the nearest integer using IEEE half-even rounding (see {@link\r
+     * com.ibm.icu.math.BigDecimal#ROUND_HALF_EVEN ROUND_HALF_EVEN}) for formatting,\r
+     * and to parse only the integer part of an input string (see {@link\r
+     * #isParseIntegerOnly isParseIntegerOnly}).\r
+     *\r
+     * @return a number format for integer values\r
+     * @stable ICU 2.0\r
+     */\r
+    //Bug 4408066 [Richard/GCL]\r
+    public final static NumberFormat getIntegerInstance() {\r
+        return getInstance(ULocale.getDefault(), INTEGERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns an integer number format for the specified locale. The\r
+     * returned number format is configured to round floating point numbers\r
+     * to the nearest integer using IEEE half-even rounding (see {@link\r
+     * com.ibm.icu.math.BigDecimal#ROUND_HALF_EVEN ROUND_HALF_EVEN}) for formatting,\r
+     * and to parse only the integer part of an input string (see {@link\r
+     * #isParseIntegerOnly isParseIntegerOnly}).\r
+     *\r
+     * @param inLocale the locale for which a number format is needed\r
+     * @return a number format for integer values\r
+     * @stable ICU 2.0\r
+     */\r
+    //Bug 4408066 [Richard/GCL]\r
+    public static NumberFormat getIntegerInstance(Locale inLocale) {\r
+        return getInstance(ULocale.forLocale(inLocale), INTEGERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns an integer number format for the specified locale. The\r
+     * returned number format is configured to round floating point numbers\r
+     * to the nearest integer using IEEE half-even rounding (see {@link\r
+     * com.ibm.icu.math.BigDecimal#ROUND_HALF_EVEN ROUND_HALF_EVEN}) for formatting,\r
+     * and to parse only the integer part of an input string (see {@link\r
+     * #isParseIntegerOnly isParseIntegerOnly}).\r
+     *\r
+     * @param inLocale the locale for which a number format is needed\r
+     * @return a number format for integer values\r
+     * @stable ICU 3.2\r
+     */\r
+    public static NumberFormat getIntegerInstance(ULocale inLocale) {\r
+        return getInstance(inLocale, INTEGERSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns a currency format for the current default locale.\r
+     * @return a number format for currency\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static NumberFormat getCurrencyInstance() {\r
+        return getInstance(ULocale.getDefault(), CURRENCYSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns a currency format for the specified locale.\r
+     * @return a number format for currency\r
+     * @stable ICU 2.0\r
+     */\r
+    public static NumberFormat getCurrencyInstance(Locale inLocale) {\r
+        return getInstance(ULocale.forLocale(inLocale), CURRENCYSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a currency format for the specified locale.\r
+     * @return a number format for currency\r
+     * @stable ICU 3.2\r
+     */\r
+    public static NumberFormat getCurrencyInstance(ULocale inLocale) {\r
+        return getInstance(inLocale, CURRENCYSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns a percentage format for the current default locale.\r
+     * @return a number format for percents\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static NumberFormat getPercentInstance() {\r
+        return getInstance(ULocale.getDefault(), PERCENTSTYLE);\r
+    }\r
+\r
+    /**\r
+     * Returns a percentage format for the specified locale.\r
+     * @return a number format for percents\r
+     * @stable ICU 2.0\r
+     */\r
+    public static NumberFormat getPercentInstance(Locale inLocale) {\r
+        return getInstance(ULocale.forLocale(inLocale), PERCENTSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a percentage format for the specified locale.\r
+     * @return a number format for percents\r
+     * @stable ICU 3.2\r
+     */\r
+    public static NumberFormat getPercentInstance(ULocale inLocale) {\r
+        return getInstance(inLocale, PERCENTSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a scientific format for the current default locale.\r
+     * @return a scientific number format\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static NumberFormat getScientificInstance() {\r
+        return getInstance(ULocale.getDefault(), SCIENTIFICSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a scientific format for the specified locale.\r
+     * @return a scientific number format\r
+     * @stable ICU 2.0\r
+     */\r
+    public static NumberFormat getScientificInstance(Locale inLocale) {\r
+        return getInstance(ULocale.forLocale(inLocale), SCIENTIFICSTYLE);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a scientific format for the specified locale.\r
+     * @return a scientific number format\r
+     * @stable ICU 3.2\r
+     */\r
+    public static NumberFormat getScientificInstance(ULocale inLocale) {\r
+        return getInstance(inLocale, SCIENTIFICSTYLE);\r
+    }\r
+\r
+    /**\r
+     * A NumberFormatFactory is used to register new number formats.  The factory\r
+     * should be able to create any of the predefined formats for each locale it\r
+     * supports.  When registered, the locales it supports extend or override the\r
+     * locales already supported by ICU.\r
+     *\r
+     * <p><b>Note:</b> as of ICU4J 3.2, the default API for NumberFormatFactory uses\r
+     * ULocale instead of Locale.  Instead of overriding createFormat(Locale, int),\r
+     * new implementations should override createFactory(ULocale, int).  Note that\r
+     * one of these two methods <b>MUST</b> be overridden or else an infinite\r
+     * loop will occur.\r
+     *\r
+     * @stable ICU 2.6\r
+     */\r
+    public static abstract class NumberFormatFactory {\r
+        /**\r
+         * Value passed to format requesting a default number format.\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int FORMAT_NUMBER = NUMBERSTYLE;\r
+\r
+        /**\r
+         * Value passed to format requesting a currency format.\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int FORMAT_CURRENCY = CURRENCYSTYLE;\r
+\r
+        /**\r
+         * Value passed to format requesting a percent format.\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int FORMAT_PERCENT = PERCENTSTYLE;\r
+\r
+        /**\r
+         * Value passed to format requesting a scientific format.\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int FORMAT_SCIENTIFIC = SCIENTIFICSTYLE;\r
+\r
+        /**\r
+         * Value passed to format requesting an integer format.\r
+         * @stable ICU 2.6\r
+         */\r
+        public static final int FORMAT_INTEGER = INTEGERSTYLE;\r
+\r
+        /**\r
+         * Returns true if this factory is visible.  Default is true.\r
+         * If not visible, the locales supported by this factory will not\r
+         * be listed by getAvailableLocales.  This value must not change.\r
+         * @return true if the factory is visible.\r
+         * @stable ICU 2.6\r
+         */\r
+        public boolean visible() {\r
+            return true;\r
+        }\r
+\r
+        /**\r
+         * Returns an immutable collection of the locale names directly\r
+         * supported by this factory.\r
+         * @return the supported locale names.\r
+         * @stable ICU 2.6\r
+         */\r
+         public abstract Set<String> getSupportedLocaleNames();\r
+\r
+        /**\r
+         * Returns a number format of the appropriate type.  If the locale\r
+         * is not supported, return null.  If the locale is supported, but\r
+         * the type is not provided by this service, return null.  Otherwise\r
+         * return an appropriate instance of NumberFormat.\r
+         * <b>Note:</b> as of ICU4J 3.2, implementations should override\r
+         * this method instead of createFormat(Locale, int).\r
+         * @param loc the locale for which to create the format\r
+         * @param formatType the type of format\r
+         * @return the NumberFormat, or null.\r
+         * @stable ICU 3.2\r
+         */\r
+        public NumberFormat createFormat(ULocale loc, int formatType) {\r
+            return createFormat(loc.toLocale(), formatType);\r
+        }\r
+\r
+        /**\r
+         * Returns a number format of the appropriate type.  If the locale\r
+         * is not supported, return null.  If the locale is supported, but\r
+         * the type is not provided by this service, return null.  Otherwise\r
+         * return an appropriate instance of NumberFormat.\r
+         * <b>Note:</b> as of ICU4J 3.2, createFormat(ULocale, int) should be\r
+         * overridden instead of this method.  This method is no longer\r
+         * abstract and delegates to that method.\r
+         * @param loc the locale for which to create the format\r
+         * @param formatType the type of format\r
+         * @return the NumberFormat, or null.\r
+         * @stable ICU 2.6\r
+         */\r
+        public NumberFormat createFormat(Locale loc, int formatType) {\r
+            return createFormat(ULocale.forLocale(loc), formatType);\r
+        }\r
+\r
+        /**\r
+         * @stable ICU 2.6\r
+         */\r
+        protected NumberFormatFactory() {\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Returns the list of Locales for which NumberFormats are available.\r
+     * @return the available locales\r
+     * @stable ICU 2.0\r
+     */\r
+    public static Locale[] getAvailableLocales() {\r
+        return java.text.NumberFormat.getAvailableLocales();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the list of Locales for which NumberFormats are available.\r
+     * @return the available locales\r
+     * @draft ICU 3.2 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static ULocale[] getAvailableULocales() {\r
+        if (availableULocales == null) {\r
+            synchronized (NumberFormat.class) {\r
+                if (availableULocales == null) {\r
+                    Locale[] locales = java.text.NumberFormat.getAvailableLocales();\r
+                    ULocale[] ulocales = new ULocale[locales.length];\r
+                    for (int i = 0; i < locales.length; ++i) {\r
+                        ulocales[i] = ULocale.forLocale(locales[i]);\r
+                    }\r
+                    availableULocales = ulocales;\r
+                }\r
+            }\r
+        }\r
+        return (ULocale[])availableULocales.clone();\r
+    }\r
+    private static volatile ULocale[] availableULocales;\r
+\r
+    /**\r
+     * {@icu} Registers a new NumberFormatFactory.  The factory is adopted by\r
+     * the service and must not be modified.  The returned object is a\r
+     * key that can be used to unregister this factory.\r
+     * @param factory the factory to register\r
+     * @return a key with which to unregister the factory\r
+     * @stable ICU 2.6\r
+     */\r
+    public static Object registerFactory(NumberFormatFactory factory) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Unregisters the factory or instance associated with this key (obtained from\r
+     * registerInstance or registerFactory).\r
+     * @param registryKey a key obtained from registerFactory\r
+     * @return true if the object was successfully unregistered\r
+     * @stable ICU 2.6\r
+     */\r
+    public static boolean unregister(Object registryKey) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Overrides hashCode.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int hashCode() {\r
+        return numberFormat.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Overrides equals.\r
+     * Two NumberFormats are equal if they are of the same class\r
+     * and the settings (groupingUsed, parseIntegerOnly, maximumIntegerDigits, etc.\r
+     * are equal.\r
+     * @param obj the object to compare against\r
+     * @return true if the object is equal to this.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean equals(Object obj) {\r
+        try {\r
+            return numberFormat.equals(((NumberFormat)obj).numberFormat);\r
+        }\r
+        catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Overrides clone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone() {\r
+        return new NumberFormat((java.text.NumberFormat)numberFormat.clone());\r
+    }\r
+\r
+    /**\r
+     * Returns true if grouping is used in this format. For example, in the\r
+     * en_US locale, with grouping on, the number 1234567 will be formatted\r
+     * as "1,234,567". The grouping separator as well as the size of each group\r
+     * is locale-dependent and is determined by subclasses of NumberFormat.\r
+     * Grouping affects both parsing and formatting.\r
+     * @return true if grouping is used\r
+     * @see #setGroupingUsed\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isGroupingUsed() {\r
+        return numberFormat.isGroupingUsed();\r
+    }\r
+\r
+    /**\r
+     * Sets whether or not grouping will be used in this format.  Grouping\r
+     * affects both parsing and formatting.\r
+     * @see #isGroupingUsed\r
+     * @param newValue true to use grouping.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setGroupingUsed(boolean newValue) {\r
+        numberFormat.setGroupingUsed(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the maximum number of digits allowed in the integer portion of a\r
+     * number.  The default value is 40, which subclasses can override.\r
+     * When formatting, the exact behavior when this value is exceeded is\r
+     * subclass-specific.  When parsing, this has no effect.\r
+     * @return the maximum number of integer digits\r
+     * @see #setMaximumIntegerDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getMaximumIntegerDigits() {\r
+        return numberFormat.getMaximumIntegerDigits();\r
+    }\r
+\r
+    /**\r
+     * Sets the maximum number of digits allowed in the integer portion of a\r
+     * number. This must be >= minimumIntegerDigits.  If the\r
+     * new value for maximumIntegerDigits is less than the current value\r
+     * of minimumIntegerDigits, then minimumIntegerDigits will also be set to\r
+     * the new value.\r
+     * @param newValue the maximum number of integer digits to be shown; if\r
+     * less than zero, then zero is used.  Subclasses might enforce an\r
+     * upper limit to this value appropriate to the numeric type being formatted.\r
+     * @see #getMaximumIntegerDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMaximumIntegerDigits(int newValue) {\r
+        numberFormat.setMaximumIntegerDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the minimum number of digits allowed in the integer portion of a\r
+     * number.  The default value is 1, which subclasses can override.\r
+     * When formatting, if this value is not reached, numbers are padded on the\r
+     * left with the locale-specific '0' character to ensure at least this\r
+     * number of integer digits.  When parsing, this has no effect.\r
+     * @return the minimum number of integer digits\r
+     * @see #setMinimumIntegerDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getMinimumIntegerDigits() {\r
+        return numberFormat.getMinimumIntegerDigits();\r
+    }\r
+\r
+    /**\r
+     * Sets the minimum number of digits allowed in the integer portion of a\r
+     * number.  This must be <= maximumIntegerDigits.  If the\r
+     * new value for minimumIntegerDigits is more than the current value\r
+     * of maximumIntegerDigits, then maximumIntegerDigits will also be set to\r
+     * the new value.\r
+     * @param newValue the minimum number of integer digits to be shown; if\r
+     * less than zero, then zero is used. Subclasses might enforce an\r
+     * upper limit to this value appropriate to the numeric type being formatted.\r
+     * @see #getMinimumIntegerDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMinimumIntegerDigits(int newValue) {\r
+        numberFormat.setMinimumIntegerDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the maximum number of digits allowed in the fraction\r
+     * portion of a number.  The default value is 3, which subclasses\r
+     * can override.  When formatting, the exact behavior when this\r
+     * value is exceeded is subclass-specific.  When parsing, this has\r
+     * no effect.\r
+     * @return the maximum number of fraction digits\r
+     * @see #setMaximumFractionDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getMaximumFractionDigits() {\r
+        return numberFormat.getMaximumFractionDigits();\r
+    }\r
+\r
+    /**\r
+     * Sets the maximum number of digits allowed in the fraction portion of a\r
+     * number. This must be >= minimumFractionDigits.  If the\r
+     * new value for maximumFractionDigits is less than the current value\r
+     * of minimumFractionDigits, then minimumFractionDigits will also be set to\r
+     * the new value.\r
+     * @param newValue the maximum number of fraction digits to be shown; if\r
+     * less than zero, then zero is used. The concrete subclass may enforce an\r
+     * upper limit to this value appropriate to the numeric type being formatted.\r
+     * @see #getMaximumFractionDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMaximumFractionDigits(int newValue) {\r
+        numberFormat.setMaximumFractionDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * Returns the minimum number of digits allowed in the fraction portion of a\r
+     * number.  The default value is 0, which subclasses can override.\r
+     * When formatting, if this value is not reached, numbers are padded on\r
+     * the right with the locale-specific '0' character to ensure at least\r
+     * this number of fraction digits.  When parsing, this has no effect.\r
+     * @return the minimum number of fraction digits\r
+     * @see #setMinimumFractionDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getMinimumFractionDigits() {\r
+        return numberFormat.getMinimumFractionDigits();\r
+    }\r
+\r
+    /**\r
+     * Sets the minimum number of digits allowed in the fraction portion of a\r
+     * number.  This must be <= maximumFractionDigits.  If the\r
+     * new value for minimumFractionDigits exceeds the current value\r
+     * of maximumFractionDigits, then maximumFractionDigits will also be set to\r
+     * the new value.\r
+     * @param newValue the minimum number of fraction digits to be shown; if\r
+     * less than zero, then zero is used.  Subclasses might enforce an\r
+     * upper limit to this value appropriate to the numeric type being formatted.\r
+     * @see #getMinimumFractionDigits\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMinimumFractionDigits(int newValue) {\r
+        numberFormat.setMinimumFractionDigits(newValue);\r
+    }\r
+\r
+    /**\r
+     * Sets the <tt>Currency</tt> object used to display currency\r
+     * amounts.  This takes effect immediately, if this format is a\r
+     * currency format.  If this format is not a currency format, then\r
+     * the currency object is used if and when this object becomes a\r
+     * currency format.\r
+     * @param theCurrency new currency object to use.  May be null for\r
+     * some subclasses.\r
+     * @stable ICU 2.6\r
+     */\r
+    public void setCurrency(Currency theCurrency) {\r
+        numberFormat.setCurrency(theCurrency.currency);\r
+    }\r
+\r
+    /**\r
+     * Returns the <tt>Currency</tt> object used to display currency\r
+     * amounts.  This may be null.\r
+     * @stable ICU 2.6\r
+     */\r
+    public Currency getCurrency() {\r
+        return new Currency(numberFormat.getCurrency());\r
+    }\r
+\r
+    /**\r
+     * Returns the rounding mode used in this NumberFormat.  The default implementation of\r
+     * tis method in NumberFormat always throws <code>UnsupportedOperationException</code>.\r
+     * @return A rounding mode, between <code>BigDecimal.ROUND_UP</code>\r
+     * and <code>BigDecimal.ROUND_UNNECESSARY</code>.\r
+     * @see #setRoundingMode(int)\r
+     * @stable ICU 4.0\r
+     */\r
+    public int getRoundingMode() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Set the rounding mode used in this NumberFormat.  The default implementation of\r
+     * tis method in NumberFormat always throws <code>UnsupportedOperationException</code>.\r
+     * @param roundingMode A rounding mode, between\r
+     * <code>BigDecimal.ROUND_UP</code> and\r
+     * <code>BigDecimal.ROUND_UNNECESSARY</code>.\r
+     * @see #getRoundingMode()\r
+     * @stable ICU 4.0\r
+     */\r
+    public void setRoundingMode(int roundingMode) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+\r
+    /**\r
+     * Returns a specific style number format for a specific locale.\r
+     * @param desiredLocale  the specific locale.\r
+     * @param choice         number format style\r
+     * @throws IllegalArgumentException  if choice is not one of\r
+     *                                   NUMBERSTYLE, CURRENCYSTYLE,\r
+     *                                   PERCENTSTYLE, SCIENTIFICSTYLE,\r
+     *                                   INTEGERSTYLE,\r
+     *                                   ISOCURRENCYSTYLE, PLURALCURRENCYSTYLE,\r
+     * @stable ICU 4.2\r
+     */\r
+    public static NumberFormat getInstance(ULocale desiredLocale, int choice) {\r
+        Locale locale = desiredLocale.toLocale();\r
+        java.text.NumberFormat nf = null;\r
+        switch (choice) {\r
+        case NUMBERSTYLE:\r
+            nf = java.text.NumberFormat.getInstance(locale);\r
+            break;\r
+        case INTEGERSTYLE:\r
+            nf = java.text.NumberFormat.getIntegerInstance(locale);\r
+            break;\r
+        case CURRENCYSTYLE:\r
+            nf = java.text.NumberFormat.getCurrencyInstance(locale);\r
+            break;\r
+        case PERCENTSTYLE:\r
+            nf = java.text.NumberFormat.getPercentInstance(locale);\r
+            break;\r
+        case SCIENTIFICSTYLE:\r
+            nf = new java.text.DecimalFormat("#E0",\r
+                    new java.text.DecimalFormatSymbols(locale));\r
+            nf.setMaximumFractionDigits(10);\r
+            break;\r
+        }\r
+        return new NumberFormat(nf);\r
+    }\r
+\r
+    /**\r
+     * Empty constructor.  Public for compatibily with JDK which lets the\r
+     * compiler generate a default public constructor even though this is\r
+     * an abstract class.\r
+     * @stable ICU 2.6\r
+     */\r
+    public NumberFormat() {\r
+        this(java.text.NumberFormat.getInstance());\r
+    }\r
+\r
+    /**\r
+     * The instances of this inner class are used as attribute keys and values\r
+     * in AttributedCharacterIterator that\r
+     * NumberFormat.formatToCharacterIterator() method returns.\r
+     * <p>\r
+     * There is no public constructor to this class, the only instances are the\r
+     * constants defined here.\r
+     * <p>\r
+     * @stable ICU 3.6\r
+     */\r
+    public static class Field extends Format.Field {\r
+        // generated by serialver from JDK 1.4.1_01\r
+        static final long serialVersionUID = -4516273749929385842L;\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field SIGN = new Field("sign");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field INTEGER = new Field("integer");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field FRACTION = new Field("fraction");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field EXPONENT = new Field("exponent");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field EXPONENT_SIGN = new Field("exponent sign");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field EXPONENT_SYMBOL = new Field("exponent symbol");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field DECIMAL_SEPARATOR = new Field("decimal separator");\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field GROUPING_SEPARATOR = new Field("grouping separator");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field PERCENT = new Field("percent");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field PERMILLE = new Field("per mille");\r
+\r
+        /**\r
+         * @stable ICU 3.6\r
+         */\r
+        public static final Field CURRENCY = new Field("currency");\r
+\r
+        /**\r
+         * Constructs a new instance of NumberFormat.Field with the given field\r
+         * name.\r
+         * @stable ICU 3.6\r
+         */\r
+        protected Field(String fieldName) {\r
+            super(fieldName);\r
+        }\r
+\r
+        /**\r
+         * serizalization method resolve instances to the constant\r
+         * NumberFormat.Field values\r
+         * @stable ICU 3.6\r
+         */\r
+        protected Object readResolve() throws InvalidObjectException {\r
+            if (this.getName().equals(INTEGER.getName()))\r
+                return INTEGER;\r
+            if (this.getName().equals(FRACTION.getName()))\r
+                return FRACTION;\r
+            if (this.getName().equals(EXPONENT.getName()))\r
+                return EXPONENT;\r
+            if (this.getName().equals(EXPONENT_SIGN.getName()))\r
+                return EXPONENT_SIGN;\r
+            if (this.getName().equals(EXPONENT_SYMBOL.getName()))\r
+                return EXPONENT_SYMBOL;\r
+            if (this.getName().equals(CURRENCY.getName()))\r
+                return CURRENCY;\r
+            if (this.getName().equals(DECIMAL_SEPARATOR.getName()))\r
+                return DECIMAL_SEPARATOR;\r
+            if (this.getName().equals(GROUPING_SEPARATOR.getName()))\r
+                return GROUPING_SEPARATOR;\r
+            if (this.getName().equals(PERCENT.getName()))\r
+                return PERCENT;\r
+            if (this.getName().equals(PERMILLE.getName()))\r
+                return PERMILLE;\r
+            if (this.getName().equals(SIGN.getName()))\r
+                return SIGN;\r
+\r
+            throw new InvalidObjectException("An invalid object.");\r
+        }\r
+    }\r
+\r
+    private static FieldPosition toJDKFieldPosition(FieldPosition icuPos) {\r
+        if (icuPos == null) {\r
+            return null;\r
+        }\r
+\r
+        int fieldID = icuPos.getField();\r
+        Format.Field fieldAttribute = icuPos.getFieldAttribute();\r
+\r
+        FieldPosition jdkPos = null;\r
+\r
+        if (fieldID >= 0) {\r
+            if (fieldID == FRACTION_FIELD) {\r
+                fieldID = java.text.NumberFormat.FRACTION_FIELD;\r
+            } else if (fieldID == INTEGER_FIELD) {\r
+                fieldID = java.text.NumberFormat.INTEGER_FIELD;\r
+            }\r
+        }\r
+\r
+        if (fieldAttribute != null) {\r
+            // map field\r
+            if (fieldAttribute.equals(Field.CURRENCY)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.CURRENCY;\r
+            } else if (fieldAttribute.equals(Field.DECIMAL_SEPARATOR)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.DECIMAL_SEPARATOR;\r
+            } else if (fieldAttribute.equals(Field.EXPONENT)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.EXPONENT;\r
+            } else if (fieldAttribute.equals(Field.EXPONENT_SIGN)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.EXPONENT_SIGN;\r
+            } else if (fieldAttribute.equals(Field.EXPONENT_SYMBOL)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.EXPONENT_SYMBOL;\r
+            } else if (fieldAttribute.equals(Field.FRACTION)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.FRACTION;\r
+            } else if (fieldAttribute.equals(Field.GROUPING_SEPARATOR)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.GROUPING_SEPARATOR;\r
+            } else if (fieldAttribute.equals(Field.INTEGER)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.INTEGER;\r
+            } else if (fieldAttribute.equals(Field.PERCENT)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.PERCENT;\r
+            } else if (fieldAttribute.equals(Field.PERMILLE)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.PERMILLE;\r
+            } else if (fieldAttribute.equals(Field.SIGN)) {\r
+                fieldAttribute = java.text.NumberFormat.Field.SIGN;\r
+            }\r
+\r
+            jdkPos = new FieldPosition(fieldAttribute, fieldID);\r
+        } else {\r
+            jdkPos = new FieldPosition(fieldID);\r
+        }\r
+\r
+        jdkPos.setBeginIndex(icuPos.getBeginIndex());\r
+        jdkPos.setEndIndex(icuPos.getEndIndex());\r
+\r
+        return jdkPos;\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/RawCollationKey.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/RawCollationKey.java
new file mode 100644 (file)
index 0000000..71fcb59
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2011, International Business Machines Corporation and         *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.text;\r
+\r
+/*\r
+ * Empty stub\r
+ */\r
+public class RawCollationKey {\r
+    private RawCollationKey() {}\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/SimpleDateFormat.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/SimpleDateFormat.java
new file mode 100644 (file)
index 0000000..befcaa6
--- /dev/null
@@ -0,0 +1,514 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 1996-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+\r
+package com.ibm.icu.text;\r
+\r
+import java.text.AttributedCharacterIterator;\r
+import java.text.AttributedCharacterIterator.Attribute;\r
+import java.text.AttributedString;\r
+import java.text.CharacterIterator;\r
+import java.text.FieldPosition;\r
+import java.text.ParsePosition;\r
+import java.util.Date;\r
+import java.util.Locale;\r
+import java.util.Map;\r
+import java.util.Map.Entry;\r
+\r
+import com.ibm.icu.util.Calendar;\r
+import com.ibm.icu.util.ULocale;\r
+\r
+\r
+/**\r
+ * {@icuenhanced java.text.SimpleDateFormat}.{@icu _usage_}\r
+ *\r
+ * <p><code>SimpleDateFormat</code> is a concrete class for formatting and\r
+ * parsing dates in a locale-sensitive manner. It allows for formatting\r
+ * (date -> text), parsing (text -> date), and normalization.\r
+ *\r
+ * <p>\r
+ * <code>SimpleDateFormat</code> allows you to start by choosing\r
+ * any user-defined patterns for date-time formatting. However, you\r
+ * are encouraged to create a date-time formatter with either\r
+ * <code>getTimeInstance</code>, <code>getDateInstance</code>, or\r
+ * <code>getDateTimeInstance</code> in <code>DateFormat</code>. Each\r
+ * of these class methods can return a date/time formatter initialized\r
+ * with a default format pattern. You may modify the format pattern\r
+ * using the <code>applyPattern</code> methods as desired.\r
+ * For more information on using these methods, see\r
+ * {@link DateFormat}.\r
+ *\r
+ * <p>\r
+ * <strong>Time Format Syntax:</strong>\r
+ * <p>\r
+ * To specify the time format use a <em>time pattern</em> string.\r
+ * In this pattern, all ASCII letters are reserved as pattern letters,\r
+ * which are defined as the following:\r
+ * <blockquote>\r
+ * <pre>\r
+ * Symbol   Meaning                 Presentation        Example\r
+ * ------   -------                 ------------        -------\r
+ * G        era designator          (Text)              AD\r
+ * y&#x2020;       year                    (Number)            1996\r
+ * Y*       year (week of year)     (Number)            1997\r
+ * u*       extended year           (Number)            4601\r
+ * M        month in year           (Text & Number)     July & 07\r
+ * d        day in month            (Number)            10\r
+ * h        hour in am/pm (1~12)    (Number)            12\r
+ * H        hour in day (0~23)      (Number)            0\r
+ * m        minute in hour          (Number)            30\r
+ * s        second in minute        (Number)            55\r
+ * S        fractional second       (Number)            978\r
+ * E        day of week             (Text)              Tuesday\r
+ * e*       day of week (local 1~7) (Text & Number)     Tuesday & 2\r
+ * D        day in year             (Number)            189\r
+ * F        day of week in month    (Number)            2 (2nd Wed in July)\r
+ * w        week in year            (Number)            27\r
+ * W        week in month           (Number)            2\r
+ * a        am/pm marker            (Text)              PM\r
+ * k        hour in day (1~24)      (Number)            24\r
+ * K        hour in am/pm (0~11)    (Number)            0\r
+ * z        time zone               (Text)              Pacific Standard Time\r
+ * Z        time zone (RFC 822)     (Number)            -0800\r
+ * v        time zone (generic)     (Text)              Pacific Time\r
+ * V        time zone (location)    (Text)              United States (Los Angeles)\r
+ * g*       Julian day              (Number)            2451334\r
+ * A*       milliseconds in day     (Number)            69540000\r
+ * Q*       quarter in year         (Text & Number)     Q1 & 01\r
+ * c*       stand alone day of week (Text & Number)     Tuesday & 2\r
+ * L*       stand alone month       (Text & Number)     July & 07\r
+ * q*       stand alone quarter     (Text & Number)     Q1 & 01\r
+ * '        escape for text         (Delimiter)         'Date='\r
+ * ''       single quote            (Literal)           'o''clock'\r
+ * </pre>\r
+ * </blockquote>\r
+ * <tt><b>*</b></tt> These items are not supported by Java's SimpleDateFormat.<br>\r
+ * <tt><b>&#x2020;</b></tt> ICU interprets a single 'y' differently than Java.</p>\r
+ * <p>\r
+ * The count of pattern letters determine the format.\r
+ * <p>\r
+ * <strong>(Text)</strong>: 4 or more pattern letters--use full form,\r
+ * &lt; 4--use short or abbreviated form if one exists.\r
+ * <p>\r
+ * <strong>(Number)</strong>: the minimum number of digits. Shorter\r
+ * numbers are zero-padded to this amount. Year is handled specially;\r
+ * that is, if the count of 'y' is 2, the Year will be truncated to 2 digits.\r
+ * (e.g., if "yyyy" produces "1997", "yy" produces "97".)\r
+ * Unlike other fields, fractional seconds are padded on the right with zero.\r
+ * <p>\r
+ * <strong>(Text & Number)</strong>: 3 or over, use text, otherwise use number.\r
+ * <p>\r
+ * Any characters in the pattern that are not in the ranges of ['a'..'z']\r
+ * and ['A'..'Z'] will be treated as quoted text. For instance, characters\r
+ * like ':', '.', ' ', '#' and '@' will appear in the resulting time text\r
+ * even they are not embraced within single quotes.\r
+ * <p>\r
+ * A pattern containing any invalid pattern letter will result in a thrown\r
+ * exception during formatting or parsing.\r
+ *\r
+ * <p>\r
+ * <strong>Examples Using the US Locale:</strong>\r
+ * <blockquote>\r
+ * <pre>\r
+ * Format Pattern                         Result\r
+ * --------------                         -------\r
+ * "yyyy.MM.dd G 'at' HH:mm:ss vvvv" ->>  1996.07.10 AD at 15:08:56 Pacific Time\r
+ * "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96\r
+ * "h:mm a"                          ->>  12:08 PM\r
+ * "hh 'o''clock' a, zzzz"           ->>  12 o'clock PM, Pacific Daylight Time\r
+ * "K:mm a, vvv"                     ->>  0:00 PM, PT\r
+ * "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  01996.July.10 AD 12:08 PM\r
+ * </pre>\r
+ * </blockquote>\r
+ * <strong>Code Sample:</strong>\r
+ * <blockquote>\r
+ * <pre>\r
+ * SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");\r
+ * pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2*60*60*1000);\r
+ * pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2*60*60*1000);\r
+ * <br>\r
+ * // Format the current time.\r
+ * SimpleDateFormat formatter\r
+ *     = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz");\r
+ * Date currentTime_1 = new Date();\r
+ * String dateString = formatter.format(currentTime_1);\r
+ * <br>\r
+ * // Parse the previous string back into a Date.\r
+ * ParsePosition pos = new ParsePosition(0);\r
+ * Date currentTime_2 = formatter.parse(dateString, pos);\r
+ * </pre>\r
+ * </blockquote>\r
+ * In the example, the time value <code>currentTime_2</code> obtained from\r
+ * parsing will be equal to <code>currentTime_1</code>. However, they may not be\r
+ * equal if the am/pm marker 'a' is left out from the format pattern while\r
+ * the "hour in am/pm" pattern symbol is used. This information loss can\r
+ * happen when formatting the time in PM.\r
+ *\r
+ * <p>When parsing a date string using the abbreviated year pattern ("yy"),\r
+ * SimpleDateFormat must interpret the abbreviated year\r
+ * relative to some century.  It does this by adjusting dates to be\r
+ * within 80 years before and 20 years after the time the SimpleDateFormat\r
+ * instance is created. For example, using a pattern of "MM/dd/yy" and a\r
+ * SimpleDateFormat instance created on Jan 1, 1997,  the string\r
+ * "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64"\r
+ * would be interpreted as May 4, 1964.\r
+ * During parsing, only strings consisting of exactly two digits, as defined by\r
+ * {@link com.ibm.icu.lang.UCharacter#isDigit(int)}, will be parsed into the default\r
+ * century.\r
+ * Any other numeric string, such as a one digit string, a three or more digit\r
+ * string, or a two digit string that isn't all digits (for example, "-1"), is\r
+ * interpreted literally.  So "01/02/3" or "01/02/003" are parsed, using the\r
+ * same pattern, as Jan 2, 3 AD.  Likewise, "01/02/-3" is parsed as Jan 2, 4 BC.\r
+ *\r
+ * <p>If the year pattern does not have exactly two 'y' characters, the year is\r
+ * interpreted literally, regardless of the number of digits.  So using the\r
+ * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D.\r
+ *\r
+ * <p>When numeric fields abut one another directly, with no intervening delimiter\r
+ * characters, they constitute a run of abutting numeric fields.  Such runs are\r
+ * parsed specially.  For example, the format "HHmmss" parses the input text\r
+ * "123456" to 12:34:56, parses the input text "12345" to 1:23:45, and fails to\r
+ * parse "1234".  In other words, the leftmost field of the run is flexible,\r
+ * while the others keep a fixed width.  If the parse fails anywhere in the run,\r
+ * then the leftmost field is shortened by one character, and the entire run is\r
+ * parsed again. This is repeated until either the parse succeeds or the\r
+ * leftmost field is one character in length.  If the parse still fails at that\r
+ * point, the parse of the run fails.\r
+ *\r
+ * <p>For time zones that have no names, use strings GMT+hours:minutes or\r
+ * GMT-hours:minutes.\r
+ *\r
+ * <p>The calendar defines what is the first day of the week, the first week\r
+ * of the year, whether hours are zero based or not (0 vs 12 or 24), and the\r
+ * time zone. There is one common decimal format to handle all the numbers;\r
+ * the digit count is handled programmatically according to the pattern.\r
+ *\r
+ * <h4>Synchronization</h4>\r
+ *\r
+ * Date formats are not synchronized. It is recommended to create separate\r
+ * format instances for each thread. If multiple threads access a format\r
+ * concurrently, it must be synchronized externally.\r
+ *\r
+ * @see          com.ibm.icu.util.Calendar\r
+ * @see          com.ibm.icu.util.GregorianCalendar\r
+ * @see          com.ibm.icu.util.TimeZone\r
+ * @see          DateFormat\r
+ * @see          DateFormatSymbols\r
+ * @see          DecimalFormat\r
+ * @author       Mark Davis, Chen-Lieh Huang, Alan Liu\r
+ * @stable ICU 2.0\r
+ */\r
+public class SimpleDateFormat extends DateFormat {\r
+    private static final long serialVersionUID = 1L;\r
+\r
+    /**\r
+     * Constructs a SimpleDateFormat using the default pattern for the default\r
+     * locale.  <b>Note:</b> Not all locales support SimpleDateFormat; for full\r
+     * generality, use the factory methods in the DateFormat class.\r
+     *\r
+     * @see DateFormat\r
+     * @stable ICU 2.0\r
+     */\r
+    public SimpleDateFormat() {\r
+        super(new java.text.SimpleDateFormat());\r
+    }\r
+\r
+    /**\r
+     * Constructs a SimpleDateFormat using the given pattern in the default\r
+     * locale.  <b>Note:</b> Not all locales support SimpleDateFormat; for full\r
+     * generality, use the factory methods in the DateFormat class.\r
+     * @stable ICU 2.0\r
+     */\r
+    public SimpleDateFormat(String pattern)\r
+    {\r
+        super(new java.text.SimpleDateFormat(pattern));\r
+    }\r
+\r
+    /**\r
+     * Constructs a SimpleDateFormat using the given pattern and locale.\r
+     * <b>Note:</b> Not all locales support SimpleDateFormat; for full\r
+     * generality, use the factory methods in the DateFormat class.\r
+     * @stable ICU 2.0\r
+     */\r
+    public SimpleDateFormat(String pattern, Locale loc)\r
+    {\r
+        super(new java.text.SimpleDateFormat(pattern, loc));\r
+    }\r
+\r
+    /**\r
+     * Constructs a SimpleDateFormat using the given pattern and locale.\r
+     * <b>Note:</b> Not all locales support SimpleDateFormat; for full\r
+     * generality, use the factory methods in the DateFormat class.\r
+     * @stable ICU 3.2\r
+     */\r
+    public SimpleDateFormat(String pattern, ULocale loc)\r
+    {\r
+        this(pattern, loc.toLocale());\r
+    }\r
+\r
+    /**\r
+     * Constructs a SimpleDateFormat using the given pattern , override and locale.\r
+     * @param pattern The pattern to be used\r
+     * @param override The override string.  A numbering system override string can take one of the following forms:\r
+     *     1). If just a numbering system name is specified, it applies to all numeric fields in the date format pattern.\r
+     *     2). To specify an alternate numbering system on a field by field basis, use the field letters from the pattern\r
+     *         followed by an = sign, followed by the numbering system name.  For example, to specify that just the year\r
+     *         be formatted using Hebrew digits, use the override "y=hebr".  Multiple overrides can be specified in a single\r
+     *         string by separating them with a semi-colon. For example, the override string "m=thai;y=deva" would format using\r
+     *         Thai digits for the month and Devanagari digits for the year.\r
+     * @param loc The locale to be used\r
+     * @stable ICU 4.2\r
+     */\r
+    public SimpleDateFormat(String pattern, String override, ULocale loc)\r
+    {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Constructs a SimpleDateFormat using the given pattern and\r
+     * locale-specific symbol data.\r
+     * Warning: uses default locale for digits!\r
+     * @stable ICU 2.0\r
+     */\r
+    public SimpleDateFormat(String pattern, DateFormatSymbols formatData)\r
+    {\r
+        super(new java.text.SimpleDateFormat(pattern, formatData.dfs));\r
+    }\r
+\r
+    /**\r
+     * Sets the 100-year period 2-digit years will be interpreted as being in\r
+     * to begin on the date the user specifies.\r
+     * @param startDate During parsing, two digit years will be placed in the range\r
+     * <code>startDate</code> to <code>startDate + 100 years</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void set2DigitYearStart(Date startDate) {\r
+        ((java.text.SimpleDateFormat)dateFormat).set2DigitYearStart(startDate);\r
+    }\r
+\r
+    /**\r
+     * Returns the beginning date of the 100-year period 2-digit years are interpreted\r
+     * as being within.\r
+     * @return the start of the 100-year period into which two digit years are\r
+     * parsed\r
+     * @stable ICU 2.0\r
+     */\r
+    public Date get2DigitYearStart() {\r
+        return ((java.text.SimpleDateFormat)dateFormat).get2DigitYearStart();\r
+    }\r
+\r
+    /**\r
+     * Formats a date or time, which is the standard millis\r
+     * since January 1, 1970, 00:00:00 GMT.\r
+     * <p>Example: using the US locale:\r
+     * "yyyy.MM.dd G 'at' HH:mm:ss zzz" ->> 1996.07.10 AD at 15:08:56 PDT\r
+     * @param cal the calendar whose date-time value is to be formatted into a date-time string\r
+     * @param toAppendTo where the new date-time text is to be appended\r
+     * @param pos the formatting position. On input: an alignment field,\r
+     * if desired. On output: the offsets of the alignment field.\r
+     * @return the formatted date-time string.\r
+     * @see DateFormat\r
+     * @stable ICU 2.0\r
+     */\r
+    public StringBuffer format(Calendar cal, StringBuffer toAppendTo,\r
+                               FieldPosition pos) {\r
+        StringBuffer result;\r
+        FieldPosition jdkPos = toJDKFieldPosition(pos);\r
+        synchronized(dateFormat) {\r
+            java.util.Calendar oldCal = dateFormat.getCalendar();\r
+            dateFormat.setCalendar(cal.calendar);\r
+            result = dateFormat.format(cal.getTime(), toAppendTo, jdkPos);\r
+            dateFormat.setCalendar(oldCal);\r
+        }\r
+        if (jdkPos != null) {\r
+            pos.setBeginIndex(jdkPos.getBeginIndex());\r
+            pos.setEndIndex(jdkPos.getEndIndex());\r
+        }\r
+        return result;\r
+    }\r
+\r
+    /**\r
+     * Overrides superclass method\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setNumberFormat(NumberFormat newNumberFormat) {\r
+        super.setNumberFormat(newNumberFormat);\r
+    }\r
+\r
+    /**\r
+     * Overrides DateFormat\r
+     * @see DateFormat\r
+     * @stable ICU 2.0\r
+     */\r
+    public void parse(String text, Calendar cal, ParsePosition parsePos)\r
+    {\r
+        // Note: parsed time zone won't be set in the result calendar\r
+        cal.setTime(dateFormat.parse(text, parsePos));\r
+    }\r
+\r
+    /**\r
+     * Return a pattern string describing this date format.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String toPattern() {\r
+        return ((java.text.SimpleDateFormat)dateFormat).toPattern();\r
+    }\r
+\r
+    /**\r
+     * Return a localized pattern string describing this date format.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String toLocalizedPattern() {\r
+        return ((java.text.SimpleDateFormat)dateFormat).toLocalizedPattern();\r
+    }\r
+\r
+    /**\r
+     * Apply the given unlocalized pattern string to this date format.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void applyPattern(String pat) {\r
+        ((java.text.SimpleDateFormat)dateFormat).applyPattern(pat);\r
+    }\r
+\r
+    /**\r
+     * Apply the given localized pattern string to this date format.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void applyLocalizedPattern(String pat) {\r
+        ((java.text.SimpleDateFormat)dateFormat).applyLocalizedPattern(pat);\r
+    }\r
+\r
+    /**\r
+     * Gets the date/time formatting data.\r
+     * @return a copy of the date-time formatting data associated\r
+     * with this date-time formatter.\r
+     * @stable ICU 2.0\r
+     */\r
+    public DateFormatSymbols getDateFormatSymbols() {\r
+        return new DateFormatSymbols(((java.text.SimpleDateFormat)dateFormat).getDateFormatSymbols());\r
+    }\r
+\r
+    /**\r
+     * Allows you to set the date/time formatting data.\r
+     * @param newFormatSymbols the new symbols\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols) {\r
+        ((java.text.SimpleDateFormat)dateFormat).setDateFormatSymbols(newFormatSymbols.dfs);\r
+    }\r
+\r
+    // For clone to use\r
+    private SimpleDateFormat(java.text.SimpleDateFormat sdf) {\r
+        super(sdf);\r
+    }\r
+\r
+    /**\r
+     * Overrides Cloneable\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone() {\r
+        return new SimpleDateFormat((java.text.SimpleDateFormat)dateFormat.clone());\r
+    }\r
+\r
+    /**\r
+     * Override hashCode.\r
+     * Generates the hash code for the SimpleDateFormat object\r
+     * @stable ICU 2.0\r
+     */\r
+    public int hashCode()\r
+    {\r
+        return super.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Override equals.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean equals(Object obj)\r
+    {\r
+        return super.equals(obj);\r
+    }\r
+\r
+    /**\r
+     * Format the object to an attributed string, and return the corresponding iterator\r
+     * Overrides superclass method.\r
+     *\r
+     * @param obj The object to format\r
+     * @return <code>AttributedCharacterIterator</code> describing the formatted value.\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public AttributedCharacterIterator formatToCharacterIterator(Object obj) {\r
+        AttributedCharacterIterator it = dateFormat.formatToCharacterIterator(obj);\r
+\r
+        // Extract formatted String first\r
+        StringBuilder sb = new StringBuilder();\r
+        for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {\r
+            sb.append(c);\r
+        }\r
+\r
+        // Create AttributedString\r
+        AttributedString attrstr = new AttributedString(sb.toString());\r
+\r
+        // Map JDK Field to ICU Field\r
+        int idx = 0;\r
+        it.first();\r
+        while (idx < it.getEndIndex()) {\r
+            int end = it.getRunLimit();\r
+            Map<Attribute, Object> attributes = it.getAttributes();\r
+            if (attributes != null) {\r
+                for (Entry<Attribute, Object> entry : attributes.entrySet()) {\r
+                    Attribute attr = entry.getKey();\r
+                    Object val = entry.getValue();\r
+                    if (attr.equals(java.text.DateFormat.Field.AM_PM)) {\r
+                        val = attr = Field.AM_PM;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.DAY_OF_MONTH)) {\r
+                        val = attr = Field.DAY_OF_MONTH;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.DAY_OF_WEEK)) {\r
+                        val = attr = Field.DAY_OF_WEEK ;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.DAY_OF_WEEK_IN_MONTH)) {\r
+                        val = attr = Field.DAY_OF_WEEK_IN_MONTH ;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.DAY_OF_YEAR)) {\r
+                        val = attr = Field.DAY_OF_YEAR;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.ERA)) {\r
+                        val = attr = Field.ERA;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.HOUR_OF_DAY0)) {\r
+                        val = attr = Field.HOUR_OF_DAY0;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.HOUR_OF_DAY1)) {\r
+                        val = attr = Field.HOUR_OF_DAY1;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.HOUR0)) {\r
+                        val = attr = Field.HOUR0;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.HOUR1)) {\r
+                        val = attr = Field.HOUR1;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.MILLISECOND)) {\r
+                        val = attr = Field.MILLISECOND;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.MINUTE)) {\r
+                        val = attr = Field.MINUTE;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.MONTH)) {\r
+                        val = attr = Field.MONTH;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.SECOND)) {\r
+                        val = attr = Field.SECOND;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.TIME_ZONE)) {\r
+                        val = attr = Field.TIME_ZONE;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.WEEK_OF_MONTH)) {\r
+                        val = attr = Field.WEEK_OF_MONTH;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.WEEK_OF_YEAR)) {\r
+                        val = attr = Field.WEEK_OF_YEAR;\r
+                    } else if (attr.equals(java.text.DateFormat.Field.YEAR)) {\r
+                        val = attr = Field.YEAR;\r
+                    }\r
+                    attrstr.addAttribute(attr, val, idx, end);\r
+                }\r
+            }\r
+            idx = end;\r
+            while (it.getIndex() < idx) {\r
+                it.next();\r
+            }\r
+        }\r
+\r
+        return attrstr.getIterator();\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UFormat.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UFormat.java
new file mode 100644 (file)
index 0000000..9fc73a6
--- /dev/null
@@ -0,0 +1,80 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2003-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.text;\r
+\r
+import java.text.Format;\r
+\r
+import com.ibm.icu.util.ULocale;\r
+\r
+/**\r
+ * An abstract class that extends {@link java.text.Format} to provide\r
+ * additional ICU protocol, specifically, the <tt>getLocale()</tt>\r
+ * API.  All ICU format classes are subclasses of this class.\r
+ *\r
+ * @see com.ibm.icu.util.ULocale\r
+ * @author weiv\r
+ * @author Alan Liu\r
+ * @draft ICU 2.8 (retain)\r
+ * @provisional This API might change or be removed in a future release.\r
+ */\r
+public abstract class UFormat extends Format {\r
+    private static final long serialVersionUID = 1L;\r
+\r
+    /**\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public UFormat() {}\r
+\r
+    /**\r
+     * Return the locale that was used to create this object, or null.\r
+     * This may may differ from the locale requested at the time of\r
+     * this object's creation.  For example, if an object is created\r
+     * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be\r
+     * drawn from <tt>en</tt> (the <i>actual</i> locale), and\r
+     * <tt>en_US</tt> may be the most specific locale that exists (the\r
+     * <i>valid</i> locale).\r
+     *\r
+     * <p>Note: This method will be implemented in ICU 3.0; ICU 2.8\r
+     * contains a partial preview implementation.  The <i>actual</i>\r
+     * locale is returned correctly, but the <i>valid</i> locale is\r
+     * not, in most cases.\r
+     * @param type type of information requested, either {@link\r
+     * com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link\r
+     * com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.\r
+     * @return the information specified by <i>type</i>, or null if\r
+     * this object was not constructed from locale data.\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public final ULocale getLocale(ULocale.Type type) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Set information about the locales that were used to create this\r
+     * object.  If the object was not constructed from locale data,\r
+     * both arguments should be set to null.  Otherwise, neither\r
+     * should be null.  The actual locale must be at the same level or\r
+     * less specific than the valid locale.  This method is intended\r
+     * for use by factories or other entities that create objects of\r
+     * this class.\r
+     * @param valid the most specific locale containing any resource\r
+     * data, or null\r
+     * @param actual the locale containing data used to construct this\r
+     * object, or null\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     */\r
+    final void setLocale(ULocale valid, ULocale actual) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UnicodeSet.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/text/UnicodeSet.java
new file mode 100644 (file)
index 0000000..1092ba9
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2011, International Business Machines Corporation and         *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.text;\r
+\r
+/*\r
+ * Empty stub\r
+ */\r
+public class UnicodeSet {\r
+    private UnicodeSet() {}\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Calendar.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Calendar.java
new file mode 100644 (file)
index 0000000..739a040
--- /dev/null
@@ -0,0 +1,2345 @@
+/*\r
+*   Copyright (C) 1996-2011, International Business Machines\r
+*   Corporation and others.  All Rights Reserved.\r
+*/\r
+\r
+package com.ibm.icu.util;\r
+\r
+import java.io.Serializable;\r
+import java.util.Date;\r
+import java.util.GregorianCalendar;\r
+import java.util.Locale;\r
+\r
+import com.ibm.icu.text.DateFormat;\r
+\r
+/**\r
+ * {@icuenhanced java.util.Calendar}.{@icu _usage_}\r
+ *\r
+ * <p><code>Calendar</code> is an abstract base class for converting between\r
+ * a <code>Date</code> object and a set of integer fields such as\r
+ * <code>YEAR</code>, <code>MONTH</code>, <code>DAY</code>, <code>HOUR</code>,\r
+ * and so on. (A <code>Date</code> object represents a specific instant in\r
+ * time with millisecond precision. See\r
+ * {@link Date}\r
+ * for information about the <code>Date</code> class.)\r
+ *\r
+ * <p>Subclasses of <code>Calendar</code> interpret a <code>Date</code>\r
+ * according to the rules of a specific calendar system.  ICU4J contains\r
+ * several subclasses implementing different international calendar systems.\r
+ *\r
+ * <p>\r
+ * Like other locale-sensitive classes, <code>Calendar</code> provides a\r
+ * class method, <code>getInstance</code>, for getting a generally useful\r
+ * object of this type. <code>Calendar</code>'s <code>getInstance</code> method\r
+ * returns a calendar of a type appropriate to the locale, whose\r
+ * time fields have been initialized with the current date and time:\r
+ * <blockquote>\r
+ * <pre>Calendar rightNow = Calendar.getInstance()</pre>\r
+ * </blockquote>\r
+ *\r
+ * <p>When a <code>ULocale</code> is used by <code>getInstance</code>, its\r
+ * '<code>calendar</code>' tag and value are retrieved if present.  If a recognized\r
+ * value is supplied, a calendar is provided and configured as appropriate.\r
+ * Currently recognized tags are "buddhist", "chinese", "coptic", "ethiopic",\r
+ * "gregorian", "hebrew", "islamic", "islamic-civil", "japanese", and "roc".  For\r
+ * example: <blockquote>\r
+ * <pre>Calendar cal = Calendar.getInstance(new ULocale("en_US@calendar=japanese"));</pre>\r
+ * </blockquote> will return an instance of JapaneseCalendar (using en_US conventions for\r
+ * minimum days in first week, start day of week, et cetera).\r
+ *\r
+ * <p>A <code>Calendar</code> object can produce all the time field values\r
+ * needed to implement the date-time formatting for a particular language and\r
+ * calendar style (for example, Japanese-Gregorian, Japanese-Traditional).\r
+ * <code>Calendar</code> defines the range of values returned by certain fields,\r
+ * as well as their meaning.  For example, the first month of the year has value\r
+ * <code>MONTH</code> == <code>JANUARY</code> for all calendars.  Other values\r
+ * are defined by the concrete subclass, such as <code>ERA</code> and\r
+ * <code>YEAR</code>.  See individual field documentation and subclass\r
+ * documentation for details.\r
+ *\r
+ * <p>When a <code>Calendar</code> is <em>lenient</em>, it accepts a wider range\r
+ * of field values than it produces.  For example, a lenient\r
+ * <code>GregorianCalendar</code> interprets <code>MONTH</code> ==\r
+ * <code>JANUARY</code>, <code>DAY_OF_MONTH</code> == 32 as February 1.  A\r
+ * non-lenient <code>GregorianCalendar</code> throws an exception when given\r
+ * out-of-range field settings.  When calendars recompute field values for\r
+ * return by <code>get()</code>, they normalize them.  For example, a\r
+ * <code>GregorianCalendar</code> always produces <code>DAY_OF_MONTH</code>\r
+ * values between 1 and the length of the month.\r
+ *\r
+ * <p><code>Calendar</code> defines a locale-specific seven day week using two\r
+ * parameters: the first day of the week and the minimal days in first week\r
+ * (from 1 to 7).  These numbers are taken from the locale resource data when a\r
+ * <code>Calendar</code> is constructed.  They may also be specified explicitly\r
+ * through the API.\r
+ *\r
+ * <p>When setting or getting the <code>WEEK_OF_MONTH</code> or\r
+ * <code>WEEK_OF_YEAR</code> fields, <code>Calendar</code> must determine the\r
+ * first week of the month or year as a reference point.  The first week of a\r
+ * month or year is defined as the earliest seven day period beginning on\r
+ * <code>getFirstDayOfWeek()</code> and containing at least\r
+ * <code>getMinimalDaysInFirstWeek()</code> days of that month or year.  Weeks\r
+ * numbered ..., -1, 0 precede the first week; weeks numbered 2, 3,... follow\r
+ * it.  Note that the normalized numbering returned by <code>get()</code> may be\r
+ * different.  For example, a specific <code>Calendar</code> subclass may\r
+ * designate the week before week 1 of a year as week <em>n</em> of the previous\r
+ * year.\r
+ *\r
+ * <p> When computing a <code>Date</code> from time fields, two special\r
+ * circumstances may arise: there may be insufficient information to compute the\r
+ * <code>Date</code> (such as only year and month but no day in the month), or\r
+ * there may be inconsistent information (such as "Tuesday, July 15, 1996" --\r
+ * July 15, 1996 is actually a Monday).\r
+ *\r
+ * <p><strong>Insufficient information.</strong> The calendar will use default\r
+ * information to specify the missing fields. This may vary by calendar; for\r
+ * the Gregorian calendar, the default for a field is the same as that of the\r
+ * start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc.\r
+ *\r
+ * <p><strong>Inconsistent information.</strong> If fields conflict, the calendar\r
+ * will give preference to fields set more recently. For example, when\r
+ * determining the day, the calendar will look for one of the following\r
+ * combinations of fields.  The most recent combination, as determined by the\r
+ * most recently set single field, will be used.\r
+ *\r
+ * <blockquote>\r
+ * <pre>\r
+ * MONTH + DAY_OF_MONTH\r
+ * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK\r
+ * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK\r
+ * DAY_OF_YEAR\r
+ * DAY_OF_WEEK + WEEK_OF_YEAR</pre>\r
+ * </blockquote>\r
+ *\r
+ * For the time of day:\r
+ *\r
+ * <blockquote>\r
+ * <pre>\r
+ * HOUR_OF_DAY\r
+ * AM_PM + HOUR</pre>\r
+ * </blockquote>\r
+ *\r
+ * <p><strong>Note:</strong> for some non-Gregorian calendars, different\r
+ * fields may be necessary for complete disambiguation. For example, a full\r
+ * specification of the historial Arabic astronomical calendar requires year,\r
+ * month, day-of-month <em>and</em> day-of-week in some cases.\r
+ *\r
+ * <p><strong>Note:</strong> There are certain possible ambiguities in\r
+ * interpretation of certain singular times, which are resolved in the\r
+ * following ways:\r
+ * <ol>\r
+ *     <li> 24:00:00 "belongs" to the following day. That is,\r
+ *          23:59 on Dec 31, 1969 &lt; 24:00 on Jan 1, 1970 &lt; 24:01:00 on Jan 1, 1970\r
+ *\r
+ *     <li> Although historically not precise, midnight also belongs to "am",\r
+ *          and noon belongs to "pm", so on the same day,\r
+ *          12:00 am (midnight) &lt; 12:01 am, and 12:00 pm (noon) &lt; 12:01 pm\r
+ * </ol>\r
+ *\r
+ * <p>The date or time format strings are not part of the definition of a\r
+ * calendar, as those must be modifiable or overridable by the user at\r
+ * runtime. Use {@link DateFormat}\r
+ * to format dates.\r
+ *\r
+ * <p><strong>Field manipulation methods</strong></p>\r
+ *\r
+ * <p><code>Calendar</code> fields can be changed using three methods:\r
+ * <code>set()</code>, <code>add()</code>, and <code>roll()</code>.</p>\r
+ *\r
+ * <p><strong><code>set(f, value)</code></strong> changes field\r
+ * <code>f</code> to <code>value</code>.  In addition, it sets an\r
+ * internal member variable to indicate that field <code>f</code> has\r
+ * been changed. Although field <code>f</code> is changed immediately,\r
+ * the calendar's milliseconds is not recomputed until the next call to\r
+ * <code>get()</code>, <code>getTime()</code>, or\r
+ * <code>getTimeInMillis()</code> is made. Thus, multiple calls to\r
+ * <code>set()</code> do not trigger multiple, unnecessary\r
+ * computations. As a result of changing a field using\r
+ * <code>set()</code>, other fields may also change, depending on the\r
+ * field, the field value, and the calendar system. In addition,\r
+ * <code>get(f)</code> will not necessarily return <code>value</code>\r
+ * after the fields have been recomputed. The specifics are determined by\r
+ * the concrete calendar class.</p>\r
+ *\r
+ * <p><em>Example</em>: Consider a <code>GregorianCalendar</code>\r
+ * originally set to August 31, 1999. Calling <code>set(Calendar.MONTH,\r
+ * Calendar.SEPTEMBER)</code> sets the calendar to September 31,\r
+ * 1999. This is a temporary internal representation that resolves to\r
+ * October 1, 1999 if <code>getTime()</code>is then called. However, a\r
+ * call to <code>set(Calendar.DAY_OF_MONTH, 30)</code> before the call to\r
+ * <code>getTime()</code> sets the calendar to September 30, 1999, since\r
+ * no recomputation occurs after <code>set()</code> itself.</p>\r
+ *\r
+ * <p><strong><code>add(f, delta)</code></strong> adds <code>delta</code>\r
+ * to field <code>f</code>.  This is equivalent to calling <code>set(f,\r
+ * get(f) + delta)</code> with two adjustments:</p>\r
+ *\r
+ * <blockquote>\r
+ *   <p><strong>Add rule 1</strong>. The value of field <code>f</code>\r
+ *   after the call minus the value of field <code>f</code> before the\r
+ *   call is <code>delta</code>, modulo any overflow that has occurred in\r
+ *   field <code>f</code>. Overflow occurs when a field value exceeds its\r
+ *   range and, as a result, the next larger field is incremented or\r
+ *   decremented and the field value is adjusted back into its range.</p>\r
+ *\r
+ *   <p><strong>Add rule 2</strong>. If a smaller field is expected to be\r
+ *   invariant, but &nbsp; it is impossible for it to be equal to its\r
+ *   prior value because of changes in its minimum or maximum after field\r
+ *   <code>f</code> is changed, then its value is adjusted to be as close\r
+ *   as possible to its expected value. A smaller field represents a\r
+ *   smaller unit of time. <code>HOUR</code> is a smaller field than\r
+ *   <code>DAY_OF_MONTH</code>. No adjustment is made to smaller fields\r
+ *   that are not expected to be invariant. The calendar system\r
+ *   determines what fields are expected to be invariant.</p>\r
+ * </blockquote>\r
+ *\r
+ * <p>In addition, unlike <code>set()</code>, <code>add()</code> forces\r
+ * an immediate recomputation of the calendar's milliseconds and all\r
+ * fields.</p>\r
+ *\r
+ * <p><em>Example</em>: Consider a <code>GregorianCalendar</code>\r
+ * originally set to August 31, 1999. Calling <code>add(Calendar.MONTH,\r
+ * 13)</code> sets the calendar to September 30, 2000. <strong>Add rule\r
+ * 1</strong> sets the <code>MONTH</code> field to September, since\r
+ * adding 13 months to August gives September of the next year. Since\r
+ * <code>DAY_OF_MONTH</code> cannot be 31 in September in a\r
+ * <code>GregorianCalendar</code>, <strong>add rule 2</strong> sets the\r
+ * <code>DAY_OF_MONTH</code> to 30, the closest possible value. Although\r
+ * it is a smaller field, <code>DAY_OF_WEEK</code> is not adjusted by\r
+ * rule 2, since it is expected to change when the month changes in a\r
+ * <code>GregorianCalendar</code>.</p>\r
+ *\r
+ * <p><strong><code>roll(f, delta)</code></strong> adds\r
+ * <code>delta</code> to field <code>f</code> without changing larger\r
+ * fields. This is equivalent to calling <code>add(f, delta)</code> with\r
+ * the following adjustment:</p>\r
+ *\r
+ * <blockquote>\r
+ *   <p><strong>Roll rule</strong>. Larger fields are unchanged after the\r
+ *   call. A larger field represents a larger unit of\r
+ *   time. <code>DAY_OF_MONTH</code> is a larger field than\r
+ *   <code>HOUR</code>.</p>\r
+ * </blockquote>\r
+ *\r
+ * <p><em>Example</em>: Consider a <code>GregorianCalendar</code>\r
+ * originally set to August 31, 1999. Calling <code>roll(Calendar.MONTH,\r
+ * 8)</code> sets the calendar to April 30, <strong>1999</strong>.  Add\r
+ * rule 1 sets the <code>MONTH</code> field to April. Using a\r
+ * <code>GregorianCalendar</code>, the <code>DAY_OF_MONTH</code> cannot\r
+ * be 31 in the month April. Add rule 2 sets it to the closest possible\r
+ * value, 30. Finally, the <strong>roll rule</strong> maintains the\r
+ * <code>YEAR</code> field value of 1999.</p>\r
+ *\r
+ * <p><em>Example</em>: Consider a <code>GregorianCalendar</code>\r
+ * originally set to Sunday June 6, 1999. Calling\r
+ * <code>roll(Calendar.WEEK_OF_MONTH, -1)</code> sets the calendar to\r
+ * Tuesday June 1, 1999, whereas calling\r
+ * <code>add(Calendar.WEEK_OF_MONTH, -1)</code> sets the calendar to\r
+ * Sunday May 30, 1999. This is because the roll rule imposes an\r
+ * additional constraint: The <code>MONTH</code> must not change when the\r
+ * <code>WEEK_OF_MONTH</code> is rolled. Taken together with add rule 1,\r
+ * the resultant date must be between Tuesday June 1 and Saturday June\r
+ * 5. According to add rule 2, the <code>DAY_OF_WEEK</code>, an invariant\r
+ * when changing the <code>WEEK_OF_MONTH</code>, is set to Tuesday, the\r
+ * closest possible value to Sunday (where Sunday is the first day of the\r
+ * week).</p>\r
+ *\r
+ * <p><strong>Usage model</strong>. To motivate the behavior of\r
+ * <code>add()</code> and <code>roll()</code>, consider a user interface\r
+ * component with increment and decrement buttons for the month, day, and\r
+ * year, and an underlying <code>GregorianCalendar</code>. If the\r
+ * interface reads January 31, 1999 and the user presses the month\r
+ * increment button, what should it read? If the underlying\r
+ * implementation uses <code>set()</code>, it might read March 3, 1999. A\r
+ * better result would be February 28, 1999. Furthermore, if the user\r
+ * presses the month increment button again, it should read March 31,\r
+ * 1999, not March 28, 1999. By saving the original date and using either\r
+ * <code>add()</code> or <code>roll()</code>, depending on whether larger\r
+ * fields should be affected, the user interface can behave as most users\r
+ * will intuitively expect.</p>\r
+ *\r
+ * <p><b>Note:</b> You should always use {@link #roll roll} and {@link #add add} rather\r
+ * than attempting to perform arithmetic operations directly on the fields\r
+ * of a <tt>Calendar</tt>.  It is quite possible for <tt>Calendar</tt> subclasses\r
+ * to have fields with non-linear behavior, for example missing months\r
+ * or days during non-leap years.  The subclasses' <tt>add</tt> and <tt>roll</tt>\r
+ * methods will take this into account, while simple arithmetic manipulations\r
+ * may give invalid results.\r
+ *\r
+ * <p><big><big><b>Calendar Architecture in ICU4J</b></big></big></p>\r
+ *\r
+ * <p>Recently the implementation of <code>Calendar</code> has changed\r
+ * significantly in order to better support subclassing. The original\r
+ * <code>Calendar</code> class was designed to support subclassing, but\r
+ * it had only one implemented subclass, <code>GregorianCalendar</code>.\r
+ * With the implementation of several new calendar subclasses, including\r
+ * the <code>BuddhistCalendar</code>, <code>ChineseCalendar</code>,\r
+ * <code>HebrewCalendar</code>, <code>IslamicCalendar</code>, and\r
+ * <code>JapaneseCalendar</code>, the subclassing API has been reworked\r
+ * thoroughly. This section details the new subclassing API and other\r
+ * ways in which <code>com.ibm.icu.util.Calendar</code> differs from\r
+ * <code>java.util.Calendar</code>.\r
+ * </p>\r
+ *\r
+ * <p><big><b>Changes</b></big></p>\r
+ *\r
+ * <p>Overview of changes between the classic <code>Calendar</code>\r
+ * architecture and the new architecture.\r
+ *\r
+ * <ul>\r
+ *\r
+ *   <li>The <code>fields[]</code> array is <code>private</code> now\r
+ *     instead of <code>protected</code>.  Subclasses must access it\r
+ *     using the methods {@link #internalSet} and\r
+ *     {@link #internalGet}.  <b>Motivation:</b> Subclasses should\r
+ *     not directly access data members.</li>\r
+ *\r
+ *   <li>The <code>time</code> long word is <code>private</code> now\r
+ *     instead of <code>protected</code>.  Subclasses may access it using\r
+ *     the method {@link #internalGetTimeInMillis}, which does not\r
+ *     provoke an update. <b>Motivation:</b> Subclasses should not\r
+ *     directly access data members.</li>\r
+ *\r
+ *   <li>The scope of responsibility of subclasses has been drastically\r
+ *     reduced. As much functionality as possible is implemented in the\r
+ *     <code>Calendar</code> base class. As a result, it is much easier\r
+ *     to subclass <code>Calendar</code>. <b>Motivation:</b> Subclasses\r
+ *     should not have to reimplement common code. Certain behaviors are\r
+ *     common across calendar systems: The definition and behavior of\r
+ *     week-related fields and time fields, the arithmetic\r
+ *     ({@link #add(int, int) add} and {@link #roll(int, int) roll}) behavior of many\r
+ *     fields, and the field validation system.</li>\r
+ *\r
+ *   <li>The subclassing API has been completely redesigned.</li>\r
+ *\r
+ *   <li>The <code>Calendar</code> base class contains some Gregorian\r
+ *     calendar algorithmic support that subclasses can use (specifically\r
+ *     in {@link #handleComputeFields}).  Subclasses can use the\r
+ *     methods <code>getGregorianXxx()</code> to obtain precomputed\r
+ *     values. <b>Motivation:</b> This is required by all\r
+ *     <code>Calendar</code> subclasses in order to implement consistent\r
+ *     time zone behavior, and Gregorian-derived systems can use the\r
+ *     already computed data.</li>\r
+ *\r
+ *   <li>The <code>FIELD_COUNT</code> constant has been removed. Use\r
+ *     {@link #getFieldCount}.  In addition, framework API has been\r
+ *     added to allow subclasses to define additional fields.\r
+ *     <b>Motivation: </b>The number of fields is not constant across\r
+ *     calendar systems.</li>\r
+ *\r
+ *   <li>The range of handled dates has been narrowed from +/-\r
+ *     ~300,000,000 years to +/- ~5,000,000 years. In practical terms\r
+ *     this should not affect clients. However, it does mean that client\r
+ *     code cannot be guaranteed well-behaved results with dates such as\r
+ *     <code>Date(Long.MIN_VALUE)</code> or\r
+ *     <code>Date(Long.MAX_VALUE)</code>. Instead, the\r
+ *     <code>Calendar</code> protected constants should be used.\r
+ *     <b>Motivation:</b> With\r
+ *     the addition of the {@link #JULIAN_DAY} field, Julian day\r
+ *     numbers must be restricted to a 32-bit <code>int</code>.  This\r
+ *     restricts the overall supported range. Furthermore, restricting\r
+ *     the supported range simplifies the computations by removing\r
+ *     special case code that was used to accomodate arithmetic overflow\r
+ *     at millis near <code>Long.MIN_VALUE</code> and\r
+ *     <code>Long.MAX_VALUE</code>.</li>\r
+ *\r
+ *   <li>New fields are implemented: {@link #JULIAN_DAY} defines\r
+ *     single-field specification of the\r
+ *     date. {@link #MILLISECONDS_IN_DAY} defines a single-field\r
+ *     specification of the wall time. {@link #DOW_LOCAL} and\r
+ *     {@link #YEAR_WOY} implement localized day-of-week and\r
+ *     week-of-year behavior.</li>\r
+ *\r
+ *   <li>Subclasses can access protected millisecond constants\r
+ *   defined in <code>Calendar</code>.</li>\r
+ *\r
+ *   <li>New API has been added to support calendar-specific subclasses\r
+ *     of <code>DateFormat</code>.</li>\r
+ *\r
+ *   <li>Several subclasses have been implemented, representing\r
+ *     various international calendar systems.</li>\r
+ *\r
+ * </ul>\r
+ *\r
+ * <p><big><b>Subclass API</b></big></p>\r
+ *\r
+ * <p>The original <code>Calendar</code> API was based on the experience\r
+ * of implementing a only a single subclass,\r
+ * <code>GregorianCalendar</code>. As a result, all of the subclassing\r
+ * kinks had not been worked out. The new subclassing API has been\r
+ * refined based on several implemented subclasses. This includes methods\r
+ * that must be overridden and methods for subclasses to call. Subclasses\r
+ * no longer have direct access to <code>fields</code> and\r
+ * <code>stamp</code>. Instead, they have new API to access\r
+ * these. Subclasses are able to allocate the <code>fields</code> array\r
+ * through a protected framework method; this allows subclasses to\r
+ * specify additional fields. </p>\r
+ *\r
+ * <p>More functionality has been moved into the base class. The base\r
+ * class now contains much of the computational machinery to support the\r
+ * Gregorian calendar. This is based on two things: (1) Many calendars\r
+ * are based on the Gregorian calendar (such as the Buddhist and Japanese\r
+ * imperial calendars). (2) <em>All</em> calendars require basic\r
+ * Gregorian support in order to handle timezone computations. </p>\r
+ *\r
+ * <p>Common computations have been moved into\r
+ * <code>Calendar</code>. Subclasses no longer compute the week related\r
+ * fields and the time related fields. These are commonly handled for all\r
+ * calendars by the base class. </p>\r
+ *\r
+ * <p><b>Subclass computation of time <tt>=&gt;</tt> fields</b>\r
+ *\r
+ * <p>The {@link #ERA}, {@link #YEAR},\r
+ * {@link #EXTENDED_YEAR}, {@link #MONTH},\r
+ * {@link #DAY_OF_MONTH}, and {@link #DAY_OF_YEAR} fields are\r
+ * computed by the subclass, based on the Julian day. All other fields\r
+ * are computed by <code>Calendar</code>.\r
+ *\r
+ * <ul>\r
+ *\r
+ *   <li>Subclasses should implement {@link #handleComputeFields}\r
+ *     to compute the {@link #ERA}, {@link #YEAR},\r
+ *     {@link #EXTENDED_YEAR}, {@link #MONTH},\r
+ *     {@link #DAY_OF_MONTH}, and {@link #DAY_OF_YEAR} fields,\r
+ *     based on the value of the {@link #JULIAN_DAY} field. If there\r
+ *     are calendar-specific fields not defined by <code>Calendar</code>,\r
+ *     they must also be computed. These are the only fields that the\r
+ *     subclass should compute. All other fields are computed by the base\r
+ *     class, so time and week fields behave in a consistent way across\r
+ *     all calendars. The default version of this method in\r
+ *     <code>Calendar</code> implements a proleptic Gregorian\r
+ *     calendar. Within this method, subclasses may call\r
+ *     <code>getGregorianXxx()</code> to obtain the Gregorian calendar\r
+ *     month, day of month, and extended year for the given date.</li>\r
+ *\r
+ * </ul>\r
+ *\r
+ * <p><b>Subclass computation of fields <tt>=&gt;</tt> time</b>\r
+ *\r
+ * <p>The interpretation of most field values is handled entirely by\r
+ * <code>Calendar</code>. <code>Calendar</code> determines which fields\r
+ * are set, which are not, which are set more recently, and so on. In\r
+ * addition, <code>Calendar</code> handles the computation of the time\r
+ * from the time fields and handles the week-related fields. The only\r
+ * thing the subclass must do is determine the extended year, based on\r
+ * the year fields, and then, given an extended year and a month, it must\r
+ * return a Julian day number.\r
+ *\r
+ * <ul>\r
+ *\r
+ *   <li>Subclasses should implement {@link #handleGetExtendedYear}\r
+ *     to return the extended year for this calendar system, based on the\r
+ *     {@link #YEAR}, {@link #EXTENDED_YEAR}, and any fields that\r
+ *     the calendar system uses that are larger than a year, such as\r
+ *     {@link #ERA}.</li>\r
+ *\r
+ *   <li>Subclasses should implement {@link #handleComputeMonthStart}\r
+ *     to return the Julian day number\r
+ *     associated with a month and extended year. This is the Julian day\r
+ *     number of the day before the first day of the month. The month\r
+ *     number is zero-based. This computation should not depend on any\r
+ *     field values.</li>\r
+ *\r
+ * </ul>\r
+ *\r
+ * <p><b>Other methods</b>\r
+ *\r
+ * <ul>\r
+ *\r
+ *   <li>Subclasses should implement {@link #handleGetMonthLength}\r
+ *     to return the number of days in a\r
+ *     given month of a given extended year. The month number, as always,\r
+ *     is zero-based.</li>\r
+ *\r
+ *   <li>Subclasses should implement {@link #handleGetYearLength}\r
+ *     to return the number of days in the given\r
+ *     extended year. This method is used by\r
+ *     <tt>computeWeekFields</tt> to compute the\r
+ *     {@link #WEEK_OF_YEAR} and {@link #YEAR_WOY} fields.</li>\r
+ *\r
+ *   <li>Subclasses should implement {@link #handleGetLimit}\r
+ *     to return the protected values of a field, depending on the value of\r
+ *     <code>limitType</code>. This method only needs to handle the\r
+ *     fields {@link #ERA}, {@link #YEAR}, {@link #MONTH},\r
+ *     {@link #WEEK_OF_YEAR}, {@link #WEEK_OF_MONTH},\r
+ *     {@link #DAY_OF_MONTH}, {@link #DAY_OF_YEAR},\r
+ *     {@link #DAY_OF_WEEK_IN_MONTH}, {@link #YEAR_WOY}, and\r
+ *     {@link #EXTENDED_YEAR}.  Other fields are invariant (with\r
+ *     respect to calendar system) and are handled by the base\r
+ *     class.</li>\r
+ *\r
+ *   <li>Optionally, subclasses may override {@link #validateField}\r
+ *     to check any subclass-specific fields. If the\r
+ *     field's value is out of range, the method should throw an\r
+ *     <code>IllegalArgumentException</code>. The method may call\r
+ *     <code>super.validateField(field)</code> to handle fields in a\r
+ *     generic way, that is, to compare them to the range\r
+ *     <code>getMinimum(field)</code>..<code>getMaximum(field)</code>.</li>\r
+ *\r
+ *   <li>Optionally, subclasses may override\r
+ *     {@link #handleCreateFields} to create an <code>int[]</code>\r
+ *     array large enough to hold the calendar's fields. This is only\r
+ *     necessary if the calendar defines additional fields beyond those\r
+ *     defined by <code>Calendar</code>. The length of the result must be\r
+ *     be between the base and maximum field counts.</li>\r
+ *\r
+ *   <li>Optionally, subclasses may override\r
+ *     {@link #handleGetDateFormat} to create a\r
+ *     <code>DateFormat</code> appropriate to this calendar. This is only\r
+ *     required if a calendar subclass redefines the use of a field (for\r
+ *     example, changes the {@link #ERA} field from a symbolic field\r
+ *     to a numeric one) or defines an additional field.</li>\r
+ *\r
+ *   <li>Optionally, subclasses may override {@link #roll roll} and\r
+ *     {@link #add add} to handle fields that are discontinuous. For\r
+ *     example, in the Hebrew calendar the month &quot;Adar I&quot; only\r
+ *     occurs in leap years; in other years the calendar jumps from\r
+ *     Shevat (month #4) to Adar (month #6). The {@link\r
+ *     HebrewCalendar#add HebrewCalendar.add} and {@link\r
+ *     HebrewCalendar#roll HebrewCalendar.roll} methods take this into\r
+ *     account, so that adding 1 month to Shevat gives the proper result\r
+ *     (Adar) in a non-leap year. The protected utility method {@link\r
+ *     #pinField pinField} is often useful when implementing these two\r
+ *     methods. </li>\r
+ *\r
+ * </ul>\r
+ *\r
+ * <p><big><b>Normalized behavior</b></big>\r
+ *\r
+ * <p>The behavior of certain fields has been made consistent across all\r
+ * calendar systems and implemented in <code>Calendar</code>.\r
+ *\r
+ * <ul>\r
+ *\r
+ *   <li>Time is normalized. Even though some calendar systems transition\r
+ *     between days at sunset or at other times, all ICU4J calendars\r
+ *     transition between days at <em>local zone midnight</em>.  This\r
+ *     allows ICU4J to centralize the time computations in\r
+ *     <code>Calendar</code> and to maintain basic correpsondences\r
+ *     between calendar systems. Affected fields: {@link #AM_PM},\r
+ *     {@link #HOUR}, {@link #HOUR_OF_DAY}, {@link #MINUTE},\r
+ *     {@link #SECOND}, {@link #MILLISECOND},\r
+ *     {@link #ZONE_OFFSET}, and {@link #DST_OFFSET}.</li>\r
+ *\r
+ *   <li>DST behavior is normalized. Daylight savings time behavior is\r
+ *     computed the same for all calendar systems, and depends on the\r
+ *     value of several <code>GregorianCalendar</code> fields: the\r
+ *     {@link #YEAR}, {@link #MONTH}, and\r
+ *     {@link #DAY_OF_MONTH}. As a result, <code>Calendar</code>\r
+ *     always computes these fields, even for non-Gregorian calendar\r
+ *     systems. These fields are available to subclasses.</li>\r
+ *\r
+ *   <li>Weeks are normalized. Although locales define the week\r
+ *     differently, in terms of the day on which it starts, and the\r
+ *     designation of week number one of a month or year, they all use a\r
+ *     common mechanism. Furthermore, the day of the week has a simple\r
+ *     and consistent definition throughout history. For example,\r
+ *     although the Gregorian calendar introduced a discontinuity when\r
+ *     first instituted, the day of week was not disrupted. For this\r
+ *     reason, the fields {@link #DAY_OF_WEEK}, <code>WEEK_OF_YEAR,\r
+ *     WEEK_OF_MONTH</code>, {@link #DAY_OF_WEEK_IN_MONTH},\r
+ *     {@link #DOW_LOCAL}, {@link #YEAR_WOY} are all computed in\r
+ *     a consistent way in the base class, based on the\r
+ *     {@link #EXTENDED_YEAR}, {@link #DAY_OF_YEAR},\r
+ *     {@link #MONTH}, and {@link #DAY_OF_MONTH}, which are\r
+ *     computed by the subclass.</li>\r
+ *\r
+ * </ul>\r
+ *\r
+ * <p><big><b>Supported range</b></big>\r
+ *\r
+ * <p>The allowable range of <code>Calendar</code> has been\r
+ * narrowed. <code>GregorianCalendar</code> used to attempt to support\r
+ * the range of dates with millisecond values from\r
+ * <code>Long.MIN_VALUE</code> to <code>Long.MAX_VALUE</code>. This\r
+ * introduced awkward constructions (hacks) which slowed down\r
+ * performance. It also introduced non-uniform behavior at the\r
+ * boundaries. The new <code>Calendar</code> protocol specifies the\r
+ * maximum range of supportable dates as those having Julian day numbers\r
+ * of <code>-0x7F000000</code> to <code>+0x7F000000</code>. This\r
+ * corresponds to years from ~5,000,000 BCE to ~5,000,000 CE. Programmers\r
+ * should use the protected constants in <code>Calendar</code> to\r
+ * specify an extremely early or extremely late date.</p>\r
+ *\r
+ * <p><big><b>General notes</b></big>\r
+ *\r
+ * <ul>\r
+ *\r
+ *   <li>Calendars implementations are <em>proleptic</em>. For example,\r
+ *     even though the Gregorian calendar was not instituted until the\r
+ *     16th century, the <code>GregorianCalendar</code> class supports\r
+ *     dates before the historical onset of the calendar by extending the\r
+ *     calendar system backward in time. Similarly, the\r
+ *     <code>HebrewCalendar</code> extends backward before the start of\r
+ *     its epoch into zero and negative years. Subclasses do not throw\r
+ *     exceptions because a date precedes the historical start of a\r
+ *     calendar system. Instead, they implement\r
+ *     {@link #handleGetLimit} to return appropriate limits on\r
+ *     {@link #YEAR}, {@link #ERA}, etc. fields. Then, if the\r
+ *     calendar is set to not be lenient, out-of-range field values will\r
+ *     trigger an exception.</li>\r
+ *\r
+ *   <li>Calendar system subclasses compute a <em>extended\r
+ *     year</em>. This differs from the {@link #YEAR} field in that\r
+ *     it ranges over all integer values, including zero and negative\r
+ *     values, and it encapsulates the information of the\r
+ *     {@link #YEAR} field and all larger fields.  Thus, for the\r
+ *     Gregorian calendar, the {@link #EXTENDED_YEAR} is computed as\r
+ *     <code>ERA==AD ? YEAR : 1-YEAR</code>. Another example is the Mayan\r
+ *     long count, which has years (<code>KUN</code>) and nested cycles\r
+ *     of years (<code>KATUN</code> and <code>BAKTUN</code>). The Mayan\r
+ *     {@link #EXTENDED_YEAR} is computed as <code>TUN + 20 * (KATUN\r
+ *     + 20 * BAKTUN)</code>. The <code>Calendar</code> base class uses\r
+ *     the {@link #EXTENDED_YEAR} field to compute the week-related\r
+ *     fields.</li>\r
+ *\r
+ * </ul>\r
+ *\r
+ * @see          Date\r
+ * @see          GregorianCalendar\r
+ * @see          TimeZone\r
+ * @see          DateFormat\r
+ * @author Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu, Laura Werner\r
+ * @stable ICU 2.0\r
+ */\r
+public class Calendar implements Serializable, Cloneable, Comparable<Calendar> {\r
+    private static final long serialVersionUID = 1L;\r
+    \r
+    /**\r
+     * @internal\r
+     */\r
+    public final java.util.Calendar calendar;\r
+        \r
+    /**\r
+     * @internal\r
+     * @param delegate the Calendar to which to delegate\r
+     */\r
+    public Calendar(java.util.Calendar delegate) {\r
+        this.calendar = delegate;\r
+    }\r
+\r
+    // Data flow in Calendar\r
+    // ---------------------\r
+\r
+    // The current time is represented in two ways by Calendar: as UTC\r
+    // milliseconds from the epoch start (1 January 1970 0:00 UTC), and as local\r
+    // fields such as MONTH, HOUR, AM_PM, etc.  It is possible to compute the\r
+    // millis from the fields, and vice versa.  The data needed to do this\r
+    // conversion is encapsulated by a TimeZone object owned by the Calendar.\r
+    // The data provided by the TimeZone object may also be overridden if the\r
+    // user sets the ZONE_OFFSET and/or DST_OFFSET fields directly. The class\r
+    // keeps track of what information was most recently set by the caller, and\r
+    // uses that to compute any other information as needed.\r
+\r
+    // If the user sets the fields using set(), the data flow is as follows.\r
+    // This is implemented by the Calendar subclass's computeTime() method.\r
+    // During this process, certain fields may be ignored.  The disambiguation\r
+    // algorithm for resolving which fields to pay attention to is described\r
+    // above.\r
+\r
+    //   local fields (YEAR, MONTH, DATE, HOUR, MINUTE, etc.)\r
+    //           |\r
+    //           | Using Calendar-specific algorithm\r
+    //           V\r
+    //   local standard millis\r
+    //           |\r
+    //           | Using TimeZone or user-set ZONE_OFFSET / DST_OFFSET\r
+    //           V\r
+    //   UTC millis (in time data member)\r
+\r
+    // If the user sets the UTC millis using setTime(), the data flow is as\r
+    // follows.  This is implemented by the Calendar subclass's computeFields()\r
+    // method.\r
+\r
+    //   UTC millis (in time data member)\r
+    //           |\r
+    //           | Using TimeZone getOffset()\r
+    //           V\r
+    //   local standard millis\r
+    //           |\r
+    //           | Using Calendar-specific algorithm\r
+    //           V\r
+    //   local fields (YEAR, MONTH, DATE, HOUR, MINUTE, etc.)\r
+\r
+    // In general, a round trip from fields, through local and UTC millis, and\r
+    // back out to fields is made when necessary.  This is implemented by the\r
+    // complete() method.  Resolving a partial set of fields into a UTC millis\r
+    // value allows all remaining fields to be generated from that value.  If\r
+    // the Calendar is lenient, the fields are also renormalized to standard\r
+    // ranges when they are regenerated.\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * era, e.g., AD or BC in the Julian calendar. This is a calendar-specific\r
+     * value; see subclass documentation.\r
+     * @see GregorianCalendar#AD\r
+     * @see GregorianCalendar#BC\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int ERA = 0;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * year. This is a calendar-specific value; see subclass documentation.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int YEAR = 1;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * month. This is a calendar-specific value. The first month of the year is\r
+     * <code>JANUARY</code>; the last depends on the number of months in a year.\r
+     * @see #JANUARY\r
+     * @see #FEBRUARY\r
+     * @see #MARCH\r
+     * @see #APRIL\r
+     * @see #MAY\r
+     * @see #JUNE\r
+     * @see #JULY\r
+     * @see #AUGUST\r
+     * @see #SEPTEMBER\r
+     * @see #OCTOBER\r
+     * @see #NOVEMBER\r
+     * @see #DECEMBER\r
+     * @see #UNDECIMBER\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MONTH = 2;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * week number within the current year.  The first week of the year, as\r
+     * defined by {@link #getFirstDayOfWeek()} and\r
+     * {@link #getMinimalDaysInFirstWeek()}, has value 1.  Subclasses define\r
+     * the value of {@link #WEEK_OF_YEAR} for days before the first week of\r
+     * the year.\r
+     * @see #getFirstDayOfWeek\r
+     * @see #getMinimalDaysInFirstWeek\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int WEEK_OF_YEAR = 3;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * week number within the current month.  The first week of the month, as\r
+     * defined by {@link #getFirstDayOfWeek()} and\r
+     * {@link #getMinimalDaysInFirstWeek()}, has value 1.  Subclasses define\r
+     * the value of {@link #WEEK_OF_MONTH} for days before the first week of\r
+     * the month.\r
+     * @see #getFirstDayOfWeek\r
+     * @see #getMinimalDaysInFirstWeek\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int WEEK_OF_MONTH = 4;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * day of the month. This is a synonym for {@link #DAY_OF_MONTH}.\r
+     * The first day of the month has value 1.\r
+     * @see #DAY_OF_MONTH\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DATE = 5;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * day of the month. This is a synonym for {@link #DATE}.\r
+     * The first day of the month has value 1.\r
+     * @see #DATE\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DAY_OF_MONTH = 5;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the day\r
+     * number within the current year.  The first day of the year has value 1.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DAY_OF_YEAR = 6;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the day\r
+     * of the week.  This field takes values {@link #SUNDAY},\r
+     * {@link #MONDAY}, {@link #TUESDAY}, {@link #WEDNESDAY},\r
+     * {@link #THURSDAY}, {@link #FRIDAY}, and {@link #SATURDAY}.\r
+     * @see #SUNDAY\r
+     * @see #MONDAY\r
+     * @see #TUESDAY\r
+     * @see #WEDNESDAY\r
+     * @see #THURSDAY\r
+     * @see #FRIDAY\r
+     * @see #SATURDAY\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DAY_OF_WEEK = 7;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * ordinal number of the day of the week within the current month. Together\r
+     * with the {@link #DAY_OF_WEEK} field, this uniquely specifies a day\r
+     * within a month.  Unlike {@link #WEEK_OF_MONTH} and\r
+     * {@link #WEEK_OF_YEAR}, this field's value does <em>not</em> depend on\r
+     * {@link #getFirstDayOfWeek()} or\r
+     * {@link #getMinimalDaysInFirstWeek()}.  <code>DAY_OF_MONTH 1</code>\r
+     * through <code>7</code> always correspond to <code>DAY_OF_WEEK_IN_MONTH\r
+     * 1</code>; <code>8</code> through <code>15</code> correspond to\r
+     * <code>DAY_OF_WEEK_IN_MONTH 2</code>, and so on.\r
+     * <code>DAY_OF_WEEK_IN_MONTH 0</code> indicates the week before\r
+     * <code>DAY_OF_WEEK_IN_MONTH 1</code>.  Negative values count back from the\r
+     * end of the month, so the last Sunday of a month is specified as\r
+     * <code>DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1</code>.  Because\r
+     * negative values count backward they will usually be aligned differently\r
+     * within the month than positive values.  For example, if a month has 31\r
+     * days, <code>DAY_OF_WEEK_IN_MONTH -1</code> will overlap\r
+     * <code>DAY_OF_WEEK_IN_MONTH 5</code> and the end of <code>4</code>.\r
+     * @see #DAY_OF_WEEK\r
+     * @see #WEEK_OF_MONTH\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DAY_OF_WEEK_IN_MONTH = 8;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating\r
+     * whether the <code>HOUR</code> is before or after noon.\r
+     * E.g., at 10:04:15.250 PM the <code>AM_PM</code> is <code>PM</code>.\r
+     * @see #AM\r
+     * @see #PM\r
+     * @see #HOUR\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int AM_PM = 9;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * hour of the morning or afternoon. <code>HOUR</code> is used for the 12-hour\r
+     * clock.\r
+     * E.g., at 10:04:15.250 PM the <code>HOUR</code> is 10.\r
+     * @see #AM_PM\r
+     * @see #HOUR_OF_DAY\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int HOUR = 10;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * hour of the day. <code>HOUR_OF_DAY</code> is used for the 24-hour clock.\r
+     * E.g., at 10:04:15.250 PM the <code>HOUR_OF_DAY</code> is 22.\r
+     * @see #HOUR\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int HOUR_OF_DAY = 11;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * minute within the hour.\r
+     * E.g., at 10:04:15.250 PM the <code>MINUTE</code> is 4.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MINUTE = 12;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * second within the minute.\r
+     * E.g., at 10:04:15.250 PM the <code>SECOND</code> is 15.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int SECOND = 13;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * millisecond within the second.\r
+     * E.g., at 10:04:15.250 PM the <code>MILLISECOND</code> is 250.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MILLISECOND = 14;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * raw offset from GMT in milliseconds.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int ZONE_OFFSET = 15;\r
+\r
+    /**\r
+     * Field number for <code>get</code> and <code>set</code> indicating the\r
+     * daylight savings offset in milliseconds.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DST_OFFSET = 16;\r
+\r
+    /**\r
+     * {@icu} Field number for <code>get()</code> and <code>set()</code>\r
+     * indicating the extended year corresponding to the\r
+     * {@link #WEEK_OF_YEAR} field.  This may be one greater or less\r
+     * than the value of {@link #EXTENDED_YEAR}.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int YEAR_WOY = 17;\r
+\r
+    /**\r
+     * {@icu} Field number for <code>get()</code> and <code>set()</code>\r
+     * indicating the localized day of week.  This will be a value from 1\r
+     * to 7 inclusive, with 1 being the localized first day of the week.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int DOW_LOCAL = 18;\r
+\r
+    /**\r
+     * {@icu} Field number for <code>get()</code> and <code>set()</code>\r
+     * indicating the extended year.  This is a single number designating\r
+     * the year of this calendar system, encompassing all supra-year\r
+     * fields.  For example, for the Julian calendar system, year numbers\r
+     * are positive, with an era of BCE or CE.  An extended year value for\r
+     * the Julian calendar system assigns positive values to CE years and\r
+     * negative values to BCE years, with 1 BCE being year 0.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int EXTENDED_YEAR = 19;\r
+\r
+    /**\r
+     * {@icu} Field number for <code>get()</code> and <code>set()</code>\r
+     * indicating the modified Julian day number.  This is different from\r
+     * the conventional Julian day number in two regards.  First, it\r
+     * demarcates days at local zone midnight, rather than noon GMT.\r
+     * Second, it is a local number; that is, it depends on the local time\r
+     * zone.  It can be thought of as a single number that encompasses all\r
+     * the date-related fields.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int JULIAN_DAY = 20;\r
+\r
+    /**\r
+     * {@icu} Field number for <code>get()</code> and <code>set()</code>\r
+     * indicating the milliseconds in the day.  This ranges from 0 to\r
+     * 23:59:59.999 (regardless of DST).  This field behaves\r
+     * <em>exactly</em> like a composite of all time-related fields, not\r
+     * including the zone fields.  As such, it also reflects\r
+     * discontinuities of those fields on DST transition days.  On a day of\r
+     * DST onset, it will jump forward.  On a day of DST cessation, it will\r
+     * jump backward.  This reflects the fact that is must be combined with\r
+     * the DST_OFFSET field to obtain a unique local time value.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int MILLISECONDS_IN_DAY = 21;\r
+\r
+    /**\r
+     * {@icu} Field indicating whether or not the current month is a leap month.\r
+     * Should have a value of 0 for non-leap months, and 1 for leap months.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final int IS_LEAP_MONTH = 22;\r
+\r
+    /**\r
+     * Value of the <code>DAY_OF_WEEK</code> field indicating\r
+     * Sunday.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int SUNDAY = 1;\r
+\r
+    /**\r
+     * Value of the <code>DAY_OF_WEEK</code> field indicating\r
+     * Monday.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MONDAY = 2;\r
+\r
+    /**\r
+     * Value of the <code>DAY_OF_WEEK</code> field indicating\r
+     * Tuesday.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int TUESDAY = 3;\r
+\r
+    /**\r
+     * Value of the <code>DAY_OF_WEEK</code> field indicating\r
+     * Wednesday.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int WEDNESDAY = 4;\r
+\r
+    /**\r
+     * Value of the <code>DAY_OF_WEEK</code> field indicating\r
+     * Thursday.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int THURSDAY = 5;\r
+\r
+    /**\r
+     * Value of the <code>DAY_OF_WEEK</code> field indicating\r
+     * Friday.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int FRIDAY = 6;\r
+\r
+    /**\r
+     * Value of the <code>DAY_OF_WEEK</code> field indicating\r
+     * Saturday.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int SATURDAY = 7;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * first month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int JANUARY = 0;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * second month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int FEBRUARY = 1;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * third month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MARCH = 2;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * fourth month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int APRIL = 3;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * fifth month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int MAY = 4;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * sixth month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int JUNE = 5;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * seventh month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int JULY = 6;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * eighth month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int AUGUST = 7;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * ninth month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int SEPTEMBER = 8;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * tenth month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int OCTOBER = 9;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * eleventh month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int NOVEMBER = 10;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * twelfth month of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int DECEMBER = 11;\r
+\r
+    /**\r
+     * Value of the <code>MONTH</code> field indicating the\r
+     * thirteenth month of the year. Although {@link GregorianCalendar}\r
+     * does not use this value, lunar calendars do.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int UNDECIMBER = 12;\r
+\r
+    /**\r
+     * Value of the <code>AM_PM</code> field indicating the\r
+     * period of the day from midnight to just before noon.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int AM = 0;\r
+\r
+    /**\r
+     * Value of the <code>AM_PM</code> field indicating the\r
+     * period of the day from noon to just before midnight.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final static int PM = 1;\r
+\r
+    /**\r
+     * {@icu} Value returned by getDayOfWeekType(int dayOfWeek) to indicate a\r
+     * weekday.\r
+     * @see #WEEKEND\r
+     * @see #WEEKEND_ONSET\r
+     * @see #WEEKEND_CEASE\r
+     * @see #getDayOfWeekType\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int WEEKDAY = 0;\r
+\r
+    /**\r
+     * {@icu} Value returned by getDayOfWeekType(int dayOfWeek) to indicate a\r
+     * weekend day.\r
+     * @see #WEEKDAY\r
+     * @see #WEEKEND_ONSET\r
+     * @see #WEEKEND_CEASE\r
+     * @see #getDayOfWeekType\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int WEEKEND = 1;\r
+\r
+    /**\r
+     * {@icu} Value returned by getDayOfWeekType(int dayOfWeek) to indicate a\r
+     * day that starts as a weekday and transitions to the weekend.\r
+     * Call getWeekendTransition() to get the point of transition.\r
+     * @see #WEEKDAY\r
+     * @see #WEEKEND\r
+     * @see #WEEKEND_CEASE\r
+     * @see #getDayOfWeekType\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int WEEKEND_ONSET = 2;\r
+\r
+    /**\r
+     * {@icu} Value returned by getDayOfWeekType(int dayOfWeek) to indicate a\r
+     * day that starts as the weekend and transitions to a weekday.\r
+     * Call getWeekendTransition() to get the point of transition.\r
+     * @see #WEEKDAY\r
+     * @see #WEEKEND\r
+     * @see #WEEKEND_ONSET\r
+     * @see #getDayOfWeekType\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int WEEKEND_CEASE = 3;\r
+\r
+    /**\r
+     * Constructs a Calendar with the default time zone\r
+     * and locale.\r
+     * @see     TimeZone#getDefault\r
+     * @stable ICU 2.0\r
+     */\r
+    protected Calendar()\r
+    {\r
+        this(TimeZone.getDefault(), ULocale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Constructs a calendar with the specified time zone and locale.\r
+     * @param zone the time zone to use\r
+     * @param aLocale the locale for the week data\r
+     * @stable ICU 2.0\r
+     */\r
+    protected Calendar(TimeZone zone, Locale aLocale)\r
+    {\r
+        this(zone, ULocale.forLocale(aLocale));\r
+    }\r
+\r
+    /**\r
+     * Constructs a calendar with the specified time zone and locale.\r
+     * @param zone the time zone to use\r
+     * @param locale the ulocale for the week data\r
+     * @stable ICU 3.2\r
+     */\r
+    protected Calendar(TimeZone zone, ULocale locale)\r
+    {\r
+        calendar = java.util.Calendar.getInstance(zone.timeZone, locale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * Returns a calendar using the default time zone and locale.\r
+     * @return a Calendar.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static synchronized Calendar getInstance()\r
+    {\r
+        return new Calendar(java.util.Calendar.getInstance());\r
+    }\r
+\r
+    /**\r
+     * Returns a calendar using the specified time zone and default locale.\r
+     * @param zone the time zone to use\r
+     * @return a Calendar.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static synchronized Calendar getInstance(TimeZone zone)\r
+    {\r
+        return new Calendar(java.util.Calendar.getInstance(zone.timeZone));\r
+    }\r
+\r
+    /**\r
+     * Returns a calendar using the default time zone and specified locale.\r
+     * @param aLocale the locale for the week data\r
+     * @return a Calendar.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static synchronized Calendar getInstance(Locale aLocale)\r
+    {\r
+        return new Calendar(java.util.Calendar.getInstance(aLocale));\r
+    }\r
+\r
+    /**\r
+     * Returns a calendar using the default time zone and specified locale.\r
+     * @param locale the ulocale for the week data\r
+     * @return a Calendar.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static synchronized Calendar getInstance(ULocale locale)\r
+    {\r
+        return new Calendar(java.util.Calendar.getInstance(locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Returns a calendar with the specified time zone and locale.\r
+     * @param zone the time zone to use\r
+     * @param aLocale the locale for the week data\r
+     * @return a Calendar.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static synchronized Calendar getInstance(TimeZone zone,\r
+                                                    Locale aLocale) {\r
+        return new Calendar(java.util.Calendar.getInstance(zone.timeZone, aLocale));\r
+    }\r
+\r
+    /**\r
+     * Returns a calendar with the specified time zone and locale.\r
+     * @param zone the time zone to use\r
+     * @param locale the ulocale for the week data\r
+     * @return a Calendar.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static synchronized Calendar getInstance(TimeZone zone,\r
+                                                    ULocale locale) {\r
+        return new Calendar(java.util.Calendar.getInstance(zone.timeZone, locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Returns the list of locales for which Calendars are installed.\r
+     * @return the list of locales for which Calendars are installed.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static Locale[] getAvailableLocales()\r
+    {\r
+        return java.util.Calendar.getAvailableLocales();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the list of locales for which Calendars are installed.\r
+     * @return the list of locales for which Calendars are installed.\r
+     * @draft ICU 3.2 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static ULocale[] getAvailableULocales()\r
+    {\r
+        if (availableLocales == null) {\r
+            synchronized (Calendar.class) {\r
+                if (availableLocales == null) {\r
+                    Locale[] locales = Locale.getAvailableLocales();\r
+                    availableLocales = new ULocale[locales.length];\r
+                    for (int i = 0; i < locales.length; i++) {\r
+                        availableLocales[i] = ULocale.forLocale(locales[i]);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return availableLocales.clone();\r
+    }\r
+    private static volatile ULocale[] availableLocales;\r
+\r
+    /**\r
+     * {@icu} Given a key and a locale, returns an array of string values in a preferred\r
+     * order that would make a difference. These are all and only those values where\r
+     * the open (creation) of the service with the locale formed from the input locale\r
+     * plus input keyword and that value has different behavior than creation with the\r
+     * input locale alone.\r
+     * @param key           one of the keys supported by this service.  For now, only\r
+     *                      "calendar" is supported.\r
+     * @param locale        the locale\r
+     * @param commonlyUsed  if set to true it will return only commonly used values\r
+     *                      with the given locale in preferred order.  Otherwise,\r
+     *                      it will return all the available values for the locale.\r
+     * @return an array of string values for the given key and the locale.\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final String[] getKeywordValuesForLocale(String key, ULocale locale,\r
+                                                           boolean commonlyUsed) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns this Calendar's current time.\r
+     * @return the current time.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final Date getTime() {\r
+        return calendar.getTime();\r
+    }\r
+\r
+    /**\r
+     * Sets this Calendar's current time with the given Date.\r
+     * \r
+     * <p>Note: Calling <code>setTime</code> with\r
+     * <code>Date(Long.MAX_VALUE)</code> or <code>Date(Long.MIN_VALUE)</code>\r
+     * may yield incorrect field values from {@link #get(int)}.\r
+     * @param date the given Date.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void setTime(Date date) {\r
+        calendar.setTime(date);\r
+    }\r
+\r
+    /**\r
+     * Returns this Calendar's current time as a long.\r
+     * @return the current time as UTC milliseconds from the epoch.\r
+     * @stable ICU 2.0\r
+     */\r
+    public long getTimeInMillis() {\r
+        return calendar.getTimeInMillis();\r
+    }\r
+\r
+    /**\r
+     * Sets this Calendar's current time from the given long value.\r
+     * @param millis the new time in UTC milliseconds from the epoch.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setTimeInMillis( long millis ) {\r
+        calendar.setTimeInMillis(millis);\r
+    }\r
+\r
+    /**\r
+     * Returns the value for a given time field.\r
+     * @param field the given time field.\r
+     * @return the value for the given time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final int get(int field)\r
+    {\r
+        return calendar.get(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Sets the time field with the given value.\r
+     * @param field the given time field.\r
+     * @param value the value to be set for the given time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void set(int field, int value)\r
+    {\r
+        calendar.set(getJDKField(field), value);\r
+    }\r
+\r
+    /**\r
+     * Sets the values for the fields year, month, and date.\r
+     * Previous values of other fields are retained.  If this is not desired,\r
+     * call {@link #clear()} first.\r
+     * @param year the value used to set the YEAR time field.\r
+     * @param month the value used to set the MONTH time field.\r
+     * Month value is 0-based. e.g., 0 for January.\r
+     * @param date the value used to set the DATE time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void set(int year, int month, int date)\r
+    {\r
+        calendar.set(getJDKField(YEAR), year);\r
+        calendar.set(getJDKField(MONTH), month);\r
+        calendar.set(getJDKField(DATE), date);\r
+    }\r
+\r
+    /**\r
+     * Sets the values for the fields year, month, date, hour, and minute.\r
+     * Previous values of other fields are retained.  If this is not desired,\r
+     * call {@link #clear()} first.\r
+     * @param year the value used to set the YEAR time field.\r
+     * @param month the value used to set the MONTH time field.\r
+     * Month value is 0-based. e.g., 0 for January.\r
+     * @param date the value used to set the DATE time field.\r
+     * @param hour the value used to set the HOUR_OF_DAY time field.\r
+     * @param minute the value used to set the MINUTE time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void set(int year, int month, int date, int hour, int minute)\r
+    {\r
+        calendar.set(getJDKField(YEAR), year);\r
+        calendar.set(getJDKField(MONTH), month);\r
+        calendar.set(getJDKField(DATE), date);\r
+        calendar.set(getJDKField(HOUR_OF_DAY), hour);\r
+        calendar.set(getJDKField(MINUTE), minute);\r
+    }\r
+\r
+    /**\r
+     * Sets the values for the fields year, month, date, hour, minute, and second.\r
+     * Previous values of other fields are retained.  If this is not desired,\r
+     * call {@link #clear} first.\r
+     * @param year the value used to set the YEAR time field.\r
+     * @param month the value used to set the MONTH time field.\r
+     * Month value is 0-based. e.g., 0 for January.\r
+     * @param date the value used to set the DATE time field.\r
+     * @param hour the value used to set the HOUR_OF_DAY time field.\r
+     * @param minute the value used to set the MINUTE time field.\r
+     * @param second the value used to set the SECOND time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void set(int year, int month, int date, int hour, int minute,\r
+                          int second)\r
+    {\r
+        calendar.set(getJDKField(YEAR), year);\r
+        calendar.set(getJDKField(MONTH), month);\r
+        calendar.set(getJDKField(DATE), date);\r
+        calendar.set(getJDKField(HOUR_OF_DAY), hour);\r
+        calendar.set(getJDKField(MINUTE), minute);\r
+        calendar.set(getJDKField(SECOND), second);\r
+    }\r
+\r
+    /**\r
+     * Clears the values of all the time fields.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void clear()\r
+    {\r
+        calendar.clear();\r
+    }\r
+\r
+    /**\r
+     * Clears the value in the given time field.\r
+     * @param field the time field to be cleared.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void clear(int field)\r
+    {\r
+        calendar.clear(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Determines if the given time field has a value set.\r
+     * @return true if the given time field has a value set; false otherwise.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final boolean isSet(int field)\r
+    {\r
+        return calendar.isSet(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Compares this calendar to the specified object.\r
+     * The result is <code>true</code> if and only if the argument is\r
+     * not <code>null</code> and is a <code>Calendar</code> object that\r
+     * represents the same calendar as this object.\r
+     * @param obj the object to compare with.\r
+     * @return <code>true</code> if the objects are the same;\r
+     * <code>false</code> otherwise.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean equals(Object obj) {\r
+        try {\r
+            return calendar.equals(((Calendar)obj).calendar);\r
+        } catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns true if the given Calendar object is equivalent to this\r
+     * one.  An equivalent Calendar will behave exactly as this one\r
+     * does, but it may be set to a different time.  By contrast, for\r
+     * the equals() method to return true, the other Calendar must\r
+     * be set to the same time.\r
+     *\r
+     * @param other the Calendar to be compared with this Calendar\r
+     * @stable ICU 2.4\r
+     */\r
+    public boolean isEquivalentTo(Calendar other) {\r
+        return calendar.getClass() == other.calendar.getClass() &&\r
+            calendar.isLenient() == other.calendar.isLenient() &&\r
+            calendar.getFirstDayOfWeek() == other.calendar.getFirstDayOfWeek() &&\r
+            calendar.getMinimalDaysInFirstWeek() == other.calendar.getMinimalDaysInFirstWeek() &&\r
+            calendar.getTimeZone().equals(other.calendar.getTimeZone());\r
+    }\r
+\r
+    /**\r
+     * Returns a hash code for this calendar.\r
+     * @return a hash code value for this object.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int hashCode() {\r
+        return calendar.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Returns the difference in milliseconds between the moment this\r
+     * calendar is set to and the moment the given calendar or Date object\r
+     * is set to.\r
+     */\r
+    private long compare(Object that) {\r
+        long thatMs;\r
+        if (that instanceof Calendar) {\r
+            thatMs = ((Calendar)that).getTimeInMillis();\r
+        } else if (that instanceof Date) {\r
+            thatMs = ((Date)that).getTime();\r
+        } else {\r
+            throw new IllegalArgumentException(that + "is not a Calendar or Date");\r
+        }\r
+        return getTimeInMillis() - thatMs;\r
+    }\r
+\r
+    /**\r
+     * Compares the time field records.\r
+     * Equivalent to comparing result of conversion to UTC.\r
+     * @param when the Calendar to be compared with this Calendar.\r
+     * @return true if the current time of this Calendar is before\r
+     * the time of Calendar when; false otherwise.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean before(Object when) {\r
+        return compare(when) < 0;\r
+    }\r
+\r
+    /**\r
+     * Compares the time field records.\r
+     * Equivalent to comparing result of conversion to UTC.\r
+     * @param when the Calendar to be compared with this Calendar.\r
+     * @return true if the current time of this Calendar is after\r
+     * the time of Calendar when; false otherwise.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean after(Object when) {\r
+        return compare(when) > 0;\r
+    }\r
+\r
+    /**\r
+     * Returns the maximum value that this field could have, given the\r
+     * current date.  For example, with the Gregorian date February 3, 1997\r
+     * and the {@link #DAY_OF_MONTH DAY_OF_MONTH} field, the actual maximum\r
+     * is 28; for February 3, 1996 it is 29.\r
+     *\r
+     * <p>The actual maximum computation ignores smaller fields and the\r
+     * current value of like-sized fields.  For example, the actual maximum\r
+     * of the DAY_OF_YEAR or MONTH depends only on the year and supra-year\r
+     * fields.  The actual maximum of the DAY_OF_MONTH depends, in\r
+     * addition, on the MONTH field and any other fields at that\r
+     * granularity (such as IS_LEAP_MONTH).  The\r
+     * DAY_OF_WEEK_IN_MONTH field does not depend on the current\r
+     * DAY_OF_WEEK; it returns the maximum for any day of week in the\r
+     * current month.  Likewise for the WEEK_OF_MONTH and WEEK_OF_YEAR\r
+     * fields.\r
+     *\r
+     * @param field the field whose maximum is desired\r
+     * @return the maximum of the given field for the current date of this calendar\r
+     * @see #getMaximum\r
+     * @see #getLeastMaximum\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getActualMaximum(int field) {\r
+        return calendar.getActualMaximum(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Returns the minimum value that this field could have, given the current date.\r
+     * For most fields, this is the same as {@link #getMinimum getMinimum}\r
+     * and {@link #getGreatestMinimum getGreatestMinimum}.  However, some fields,\r
+     * especially those related to week number, are more complicated.\r
+     * <p>\r
+     * For example, assume {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek}\r
+     * returns 4 and {@link #getFirstDayOfWeek getFirstDayOfWeek} returns SUNDAY.\r
+     * If the first day of the month is Sunday, Monday, Tuesday, or Wednesday\r
+     * there will be four or more days in the first week, so it will be week number 1,\r
+     * and <code>getActualMinimum(WEEK_OF_MONTH)</code> will return 1.  However,\r
+     * if the first of the month is a Thursday, Friday, or Saturday, there are\r
+     * <em>not</em> four days in that week, so it is week number 0, and\r
+     * <code>getActualMinimum(WEEK_OF_MONTH)</code> will return 0.\r
+     * <p>\r
+     * @param field the field whose actual minimum value is desired.\r
+     * @return the minimum of the given field for the current date of this calendar\r
+     *\r
+     * @see #getMinimum\r
+     * @see #getGreatestMinimum\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getActualMinimum(int field) {\r
+        return calendar.getActualMinimum(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Rolls (up/down) a single unit of time on the given field.  If the\r
+     * field is rolled past its maximum allowable value, it will "wrap" back\r
+     * to its minimum and continue rolling. For\r
+     * example, to roll the current date up by one day, you can call:\r
+     * <p>\r
+     * <code>roll({@link #DATE}, true)</code>\r
+     * <p>\r
+     * When rolling on the {@link #YEAR} field, it will roll the year\r
+     * value in the range between 1 and the value returned by calling\r
+     * {@link #getMaximum getMaximum}({@link #YEAR}).\r
+     * <p>\r
+     * When rolling on certain fields, the values of other fields may conflict and\r
+     * need to be changed.  For example, when rolling the <code>MONTH</code> field\r
+     * for the Gregorian date 1/31/96 upward, the <code>DAY_OF_MONTH</code> field\r
+     * must be adjusted so that the result is 2/29/96 rather than the invalid\r
+     * 2/31/96.\r
+     * <p>\r
+     * <b>Note:</b> Calling <tt>roll(field, true)</tt> N times is <em>not</em>\r
+     * necessarily equivalent to calling <tt>roll(field, N)</tt>.  For example,\r
+     * imagine that you start with the date Gregorian date January 31, 1995.  If you call\r
+     * <tt>roll(Calendar.MONTH, 2)</tt>, the result will be March 31, 1995.\r
+     * But if you call <tt>roll(Calendar.MONTH, true)</tt>, the result will be\r
+     * February 28, 1995.  Calling it one more time will give March 28, 1995, which\r
+     * is usually not the desired result.\r
+     * <p>\r
+     * <b>Note:</b> You should always use <tt>roll</tt> and <tt>add</tt> rather\r
+     * than attempting to perform arithmetic operations directly on the fields\r
+     * of a <tt>Calendar</tt>.  It is quite possible for <tt>Calendar</tt> subclasses\r
+     * to have fields with non-linear behavior, for example missing months\r
+     * or days during non-leap years.  The subclasses' <tt>add</tt> and <tt>roll</tt>\r
+     * methods will take this into account, while simple arithmetic manipulations\r
+     * may give invalid results.\r
+     * <p>\r
+     * @param field the calendar field to roll.\r
+     *\r
+     * @param up    indicates if the value of the specified time field is to be\r
+     *              rolled up or rolled down. Use <code>true</code> if rolling up,\r
+     *              <code>false</code> otherwise.\r
+     *\r
+     * @exception   IllegalArgumentException if the field is invalid or refers\r
+     *              to a field that cannot be handled by this method.\r
+     * @see #roll(int, int)\r
+     * @see #add\r
+     * @stable ICU 2.0\r
+     */\r
+    public final void roll(int field, boolean up)\r
+    {\r
+        calendar.roll(getJDKField(field), up);\r
+    }\r
+\r
+    /**\r
+     * Rolls (up/down) a specified amount time on the given field.  For\r
+     * example, to roll the current date up by three days, you can call\r
+     * <code>roll(Calendar.DATE, 3)</code>.  If the\r
+     * field is rolled past its maximum allowable value, it will "wrap" back\r
+     * to its minimum and continue rolling.\r
+     * For example, calling <code>roll(Calendar.DATE, 10)</code>\r
+     * on a Gregorian calendar set to 4/25/96 will result in the date 4/5/96.\r
+     * <p>\r
+     * When rolling on certain fields, the values of other fields may conflict and\r
+     * need to be changed.  For example, when rolling the {@link #MONTH MONTH} field\r
+     * for the Gregorian date 1/31/96 by +1, the {@link #DAY_OF_MONTH DAY_OF_MONTH} field\r
+     * must be adjusted so that the result is 2/29/96 rather than the invalid\r
+     * 2/31/96.\r
+     * <p>\r
+     * {@icunote} the ICU implementation of this method is able to roll\r
+     * all fields except for {@link #ERA ERA}, {@link #DST_OFFSET DST_OFFSET},\r
+     * and {@link #ZONE_OFFSET ZONE_OFFSET}.  Subclasses may, of course, add support for\r
+     * additional fields in their overrides of <code>roll</code>.\r
+     * <p>\r
+     * <b>Note:</b> You should always use <tt>roll</tt> and <tt>add</tt> rather\r
+     * than attempting to perform arithmetic operations directly on the fields\r
+     * of a <tt>Calendar</tt>.  It is quite possible for <tt>Calendar</tt> subclasses\r
+     * to have fields with non-linear behavior, for example missing months\r
+     * or days during non-leap years.  The subclasses' <tt>add</tt> and <tt>roll</tt>\r
+     * methods will take this into account, while simple arithmetic manipulations\r
+     * may give invalid results.\r
+     * <p>\r
+     * <b>Subclassing:</b><br>\r
+     * This implementation of <code>roll</code> assumes that the behavior of the\r
+     * field is continuous between its minimum and maximum, which are found by\r
+     * calling {@link #getActualMinimum getActualMinimum} and {@link #getActualMaximum getActualMaximum}.\r
+     * For most such fields, simple addition, subtraction, and modulus operations\r
+     * are sufficient to perform the roll.  For week-related fields,\r
+     * the results of {@link #getFirstDayOfWeek getFirstDayOfWeek} and\r
+     * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} are also necessary.\r
+     * Subclasses can override these two methods if their values differ from the defaults.\r
+     * <p>\r
+     * Subclasses that have fields for which the assumption of continuity breaks\r
+     * down must overide <code>roll</code> to handle those fields specially.\r
+     * For example, in the Hebrew calendar the month "Adar I"\r
+     * only occurs in leap years; in other years the calendar jumps from\r
+     * Shevat (month #4) to Adar (month #6).  The\r
+     * {@link HebrewCalendar#roll HebrewCalendar.roll} method takes this into account,\r
+     * so that rolling the month of Shevat by one gives the proper result (Adar) in a\r
+     * non-leap year.\r
+     * <p>\r
+     * @param field     the calendar field to roll.\r
+     * @param amount    the amount by which the field should be rolled.\r
+     *\r
+     * @exception   IllegalArgumentException if the field is invalid or refers\r
+     *              to a field that cannot be handled by this method.\r
+     * @see #roll(int, boolean)\r
+     * @see #add\r
+     * @stable ICU 2.0\r
+     */\r
+    public void roll(int field, int amount) {\r
+        calendar.roll(getJDKField(field), amount);\r
+    }\r
+\r
+    /**\r
+     * Add a signed amount to a specified field, using this calendar's rules.\r
+     * For example, to add three days to the current date, you can call\r
+     * <code>add(Calendar.DATE, 3)</code>.\r
+     * <p>\r
+     * When adding to certain fields, the values of other fields may conflict and\r
+     * need to be changed.  For example, when adding one to the {@link #MONTH MONTH} field\r
+     * for the Gregorian date 1/31/96, the {@link #DAY_OF_MONTH DAY_OF_MONTH} field\r
+     * must be adjusted so that the result is 2/29/96 rather than the invalid\r
+     * 2/31/96.\r
+     * <p>\r
+     * {@icunote} The ICU implementation of this method is able to add to\r
+     * all fields except for {@link #ERA ERA}, {@link #DST_OFFSET DST_OFFSET},\r
+     * and {@link #ZONE_OFFSET ZONE_OFFSET}.  Subclasses may, of course, add support for\r
+     * additional fields in their overrides of <code>add</code>.\r
+     * <p>\r
+     * <b>Note:</b> You should always use <tt>roll</tt> and <tt>add</tt> rather\r
+     * than attempting to perform arithmetic operations directly on the fields\r
+     * of a <tt>Calendar</tt>.  It is quite possible for <tt>Calendar</tt> subclasses\r
+     * to have fields with non-linear behavior, for example missing months\r
+     * or days during non-leap years.  The subclasses' <tt>add</tt> and <tt>roll</tt>\r
+     * methods will take this into account, while simple arithmetic manipulations\r
+     * may give invalid results.\r
+     * <p>\r
+     * <b>Subclassing:</b><br>\r
+     * This implementation of <code>add</code> assumes that the behavior of the\r
+     * field is continuous between its minimum and maximum, which are found by\r
+     * calling {@link #getActualMinimum getActualMinimum} and\r
+     * {@link #getActualMaximum getActualMaximum}.\r
+     * For such fields, simple arithmetic operations are sufficient to\r
+     * perform the add.\r
+     * <p>\r
+     * Subclasses that have fields for which this assumption of continuity breaks\r
+     * down must overide <code>add</code> to handle those fields specially.\r
+     * For example, in the Hebrew calendar the month "Adar I"\r
+     * only occurs in leap years; in other years the calendar jumps from\r
+     * Shevat (month #4) to Adar (month #6).  The\r
+     * {@link HebrewCalendar#add HebrewCalendar.add} method takes this into account,\r
+     * so that adding one month\r
+     * to a date in Shevat gives the proper result (Adar) in a non-leap year.\r
+     * <p>\r
+     * @param field     the time field.\r
+     * @param amount    the amount to add to the field.\r
+     *\r
+     * @exception   IllegalArgumentException if the field is invalid or refers\r
+     *              to a field that cannot be handled by this method.\r
+     * @see #roll(int, int)\r
+     * @stable ICU 2.0\r
+     */\r
+    public void add(int field, int amount) {\r
+        calendar.add(getJDKField(field), amount);\r
+    }\r
+\r
+    private static String _getDisplayName(Calendar cal) {\r
+        String type = cal.getType();\r
+        if (type.equals("japanese")) {\r
+            return "Japanese Calendar";\r
+        } else if (type.equals("buddhist")) {\r
+            return "Buddhist Calendar";\r
+        }\r
+        return "Gregorian Calendar";\r
+    }\r
+\r
+    /**\r
+     * Returns the name of this calendar in the language of the given locale.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getDisplayName(Locale loc) {\r
+        return _getDisplayName(this);\r
+    }\r
+\r
+    /**\r
+     * Returns the name of this calendar in the language of the given locale.\r
+     * @stable ICU 3.2\r
+     */\r
+    public String getDisplayName(ULocale loc) {\r
+        return _getDisplayName(this);\r
+    }\r
+\r
+    /**\r
+     * Compares the times (in millis) represented by two\r
+     * <code>Calendar</code> objects.\r
+     *\r
+     * @param that the <code>Calendar</code> to compare to this.\r
+     * @return <code>0</code> if the time represented by\r
+     * this <code>Calendar</code> is equal to the time represented\r
+     * by that <code>Calendar</code>, a value less than\r
+     * <code>0</code> if the time represented by this is before\r
+     * the time represented by that, and a value greater than\r
+     * <code>0</code> if the time represented by this\r
+     * is after the time represented by that.\r
+     * @throws NullPointerException if that\r
+     * <code>Calendar</code> is null.\r
+     * @throws IllegalArgumentException if the time of that\r
+     * <code>Calendar</code> can't be obtained because of invalid\r
+     * calendar values.\r
+     * @stable ICU 3.4\r
+     */\r
+    public int compareTo(Calendar that) {\r
+        return calendar.compareTo(that.calendar);\r
+    }\r
+\r
+    //-------------------------------------------------------------------------\r
+    // Interface for creating custon DateFormats for different types of Calendars\r
+    //-------------------------------------------------------------------------\r
+\r
+    /**\r
+     * {@icu} Returns a <code>DateFormat</code> appropriate to this calendar.\r
+     * Subclasses wishing to specialize this behavior should override\r
+     * {@link #handleGetDateFormat}.\r
+     * @stable ICU 2.0\r
+     */\r
+    public DateFormat getDateTimeFormat(int dateStyle, int timeStyle, Locale loc) {\r
+        if (dateStyle != DateFormat.NONE) {\r
+            if (timeStyle == DateFormat.NONE) {\r
+                return DateFormat.getDateInstance((Calendar)this.clone(), dateStyle, loc);\r
+            } else {\r
+                return DateFormat.getDateTimeInstance((Calendar)this.clone(), dateStyle, timeStyle, loc);\r
+            }\r
+        } else if (timeStyle != DateFormat.NONE) {\r
+            return DateFormat.getTimeInstance((Calendar)this.clone(), timeStyle, loc);\r
+        } else {\r
+            return null;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a <code>DateFormat</code> appropriate to this calendar.\r
+     * Subclasses wishing to specialize this behavior should override\r
+     * {@link #handleGetDateFormat}.\r
+     * @stable ICU 3.2\r
+     */\r
+    public DateFormat getDateTimeFormat(int dateStyle, int timeStyle, ULocale loc) {\r
+        return getDateTimeFormat(dateStyle, timeStyle, loc.toLocale());\r
+    }\r
+\r
+    //-------------------------------------------------------------------------\r
+    // Constants\r
+    //-------------------------------------------------------------------------\r
+\r
+    /**\r
+     * {@icu} Returns the difference between the given time and the time this\r
+     * calendar object is set to.  If this calendar is set\r
+     * <em>before</em> the given time, the returned value will be\r
+     * positive.  If this calendar is set <em>after</em> the given\r
+     * time, the returned value will be negative.  The\r
+     * <code>field</code> parameter specifies the units of the return\r
+     * value.  For example, if <code>fieldDifference(when,\r
+     * Calendar.MONTH)</code> returns 3, then this calendar is set to\r
+     * 3 months before <code>when</code>, and possibly some additional\r
+     * time less than one month.\r
+     *\r
+     * <p>As a side effect of this call, this calendar is advanced\r
+     * toward <code>when</code> by the given amount.  That is, calling\r
+     * this method has the side effect of calling <code>add(field,\r
+     * n)</code>, where <code>n</code> is the return value.\r
+     *\r
+     * <p>Usage: To use this method, call it first with the largest\r
+     * field of interest, then with progressively smaller fields.  For\r
+     * example:\r
+     *\r
+     * <pre>\r
+     * int y = cal.fieldDifference(when, Calendar.YEAR);\r
+     * int m = cal.fieldDifference(when, Calendar.MONTH);\r
+     * int d = cal.fieldDifference(when, Calendar.DATE);</pre>\r
+     *\r
+     * computes the difference between <code>cal</code> and\r
+     * <code>when</code> in years, months, and days.\r
+     *\r
+     * <p>Note: <code>fieldDifference()</code> is\r
+     * <em>asymmetrical</em>.  That is, in the following code:\r
+     *\r
+     * <pre>\r
+     * cal.setTime(date1);\r
+     * int m1 = cal.fieldDifference(date2, Calendar.MONTH);\r
+     * int d1 = cal.fieldDifference(date2, Calendar.DATE);\r
+     * cal.setTime(date2);\r
+     * int m2 = cal.fieldDifference(date1, Calendar.MONTH);\r
+     * int d2 = cal.fieldDifference(date1, Calendar.DATE);</pre>\r
+     *\r
+     * one might expect that <code>m1 == -m2 && d1 == -d2</code>.\r
+     * However, this is not generally the case, because of\r
+     * irregularities in the underlying calendar system (e.g., the\r
+     * Gregorian calendar has a varying number of days per month).\r
+     *\r
+     * @param when the date to compare this calendar's time to\r
+     * @param field the field in which to compute the result\r
+     * @return the difference, either positive or negative, between\r
+     * this calendar's time and <code>when</code>, in terms of\r
+     * <code>field</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int fieldDifference(Date when, int field) {\r
+        int min = 0;\r
+        long startMs = getTimeInMillis();\r
+        long targetMs = when.getTime();\r
+        // Always add from the start millis.  This accomodates\r
+        // operations like adding years from February 29, 2000 up to\r
+        // February 29, 2004.  If 1, 1, 1, 1 is added to the year\r
+        // field, the DOM gets pinned to 28 and stays there, giving an\r
+        // incorrect DOM difference of 1.  We have to add 1, reset, 2,\r
+        // reset, 3, reset, 4.\r
+        if (startMs < targetMs) {\r
+            int max = 1;\r
+            // Find a value that is too large\r
+            for (;;) {\r
+                setTimeInMillis(startMs);\r
+                add(field, max);\r
+                long ms = getTimeInMillis();\r
+                if (ms == targetMs) {\r
+                    return max;\r
+                } else if (ms > targetMs) {\r
+                    break;\r
+                } else {\r
+                    max <<= 1;\r
+                    if (max < 0) {\r
+                        // Field difference too large to fit into int\r
+                        throw new RuntimeException();\r
+                    }\r
+                }\r
+            }\r
+            // Do a binary search\r
+            while ((max - min) > 1) {\r
+                int t = (min + max) / 2;\r
+                setTimeInMillis(startMs);\r
+                add(field, t);\r
+                long ms = getTimeInMillis();\r
+                if (ms == targetMs) {\r
+                    return t;\r
+                } else if (ms > targetMs) {\r
+                    max = t;\r
+                } else {\r
+                    min = t;\r
+                }\r
+            }\r
+        } else if (startMs > targetMs) {\r
+            //Eclipse stated the following is "dead code"\r
+            /*if (false) {\r
+                // This works, and makes the code smaller, but costs\r
+                // an extra object creation and an extra couple cycles\r
+                // of calendar computation.\r
+                setTimeInMillis(targetMs);\r
+                min = -fieldDifference(new Date(startMs), field);\r
+            }*/\r
+            int max = -1;\r
+            // Find a value that is too small\r
+            for (;;) {\r
+                setTimeInMillis(startMs);\r
+                add(field, max);\r
+                long ms = getTimeInMillis();\r
+                if (ms == targetMs) {\r
+                    return max;\r
+                } else if (ms < targetMs) {\r
+                    break;\r
+                } else {\r
+                    max <<= 1;\r
+                    if (max == 0) {\r
+                        // Field difference too large to fit into int\r
+                        throw new RuntimeException();\r
+                    }\r
+                }\r
+            }\r
+            // Do a binary search\r
+            while ((min - max) > 1) {\r
+                int t = (min + max) / 2;\r
+                setTimeInMillis(startMs);\r
+                add(field, t);\r
+                long ms = getTimeInMillis();\r
+                if (ms == targetMs) {\r
+                    return t;\r
+                } else if (ms < targetMs) {\r
+                    max = t;\r
+                } else {\r
+                    min = t;\r
+                }\r
+            }\r
+        }\r
+        // Set calendar to end point\r
+        setTimeInMillis(startMs);\r
+        add(field, min);\r
+        return min;\r
+    }\r
+\r
+    /**\r
+     * Sets the time zone with the given time zone value.\r
+     * @param value the given time zone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setTimeZone(TimeZone value)\r
+    {\r
+        calendar.setTimeZone(value.timeZone);\r
+    }\r
+\r
+    /**\r
+     * Returns the time zone.\r
+     * @return the time zone object associated with this calendar.\r
+     * @stable ICU 2.0\r
+     */\r
+    public TimeZone getTimeZone()\r
+    {\r
+        return new TimeZone(calendar.getTimeZone());\r
+    }\r
+\r
+    /**\r
+     * Specify whether or not date/time interpretation is to be lenient.  With\r
+     * lenient interpretation, a date such as "February 942, 1996" will be\r
+     * treated as being equivalent to the 941st day after February 1, 1996.\r
+     * With strict interpretation, such dates will cause an exception to be\r
+     * thrown.\r
+     *\r
+     * @see DateFormat#setLenient\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setLenient(boolean lenient)\r
+    {\r
+        calendar.setLenient(lenient);\r
+    }\r
+\r
+    /**\r
+     * Tell whether date/time interpretation is to be lenient.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isLenient()\r
+    {\r
+        return calendar.isLenient();\r
+    }\r
+\r
+    /**\r
+     * Sets what the first day of the week is; e.g., Sunday in US,\r
+     * Monday in France.\r
+     * @param value the given first day of the week.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setFirstDayOfWeek(int value)\r
+    {\r
+        calendar.setFirstDayOfWeek(value);\r
+    }\r
+\r
+    /**\r
+     * Returns what the first day of the week is; e.g., Sunday in US,\r
+     * Monday in France.\r
+     * @return the first day of the week.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getFirstDayOfWeek()\r
+    {\r
+        return calendar.getFirstDayOfWeek();\r
+    }\r
+\r
+    /**\r
+     * Sets what the minimal days required in the first week of the year are.\r
+     * For example, if the first week is defined as one that contains the first\r
+     * day of the first month of a year, call the method with value 1. If it\r
+     * must be a full week, use value 7.\r
+     * @param value the given minimal days required in the first week\r
+     * of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setMinimalDaysInFirstWeek(int value)\r
+    {\r
+        calendar.setMinimalDaysInFirstWeek(value);\r
+    }\r
+\r
+    /**\r
+     * Returns what the minimal days required in the first week of the year are;\r
+     * e.g., if the first week is defined as one that contains the first day\r
+     * of the first month of a year, getMinimalDaysInFirstWeek returns 1. If\r
+     * the minimal days required must be a full week, getMinimalDaysInFirstWeek\r
+     * returns 7.\r
+     * @return the minimal days required in the first week of the year.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getMinimalDaysInFirstWeek()\r
+    {\r
+        return calendar.getMinimalDaysInFirstWeek();\r
+    }\r
+\r
+    /**\r
+     * Returns the minimum value for the given time field.\r
+     * e.g., for Gregorian DAY_OF_MONTH, 1.\r
+     * @param field the given time field.\r
+     * @return the minimum value for the given time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final int getMinimum(int field) {\r
+        return calendar.getMinimum(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Returns the maximum value for the given time field.\r
+     * e.g. for Gregorian DAY_OF_MONTH, 31.\r
+     * @param field the given time field.\r
+     * @return the maximum value for the given time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final int getMaximum(int field) {\r
+        return calendar.getMaximum(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Returns the highest minimum value for the given field if varies.\r
+     * Otherwise same as getMinimum(). For Gregorian, no difference.\r
+     * @param field the given time field.\r
+     * @return the highest minimum value for the given time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final int getGreatestMinimum(int field) {\r
+        return calendar.getGreatestMinimum(getJDKField(field));\r
+    }\r
+\r
+    /**\r
+     * Returns the lowest maximum value for the given field if varies.\r
+     * Otherwise same as getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28.\r
+     * @param field the given time field.\r
+     * @return the lowest maximum value for the given time field.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final int getLeastMaximum(int field) {\r
+        return calendar.getLeastMaximum(getJDKField(field));\r
+    }\r
+\r
+    //-------------------------------------------------------------------------\r
+    // Weekend support -- determining which days of the week are the weekend\r
+    // in a given locale\r
+    //-------------------------------------------------------------------------\r
+\r
+    /**\r
+     * {@icu} Returns whether the given day of the week is a weekday, a\r
+     * weekend day, or a day that transitions from one to the other,\r
+     * in this calendar system.  If a transition occurs at midnight,\r
+     * then the days before and after the transition will have the\r
+     * type WEEKDAY or WEEKEND.  If a transition occurs at a time\r
+     * other than midnight, then the day of the transition will have\r
+     * the type WEEKEND_ONSET or WEEKEND_CEASE.  In this case, the\r
+     * method getWeekendTransition() will return the point of\r
+     * transition.\r
+     * @param dayOfWeek either SUNDAY, MONDAY, TUESDAY, WEDNESDAY,\r
+     * THURSDAY, FRIDAY, or SATURDAY\r
+     * @return either WEEKDAY, WEEKEND, WEEKEND_ONSET, or\r
+     * WEEKEND_CEASE\r
+     * @exception IllegalArgumentException if dayOfWeek is not\r
+     * between SUNDAY and SATURDAY, inclusive\r
+     * @see #WEEKDAY\r
+     * @see #WEEKEND\r
+     * @see #WEEKEND_ONSET\r
+     * @see #WEEKEND_CEASE\r
+     * @see #getWeekendTransition\r
+     * @see #isWeekend(Date)\r
+     * @see #isWeekend()\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getDayOfWeekType(int dayOfWeek) {\r
+        // weekend always full saturday and sunday with com.ibm.icu.base\r
+        if (dayOfWeek < SUNDAY || dayOfWeek > 7) {\r
+            throw new IllegalArgumentException("illegal day of week: " + dayOfWeek);\r
+        } else if (dayOfWeek == SATURDAY || dayOfWeek == SUNDAY) {\r
+            return WEEKEND;\r
+        }\r
+        return WEEKDAY;}\r
+\r
+    /**\r
+     * {@icu} Returns the time during the day at which the weekend begins or end in this\r
+     * calendar system.  If getDayOfWeekType(dayOfWeek) == WEEKEND_ONSET return the time\r
+     * at which the weekend begins.  If getDayOfWeekType(dayOfWeek) == WEEKEND_CEASE\r
+     * return the time at which the weekend ends.  If getDayOfWeekType(dayOfWeek) has some\r
+     * other value, then throw an exception.\r
+     * @param dayOfWeek either SUNDAY, MONDAY, TUESDAY, WEDNESDAY,\r
+     * THURSDAY, FRIDAY, or SATURDAY\r
+     * @return the milliseconds after midnight at which the\r
+     * weekend begins or ends\r
+     * @exception IllegalArgumentException if dayOfWeek is not\r
+     * WEEKEND_ONSET or WEEKEND_CEASE\r
+     * @see #getDayOfWeekType\r
+     * @see #isWeekend(Date)\r
+     * @see #isWeekend()\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getWeekendTransition(int dayOfWeek) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns true if the given date and time is in the weekend in this calendar\r
+     * system.  Equivalent to calling setTime() followed by isWeekend().  Note: This\r
+     * method changes the time this calendar is set to.\r
+     * @param date the date and time\r
+     * @return true if the given date and time is part of the\r
+     * weekend\r
+     * @see #getDayOfWeekType\r
+     * @see #getWeekendTransition\r
+     * @see #isWeekend()\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isWeekend(Date date) {\r
+        calendar.setTime(date);\r
+        return isWeekend();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns true if this Calendar's current date and time is in the weekend in\r
+     * this calendar system.\r
+     * @return true if the given date and time is part of the\r
+     * weekend\r
+     * @see #getDayOfWeekType\r
+     * @see #getWeekendTransition\r
+     * @see #isWeekend(Date)\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean isWeekend() {\r
+        // weekend always full saturday and sunday with com.ibm.icu.base\r
+        int dow = calendar.get(Calendar.DAY_OF_WEEK);\r
+        if (dow == SATURDAY || dow == SUNDAY) {\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+\r
+    //-------------------------------------------------------------------------\r
+    // End of weekend support\r
+    //-------------------------------------------------------------------------\r
+\r
+    /**\r
+     * Overrides Cloneable\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone()\r
+    {\r
+        return new Calendar((java.util.Calendar)calendar.clone());\r
+    }\r
+\r
+    /**\r
+     * Returns a string representation of this calendar. This method\r
+     * is intended to be used only for debugging purposes, and the\r
+     * format of the returned string may vary between implementations.\r
+     * The returned string may be empty but may not be <code>null</code>.\r
+     *\r
+     * @return  a string representation of this calendar.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String toString() {\r
+        return calendar.toString();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the number of fields defined by this calendar.  Valid field\r
+     * arguments to <code>set()</code> and <code>get()</code> are\r
+     * <code>0..getFieldCount()-1</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final int getFieldCount() {\r
+        return FIELD_COUNT;\r
+    }\r
+    private static final int FIELD_COUNT = IS_LEAP_MONTH + 1;\r
+\r
+    /**\r
+     * {@icu} Returns the current Calendar type.  Note, in 3.0 this function will return\r
+     * 'gregorian' in Calendar to emulate legacy behavior\r
+     * @return type of calendar (gregorian, etc)\r
+     * @stable ICU 3.8\r
+     */\r
+    public String getType() {\r
+        // JDK supports Gregorian, Japanese and Buddhist\r
+        String name = calendar.getClass().getSimpleName().toLowerCase(Locale.US);\r
+        if (name.contains("japanese")) {\r
+            return "japanese";\r
+        } else if (name.contains("buddhist")) {\r
+            return "buddhist";\r
+        }\r
+        return "gregorian";\r
+    }\r
+\r
+    // -------- BEGIN ULocale boilerplate --------\r
+\r
+    /**\r
+     * {@icu} Returns the locale that was used to create this object, or null.\r
+     * This may may differ from the locale requested at the time of\r
+     * this object's creation.  For example, if an object is created\r
+     * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be\r
+     * drawn from <tt>en</tt> (the <i>actual</i> locale), and\r
+     * <tt>en_US</tt> may be the most specific locale that exists (the\r
+     * <i>valid</i> locale).\r
+     *\r
+     * <p>Note: This method will be implemented in ICU 3.0; ICU 2.8\r
+     * contains a partial preview implementation.  The * <i>actual</i>\r
+     * locale is returned correctly, but the <i>valid</i> locale is\r
+     * not, in most cases.\r
+     * @param type type of information requested, either {@link\r
+     * com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link\r
+     * com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.\r
+     * @return the information specified by <i>type</i>, or null if\r
+     * this object was not constructed from locale data.\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public final ULocale getLocale(ULocale.Type type) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    // -------- END ULocale boilerplate --------\r
+\r
+\r
+    private static int getJDKField(int icuField) {\r
+        switch (icuField) {\r
+        case ERA:\r
+            return java.util.Calendar.ERA;\r
+        case YEAR:\r
+            return java.util.Calendar.YEAR;\r
+        case MONTH:\r
+            return java.util.Calendar.MONTH;\r
+        case WEEK_OF_YEAR:\r
+            return java.util.Calendar.WEEK_OF_YEAR;\r
+        case WEEK_OF_MONTH:\r
+            return java.util.Calendar.WEEK_OF_MONTH;\r
+        case DATE:\r
+            return java.util.Calendar.DATE;\r
+//        case DAY_OF_MONTH:\r
+//            return java.util.Calendar.DAY_OF_MONTH;\r
+        case DAY_OF_YEAR:\r
+            return java.util.Calendar.DAY_OF_YEAR;\r
+        case DAY_OF_WEEK:\r
+            return java.util.Calendar.DAY_OF_WEEK;\r
+        case DAY_OF_WEEK_IN_MONTH:\r
+            return java.util.Calendar.DAY_OF_WEEK_IN_MONTH;\r
+        case AM_PM:\r
+            return java.util.Calendar.AM_PM;\r
+        case HOUR:\r
+            return java.util.Calendar.HOUR;\r
+        case HOUR_OF_DAY:\r
+            return java.util.Calendar.HOUR_OF_DAY;\r
+        case MINUTE:\r
+            return java.util.Calendar.MINUTE;\r
+        case SECOND:\r
+            return java.util.Calendar.SECOND;\r
+        case MILLISECOND:\r
+            return java.util.Calendar.MILLISECOND;\r
+        case ZONE_OFFSET:\r
+            return java.util.Calendar.ZONE_OFFSET;\r
+        case DST_OFFSET:\r
+            return java.util.Calendar.DST_OFFSET;\r
+\r
+        case YEAR_WOY:\r
+        case DOW_LOCAL:\r
+        case EXTENDED_YEAR:\r
+        case JULIAN_DAY:\r
+        case MILLISECONDS_IN_DAY:\r
+            // Unmappable\r
+            throw new UnsupportedOperationException("Calendar field type not supported by com.ibm.icu.base");\r
+        default:\r
+            // Illegal\r
+            throw new ArrayIndexOutOfBoundsException("Specified calendar field is out of range");\r
+        }\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Currency.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/Currency.java
new file mode 100644 (file)
index 0000000..bac7820
--- /dev/null
@@ -0,0 +1,420 @@
+/**\r
+ *******************************************************************************\r
+ * Copyright (C) 2001-2011, International Business Machines Corporation and    *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.util;\r
+\r
+import java.io.Serializable;\r
+import java.text.ParsePosition;\r
+import java.util.Date;\r
+import java.util.Locale;\r
+\r
+/**\r
+ * A class encapsulating a currency, as defined by ISO 4217.  A\r
+ * <tt>Currency</tt> object can be created given a <tt>Locale</tt> or\r
+ * given an ISO 4217 code.  Once created, the <tt>Currency</tt> object\r
+ * can return various data necessary to its proper display:\r
+ *\r
+ * <ul><li>A display symbol, for a specific locale\r
+ * <li>The number of fraction digits to display\r
+ * <li>A rounding increment\r
+ * </ul>\r
+ *\r
+ * The <tt>DecimalFormat</tt> class uses these data to display\r
+ * currencies.\r
+ *\r
+ * <p>Note: This class deliberately resembles\r
+ * <tt>java.util.Currency</tt> but it has a completely independent\r
+ * implementation, and adds features not present in the JDK.\r
+ * @author Alan Liu\r
+ * @stable ICU 2.2\r
+ */\r
+public class Currency implements Serializable {\r
+    private static final long serialVersionUID = 1L;\r
+\r
+    /**\r
+     * @internal\r
+     */\r
+    public final java.util.Currency currency;\r
+\r
+    /**\r
+     * @internal\r
+     * @param delegate the NumberFormat to which to delegate\r
+     */\r
+    public Currency(java.util.Currency delegate) {\r
+        this.currency = delegate;\r
+    }\r
+\r
+    /**\r
+     * Selector for getName() indicating a symbolic name for a\r
+     * currency, such as "$" for USD.\r
+     * @stable ICU 2.6\r
+     */\r
+    public static final int SYMBOL_NAME = 0;\r
+\r
+    /**\r
+     * Selector for ucurr_getName indicating the long name for a\r
+     * currency, such as "US Dollar" for USD.\r
+     * @stable ICU 2.6\r
+     */\r
+    public static final int LONG_NAME = 1;\r
+   \r
+    /**\r
+     * Selector for getName() indicating the plural long name for a \r
+     * currency, such as "US dollar" for USD in "1 US dollar", \r
+     * and "US dollars" for USD in "2 US dollars".\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final int PLURAL_LONG_NAME = 2;\r
+\r
+    /**\r
+     * Returns a currency object for the default currency in the given\r
+     * locale.\r
+     * @param locale the locale\r
+     * @return the currency object for this locale\r
+     * @stable ICU 2.2\r
+     */\r
+    public static Currency getInstance(Locale locale) {\r
+        return new Currency(java.util.Currency.getInstance(locale));\r
+    }\r
+\r
+    /**\r
+     * Returns a currency object for the default currency in the given\r
+     * locale.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static Currency getInstance(ULocale locale) {\r
+        return new Currency(java.util.Currency.getInstance(locale.toLocale()));\r
+    }\r
+\r
+    /**\r
+     * Returns an array of Strings which contain the currency\r
+     * identifiers that are valid for the given locale on the \r
+     * given date.  If there are no such identifiers, returns null.\r
+     * Returned identifiers are in preference order.\r
+     * @param loc the locale for which to retrieve currency codes.\r
+     * @param d the date for which to retrieve currency codes for the given locale.\r
+     * @return The array of ISO currency codes.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static String[] getAvailableCurrencyCodes(ULocale loc, Date d) {\r
+        throw new UnsupportedOperationException("Method not supproted by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns a currency object given an ISO 4217 3-letter code.\r
+     * @param theISOCode the iso code\r
+     * @return the currency for this iso code\r
+     * @throws NullPointerException if <code>theISOCode</code> is null.\r
+     * @throws IllegalArgumentException if <code>theISOCode</code> is not a\r
+     *         3-letter alpha code.\r
+     * @stable ICU 2.2\r
+     */\r
+    public static Currency getInstance(String theISOCode) {\r
+        return new Currency(java.util.Currency.getInstance(theISOCode));\r
+    }\r
+\r
+    /**\r
+     * Registers a new currency for the provided locale.  The returned object\r
+     * is a key that can be used to unregister this currency object.\r
+     * @param currency the currency to register\r
+     * @param locale the ulocale under which to register the currency\r
+     * @return a registry key that can be used to unregister this currency\r
+     * @see #unregister\r
+     * @stable ICU 3.2\r
+     */\r
+    public static Object registerInstance(Currency currency, ULocale locale) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Unregister the currency associated with this key (obtained from\r
+     * registerInstance).\r
+     * @param registryKey the registry key returned from registerInstance\r
+     * @see #registerInstance\r
+     * @stable ICU 2.6\r
+     */\r
+    public static boolean unregister(Object registryKey) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Return an array of the locales for which a currency\r
+     * is defined.\r
+     * @return an array of the available locales\r
+     * @stable ICU 2.2\r
+     */\r
+    public static Locale[] getAvailableLocales() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Return an array of the ulocales for which a currency\r
+     * is defined.\r
+     * @return an array of the available ulocales\r
+     * @stable ICU 3.2\r
+     */\r
+    public static ULocale[] getAvailableULocales() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Given a key and a locale, returns an array of values for the key for which data\r
+     * exists.  If commonlyUsed is true, these are the values that typically are used\r
+     * with this locale, otherwise these are all values for which data exists.  \r
+     * This is a common service API.\r
+     * <p>\r
+     * The only supported key is "currency", other values return an empty array.\r
+     * <p>\r
+     * Currency information is based on the region of the locale.  If the locale does not\r
+     * indicate a region, {@link ULocale#addLikelySubtags(ULocale)} is used to infer a region,\r
+     * except for the 'und' locale.\r
+     * <p>\r
+     * If commonlyUsed is true, only the currencies known to be in use as of the current date\r
+     * are returned.  When there are more than one, these are returned in preference order\r
+     * (typically, this occurs when a country is transitioning to a new currency, and the\r
+     * newer currency is preferred), see \r
+     * <a href="http://unicode.org/reports/tr35/#Supplemental_Currency_Data">Unicode TR#35 Sec. C1</a>.  \r
+     * If commonlyUsed is false, all currencies ever used in any locale are returned, in no\r
+     * particular order.\r
+     * \r
+     * @param key           key whose values to look up.  the only recognized key is "currency"\r
+     * @param locale        the locale\r
+     * @param commonlyUsed  if true, return only values that are currently used in the locale.\r
+     *                      Otherwise returns all values.\r
+     * @return an array of values for the given key and the locale.  If there is no data, the\r
+     *   array will be empty.\r
+     * @stable ICU 4.2\r
+     */\r
+    public static final String[] getKeywordValuesForLocale(String key, ULocale locale, \r
+            boolean commonlyUsed) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Return a hashcode for this currency.\r
+     * @stable ICU 2.2\r
+     */\r
+    public int hashCode() {\r
+        return currency.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Return true if rhs is a Currency instance,\r
+     * is non-null, and has the same currency code.\r
+     * @stable ICU 2.2\r
+     */\r
+    public boolean equals(Object rhs) {\r
+        try {\r
+            return currency.equals(((Currency)rhs).currency);\r
+        }\r
+        catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Returns the ISO 4217 3-letter code for this currency object.\r
+     * @stable ICU 2.2\r
+     */\r
+    public String getCurrencyCode() {\r
+        return currency.getCurrencyCode();\r
+    }\r
+\r
+    /**\r
+     * Convenience and compatibility override of getName that\r
+     * requests the symbol name.\r
+     * @see #getName\r
+     * @stable ICU 3.4\r
+     */\r
+    public String getSymbol() {\r
+        return currency.getSymbol();\r
+    }\r
+\r
+    /**\r
+     * Convenience and compatibility override of getName that\r
+     * requests the symbol name.\r
+     * @param loc the Locale for the symbol\r
+     * @see #getName\r
+     * @stable ICU 3.4\r
+     */\r
+    public String getSymbol(Locale loc) {\r
+        return currency.getSymbol(loc);\r
+    }\r
+\r
+    /**\r
+     * Convenience and compatibility override of getName that\r
+     * requests the symbol name.\r
+     * @param uloc the ULocale for the symbol\r
+     * @see #getName\r
+     * @stable ICU 3.4\r
+     */\r
+    public String getSymbol(ULocale uloc) {\r
+        return currency.getSymbol(uloc.toLocale());\r
+    }\r
+\r
+    /**\r
+     * Returns the display name for the given currency in the\r
+     * given locale.  \r
+     * This is a convenient method for \r
+     * getName(ULocale, int, boolean[]); \r
+     * @stable ICU 3.2\r
+     */\r
+    public String getName(Locale locale,\r
+                          int nameStyle,\r
+                          boolean[] isChoiceFormat) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the display name for the given currency in the\r
+     * given locale.  For example, the display name for the USD\r
+     * currency object in the en_US locale is "$".\r
+     * @param locale locale in which to display currency\r
+     * @param nameStyle selector for which kind of name to return.\r
+     *                  The nameStyle should be either SYMBOL_NAME or \r
+     *                  LONG_NAME. Otherwise, throw IllegalArgumentException.\r
+     * @param isChoiceFormat fill-in; isChoiceFormat[0] is set to true\r
+     * if the returned value is a ChoiceFormat pattern; otherwise it\r
+     * is set to false\r
+     * @return display string for this currency.  If the resource data\r
+     * contains no entry for this currency, then the ISO 4217 code is\r
+     * returned.  If isChoiceFormat[0] is true, then the result is a\r
+     * ChoiceFormat pattern.  Otherwise it is a static string. <b>Note:</b>\r
+     * as of ICU 4.4, choice formats are not used, and the value returned\r
+     * in isChoiceFormat is always false.\r
+     * <p>\r
+     * @throws  IllegalArgumentException  if the nameStyle is not SYMBOL_NAME\r
+     *                                    or LONG_NAME.\r
+     * @see #getName(ULocale, int, String, boolean[])\r
+     * @stable ICU 3.2\r
+     */\r
+    public String getName(ULocale locale, int nameStyle, boolean[] isChoiceFormat) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the display name for the given currency in the given locale.  \r
+     * This is a convenience overload of getName(ULocale, int, String, boolean[]);\r
+     * @stable ICU 4.2\r
+     */\r
+    public String getName(Locale locale, int nameStyle, String pluralCount,\r
+            boolean[] isChoiceFormat) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the display name for the given currency in the\r
+     * given locale.  For example, the SYMBOL_NAME for the USD\r
+     * currency object in the en_US locale is "$".\r
+     * The PLURAL_LONG_NAME for the USD currency object when the currency \r
+     * amount is plural is "US dollars", such as in "3.00 US dollars";\r
+     * while the PLURAL_LONG_NAME for the USD currency object when the currency\r
+     * amount is singular is "US dollar", such as in "1.00 US dollar".\r
+     * @param locale locale in which to display currency\r
+     * @param nameStyle selector for which kind of name to return\r
+     * @param pluralCount plural count string for this locale\r
+     * @param isChoiceFormat fill-in; isChoiceFormat[0] is set to true\r
+     * if the returned value is a ChoiceFormat pattern; otherwise it\r
+     * is set to false\r
+     * @return display string for this currency.  If the resource data\r
+     * contains no entry for this currency, then the ISO 4217 code is\r
+     * returned.  If isChoiceFormat[0] is true, then the result is a\r
+     * ChoiceFormat pattern.  Otherwise it is a static string. <b>Note:</b>\r
+     * as of ICU 4.4, choice formats are not used, and the value returned\r
+     * in isChoiceFormat is always false.\r
+     * @throws  IllegalArgumentException  if the nameStyle is not SYMBOL_NAME,\r
+     *                                    LONG_NAME, or PLURAL_LONG_NAME.\r
+     * @stable ICU 4.2\r
+     */\r
+    public String getName(ULocale locale, int nameStyle, String pluralCount,\r
+            boolean[] isChoiceFormat) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Attempt to parse the given string as a currency, either as a\r
+     * display name in the given locale, or as a 3-letter ISO 4217\r
+     * code.  If multiple display names match, then the longest one is\r
+     * selected.  If both a display name and a 3-letter ISO code\r
+     * match, then the display name is preferred, unless it's length\r
+     * is less than 3.\r
+     *\r
+     * @param locale the locale of the display names to match\r
+     * @param text the text to parse\r
+     * @param type parse against currency type: LONG_NAME only or not\r
+     * @param pos input-output position; on input, the position within\r
+     * text to match; must have 0 <= pos.getIndex() < text.length();\r
+     * on output, the position after the last matched character. If\r
+     * the parse fails, the position in unchanged upon output.\r
+     * @return the ISO 4217 code, as a string, of the best match, or\r
+     * null if there is no match\r
+     *\r
+     * @internal\r
+     * @deprecated This API is ICU internal only.\r
+     */\r
+    public static String parse(ULocale locale, String text, int type, ParsePosition pos) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the number of the number of fraction digits that should\r
+     * be displayed for this currency.\r
+     * @return a non-negative number of fraction digits to be\r
+     * displayed\r
+     * @stable ICU 2.2\r
+     */\r
+    public int getDefaultFractionDigits() {\r
+        return currency.getDefaultFractionDigits();\r
+    }\r
+\r
+    /**\r
+     * Returns the rounding increment for this currency, or 0.0 if no\r
+     * rounding is done by this currency.\r
+     * @return the non-negative rounding increment, or 0.0 if none\r
+     * @stable ICU 2.2\r
+     */\r
+    public double getRoundingIncrement() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns the ISO 4217 code for this currency.\r
+     * @stable ICU 2.2\r
+     */\r
+    public String toString() {\r
+        return currency.toString();\r
+    }\r
+\r
+    /**\r
+     * Return the locale that was used to create this object, or null.\r
+     * This may may differ from the locale requested at the time of\r
+     * this object's creation.  For example, if an object is created\r
+     * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be\r
+     * drawn from <tt>en</tt> (the <i>actual</i> locale), and\r
+     * <tt>en_US</tt> may be the most specific locale that exists (the\r
+     * <i>valid</i> locale).\r
+     *\r
+     * <p>Note: This method will be obsoleted.  The implementation is\r
+     * no longer locale-specific and so there is no longer a valid or\r
+     * actual locale associated with the Currency object.  Until\r
+     * it is removed, this method will return the root locale.\r
+     * @param type type of information requested, either {@link\r
+     * com.ibm.icu.util.ULocale#VALID_LOCALE} or {@link\r
+     * com.ibm.icu.util.ULocale#ACTUAL_LOCALE}.\r
+     * @return the information specified by <i>type</i>, or null if\r
+     * this object was not constructed from locale data.\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     * @obsolete ICU 3.2 to be removed\r
+     * @deprecated This API is obsolete.\r
+     */\r
+    public final ULocale getLocale(ULocale.Type type) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+}\r
+\r
+//eof\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/CurrencyAmount.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/CurrencyAmount.java
new file mode 100644 (file)
index 0000000..22b3239
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2011, International Business Machines Corporation and         *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.util;\r
+\r
+/*\r
+ * Empty stub\r
+ */\r
+public class CurrencyAmount {\r
+    private CurrencyAmount() {}\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/TimeZone.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/TimeZone.java
new file mode 100644 (file)
index 0000000..f775d29
--- /dev/null
@@ -0,0 +1,710 @@
+/*\r
+ * @(#)TimeZone.java    1.51 00/01/19\r
+ *\r
+ * Copyright (C) 1996-2011, International Business Machines\r
+ * Corporation and others.  All Rights Reserved.\r
+ */\r
+\r
+package com.ibm.icu.util;\r
+\r
+import java.io.Serializable;\r
+import java.util.Date;\r
+import java.util.Locale;\r
+import java.util.MissingResourceException;\r
+\r
+/**\r
+ * {@icuenhanced java.util.TimeZone}.{@icu _usage_}\r
+ *\r
+ * <p><code>TimeZone</code> represents a time zone offset, and also computes daylight\r
+ * savings.\r
+ *\r
+ * <p>Typically, you get a <code>TimeZone</code> using {@link #getDefault()}\r
+ * which creates a <code>TimeZone</code> based on the time zone where the program\r
+ * is running. For example, for a program running in Japan, <code>getDefault</code>\r
+ * creates a <code>TimeZone</code> object based on Japanese Standard Time.\r
+ *\r
+ * <p>You can also get a <code>TimeZone</code> using {@link #getTimeZone(String)}\r
+ * along with a time zone ID. For instance, the time zone ID for the\r
+ * U.S. Pacific Time zone is "America/Los_Angeles". So, you can get a\r
+ * U.S. Pacific Time <code>TimeZone</code> object with:\r
+ *\r
+ * <blockquote>\r
+ * <pre>\r
+ * TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");\r
+ * </pre>\r
+ * </blockquote>\r
+ * You can use the {@link #getAvailableIDs()} method to iterate through\r
+ * all the supported time zone IDs. You can then choose a\r
+ * supported ID to get a <code>TimeZone</code>.\r
+ * If the time zone you want is not represented by one of the\r
+ * supported IDs, then you can create a custom time zone ID with\r
+ * the following syntax:\r
+ *\r
+ * <blockquote>\r
+ * <pre>\r
+ * GMT[+|-]hh[[:]mm]\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * For example, you might specify GMT+14:00 as a custom\r
+ * time zone ID.  The <code>TimeZone</code> that is returned\r
+ * when you specify a custom time zone ID does not include\r
+ * daylight savings time.\r
+ *\r
+ * <p>For compatibility with JDK 1.1.x, some other three-letter time zone IDs\r
+ * (such as "PST", "CTT", "AST") are also supported. However, <strong>their\r
+ * use is deprecated</strong> because the same abbreviation is often used\r
+ * for multiple time zones (for example, "CST" could be U.S. "Central Standard\r
+ * Time" and "China Standard Time"), and the Java platform can then only\r
+ * recognize one of them.\r
+ *\r
+ * <p><strong>Note:</strong> Starting from ICU4J 4.0, you can optionally choose\r
+ * JDK <code>TimeZone</code> as the time zone implementation.  The TimeZone factory\r
+ * method <code>getTimeZone</code> creates an instance of ICU's own <code>TimeZone</code>\r
+ * subclass by default.  If you want to use the JDK implementation always, you can\r
+ * set the default time zone implementation type by the new method\r
+ * <code>setDefaultTimeZoneType</code>.  Alternatively, you can change the initial\r
+ * default implementation type by setting a property below.\r
+ *\r
+ * <blockquote>\r
+ * <pre>\r
+ * #\r
+ * # The default TimeZone implementation type used by the ICU TimeZone\r
+ * # factory method. [ ICU | JDK ]\r
+ * #\r
+ * com.ibm.icu.util.TimeZone.DefaultTimeZoneType = ICU\r
+ * </pre>\r
+ * </blockquote>\r
+ *\r
+ * <p>This property is included in ICUConfig.properties in com.ibm.icu package.  When the\r
+ * <code>TimeZone</code> class is loaded, the initialization code checks if the property\r
+ * <code>com.ibm.icu.util.TimeZone.DefaultTimeZoneType=xxx</code> is defined by the system\r
+ * properties.  If not available, then it loads ICUConfig.properties to get the default\r
+ * time zone implementation type.  The property setting is only used for the initial\r
+ * default value and you can change the default type by calling\r
+ * <code>setDefaultTimeZoneType</code> at runtime.\r
+ *\r
+ * @see          Calendar\r
+ * @see          GregorianCalendar\r
+ * @see          SimpleTimeZone\r
+ * @author       Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu\r
+ * @stable ICU 2.0\r
+ */\r
+public class TimeZone implements Serializable, Cloneable {\r
+    private static final long serialVersionUID = 1L;\r
+    \r
+    /**\r
+     * @internal\r
+     */\r
+    public final java.util.TimeZone timeZone;\r
+        \r
+    /**\r
+     * @internal\r
+     * @param delegate the TimeZone to which to delegate\r
+     */\r
+    public TimeZone(java.util.TimeZone delegate) {\r
+        this.timeZone = delegate;\r
+    }\r
+\r
+//    /**\r
+//     * {@icu} A logger for TimeZone. Will be null if logging is not on by way of system\r
+//     * property: "icu4j.debug.logging"\r
+//     * @draft ICU 4.4\r
+//     * @provisional This API might change or be removed in a future release.\r
+//     */\r
+//    public static ICULogger TimeZoneLogger = ICULogger.getICULogger(TimeZone.class.getName());\r
+\r
+    /**\r
+     * Default constructor.  (For invocation by subclass constructors,\r
+     * typically implicit.)\r
+     * @stable ICU 2.8\r
+     */\r
+    public TimeZone() {\r
+        this.timeZone = java.util.TimeZone.getDefault();\r
+    }\r
+\r
+    /**\r
+     * {@icu} A time zone implementation type indicating ICU's own TimeZone used by\r
+     * <code>getTimeZone</code>, <code>setDefaultTimeZoneType</code>\r
+     * and <code>getDefaultTimeZoneType</code>.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final int TIMEZONE_ICU = 0;\r
+    /**\r
+     * {@icu} A time zone implementation type indicating JDK TimeZone used by\r
+     * <code>getTimeZone</code>, <code>setDefaultTimeZoneType</code>\r
+     * and <code>getDefaultTimeZoneType</code>.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static final int TIMEZONE_JDK = 1;\r
+\r
+    /**\r
+     * A style specifier for <code>getDisplayName()</code> indicating\r
+     * a short name, such as "PST."\r
+     * @see #LONG\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int SHORT = 0;\r
+\r
+    /**\r
+     * A style specifier for <code>getDisplayName()</code> indicating\r
+     * a long name, such as "Pacific Standard Time."\r
+     * @see #SHORT\r
+     * @stable ICU 2.0\r
+     */\r
+    public static final int LONG  = 1;\r
+\r
+    /**\r
+     * {@icu} A style specifier for <code>getDisplayName()</code> indicating\r
+     * a short generic name, such as "PT."\r
+     * @see #LONG_GENERIC\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final int SHORT_GENERIC = 2;\r
+\r
+    /**\r
+     * {@icu} A style specifier for <code>getDisplayName()</code> indicating\r
+     * a long generic name, such as "Pacific Time."\r
+     * @see #SHORT_GENERIC\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final int LONG_GENERIC = 3;\r
+\r
+    /**\r
+     * {@icu} A style specifier for <code>getDisplayName()</code> indicating\r
+     * a short name derived from the timezone's offset, such as "-0800."\r
+     * @see #LONG_GMT\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final int SHORT_GMT = 4;\r
+\r
+    /**\r
+     * {@icu} A style specifier for <code>getDisplayName()</code> indicating\r
+     * a long name derived from the timezone's offset, such as "GMT-08:00."\r
+     * @see #SHORT_GMT\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final int LONG_GMT = 5;\r
+\r
+    /**\r
+     * {@icu} A style specifier for <code>getDisplayName()</code> indicating\r
+     * a short name derived from the timezone's short standard or daylight\r
+     * timezone name ignoring commonlyUsed, such as "PDT."\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+\r
+    public static final int SHORT_COMMONLY_USED = 6;\r
+\r
+    /**\r
+     * {@icu} A style specifier for <code>getDisplayName()</code> indicating\r
+     * a long name derived from the timezone's fallback name, such as\r
+     * "United States (Los Angeles)."\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final int GENERIC_LOCATION = 7;\r
+\r
+    /**\r
+     * Gets the time zone offset, for current date, modified in case of\r
+     * daylight savings. This is the offset to add *to* UTC to get local time.\r
+     * @param era the era of the given date.\r
+     * @param year the year in the given date.\r
+     * @param month the month in the given date.\r
+     * Month is 0-based. e.g., 0 for January.\r
+     * @param day the day-in-month of the given date.\r
+     * @param dayOfWeek the day-of-week of the given date.\r
+     * @param milliseconds the millis in day in <em>standard</em> local time.\r
+     * @return the offset to add *to* GMT to get local time.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getOffset(int era, int year, int month, int day,\r
+                                  int dayOfWeek, int milliseconds) {\r
+        return timeZone.getOffset(era, year, month, day, dayOfWeek, milliseconds);\r
+    }\r
+\r
+\r
+    /**\r
+     * Returns the offset of this time zone from UTC at the specified\r
+     * date. If Daylight Saving Time is in effect at the specified\r
+     * date, the offset value is adjusted with the amount of daylight\r
+     * saving.\r
+     *\r
+     * @param date the date represented in milliseconds since January 1, 1970 00:00:00 GMT\r
+     * @return the amount of time in milliseconds to add to UTC to get local time.\r
+     *\r
+     * @see Calendar#ZONE_OFFSET\r
+     * @see Calendar#DST_OFFSET\r
+     * @see #getOffset(long, boolean, int[])\r
+     * @stable ICU 2.8\r
+     */\r
+    public int getOffset(long date) {\r
+        return timeZone.getOffset(date);\r
+    }\r
+\r
+    /**\r
+     * Returns the time zone raw and GMT offset for the given moment\r
+     * in time.  Upon return, local-millis = GMT-millis + rawOffset +\r
+     * dstOffset.  All computations are performed in the proleptic\r
+     * Gregorian calendar.  The default implementation in the TimeZone\r
+     * class delegates to the 8-argument getOffset().\r
+     *\r
+     * @param date moment in time for which to return offsets, in\r
+     * units of milliseconds from January 1, 1970 0:00 GMT, either GMT\r
+     * time or local wall time, depending on `local'.\r
+     * @param local if true, `date' is local wall time; otherwise it\r
+     * is in GMT time.\r
+     * @param offsets output parameter to receive the raw offset, that\r
+     * is, the offset not including DST adjustments, in offsets[0],\r
+     * and the DST offset, that is, the offset to be added to\r
+     * `rawOffset' to obtain the total offset between local and GMT\r
+     * time, in offsets[1]. If DST is not in effect, the DST offset is\r
+     * zero; otherwise it is a positive value, typically one hour.\r
+     *\r
+     * @stable ICU 2.8\r
+     */\r
+    public void getOffset(long date, boolean local, int[] offsets) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Sets the base time zone offset to GMT.\r
+     * This is the offset to add *to* UTC to get local time.\r
+     * @param offsetMillis the given base time zone offset to GMT.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setRawOffset(int offsetMillis) {\r
+        timeZone.setRawOffset(offsetMillis);\r
+    }\r
+\r
+    /**\r
+     * Gets unmodified offset, NOT modified in case of daylight savings.\r
+     * This is the offset to add *to* UTC to get local time.\r
+     * @return the unmodified offset to add *to* UTC to get local time.\r
+     * @stable ICU 2.0\r
+     */\r
+    public int getRawOffset() {\r
+        return timeZone.getRawOffset();\r
+    }\r
+\r
+    /**\r
+     * Gets the ID of this time zone.\r
+     * @return the ID of this time zone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getID() {\r
+        return timeZone.getID();\r
+    }\r
+\r
+    /**\r
+     * Sets the time zone ID. This does not change any other data in\r
+     * the time zone object.\r
+     * @param ID the new time zone ID.\r
+     * @stable ICU 2.0\r
+     */\r
+    public void setID(String ID) {\r
+        timeZone.setID(ID);\r
+    }\r
+\r
+    /**\r
+     * Returns a name of this time zone suitable for presentation to the user\r
+     * in the default locale.\r
+     * This method returns the long generic name.\r
+     * If the display name is not available for the locale,\r
+     * a fallback based on the country, city, or time zone id will be used.\r
+     * @return the human-readable name of this time zone in the default locale.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String getDisplayName() {\r
+        return timeZone.getDisplayName();\r
+    }\r
+\r
+    /**\r
+     * Returns a name of this time zone suitable for presentation to the user\r
+     * in the specified locale.\r
+     * This method returns the long generic name.\r
+     * If the display name is not available for the locale,\r
+     * a fallback based on the country, city, or time zone id will be used.\r
+     * @param locale the locale in which to supply the display name.\r
+     * @return the human-readable name of this time zone in the given locale\r
+     * or in the default locale if the given locale is not recognized.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String getDisplayName(Locale locale) {\r
+        return timeZone.getDisplayName(locale);\r
+    }\r
+\r
+    /**\r
+     * Returns a name of this time zone suitable for presentation to the user\r
+     * in the specified locale.\r
+     * This method returns the long name, not including daylight savings.\r
+     * If the display name is not available for the locale,\r
+     * a fallback based on the country, city, or time zone id will be used.\r
+     * @param locale the ulocale in which to supply the display name.\r
+     * @return the human-readable name of this time zone in the given locale\r
+     * or in the default ulocale if the given ulocale is not recognized.\r
+     * @stable ICU 3.2\r
+     */\r
+    public final String getDisplayName(ULocale locale) {\r
+        return timeZone.getDisplayName(locale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * Returns a name of this time zone suitable for presentation to the user\r
+     * in the default locale.\r
+     * If the display name is not available for the locale,\r
+     * then this method returns a string in the format\r
+     * <code>GMT[+-]hh:mm</code>.\r
+     * @param daylight if true, return the daylight savings name.\r
+     * @param style the output style of the display name.  Valid styles are\r
+     * <code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>,\r
+     * <code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>,\r
+     * <code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>.\r
+     * @return the human-readable name of this time zone in the default locale.\r
+     * @stable ICU 2.0\r
+     */\r
+    public final String getDisplayName(boolean daylight, int style) {\r
+        return getDisplayName(daylight, style, ULocale.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns a name of this time zone suitable for presentation to the user\r
+     * in the specified locale.\r
+     * If the display name is not available for the locale,\r
+     * then this method returns a string in the format\r
+     * <code>GMT[+-]hh:mm</code>.\r
+     * @param daylight if true, return the daylight savings name.\r
+     * @param style the output style of the display name.  Valid styles are\r
+     * <code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>,\r
+     * <code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>,\r
+     * <code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>.\r
+     * @param locale the locale in which to supply the display name.\r
+     * @return the human-readable name of this time zone in the given locale\r
+     * or in the default locale if the given locale is not recognized.\r
+     * @exception IllegalArgumentException style is invalid.\r
+     * @stable ICU 2.0\r
+     */\r
+    public String getDisplayName(boolean daylight, int style, Locale locale) {\r
+        return getDisplayName(daylight, style, ULocale.forLocale(locale));\r
+    }\r
+\r
+    /**\r
+     * Returns a name of this time zone suitable for presentation to the user\r
+     * in the specified locale.\r
+     * If the display name is not available for the locale,\r
+     * then this method returns a string in the format\r
+     * <code>GMT[+-]hh:mm</code>.\r
+     * @param daylight if true, return the daylight savings name.\r
+     * @param style the output style of the display name.  Valid styles are\r
+     * <code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>,\r
+     * <code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>,\r
+     * <code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>.\r
+     * @param locale the locale in which to supply the display name.\r
+     * @return the human-readable name of this time zone in the given locale\r
+     * or in the default locale if the given locale is not recognized.\r
+     * @exception IllegalArgumentException style is invalid.\r
+     * @stable ICU 3.2\r
+     */\r
+    public String getDisplayName(boolean daylight, int style, ULocale locale) {\r
+        if (style == SHORT) {\r
+            return timeZone.getDisplayName(daylight, java.util.TimeZone.SHORT, locale.toLocale());\r
+        } else if (style == LONG) {\r
+            return timeZone.getDisplayName(daylight, java.util.TimeZone.LONG, locale.toLocale());\r
+        } else {\r
+            throw new UnsupportedOperationException("Specified time zone format style is not supported by com.ibm.icu.base");\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Returns the amount of time to be added to local standard time\r
+     * to get local wall clock time.\r
+     * <p>\r
+     * The default implementation always returns 3600000 milliseconds\r
+     * (i.e., one hour) if this time zone observes Daylight Saving\r
+     * Time. Otherwise, 0 (zero) is returned.\r
+     * <p>\r
+     * If an underlying TimeZone implementation subclass supports\r
+     * historical Daylight Saving Time changes, this method returns\r
+     * the known latest daylight saving value.\r
+     *\r
+     * @return the amount of saving time in milliseconds\r
+     * @stable ICU 2.8\r
+     */\r
+    public int getDSTSavings() {\r
+        return timeZone.getDSTSavings();\r
+    }\r
+\r
+    /**\r
+     * Queries if this time zone uses daylight savings time.\r
+     * @return true if this time zone uses daylight savings time,\r
+     * false, otherwise.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean useDaylightTime() {\r
+        return timeZone.useDaylightTime();\r
+    }\r
+\r
+    /**\r
+     * Queries if the given date is in daylight savings time in\r
+     * this time zone.\r
+     * @param date the given Date.\r
+     * @return true if the given date is in daylight savings time,\r
+     * false, otherwise.\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean inDaylightTime(Date date) {\r
+        return timeZone.inDaylightTime(date);\r
+    }\r
+\r
+    /**\r
+     * Gets the <code>TimeZone</code> for the given ID.\r
+     *\r
+     * @param ID the ID for a <code>TimeZone</code>, such as "America/Los_Angeles",\r
+     * or a custom ID such as "GMT-8:00". Note that the support of abbreviations,\r
+     * such as "PST", is for JDK 1.1.x compatibility only and full names should be used.\r
+     *\r
+     * @return the specified <code>TimeZone</code>, or the GMT zone if the given ID\r
+     * cannot be understood.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static synchronized TimeZone getTimeZone(String ID) {\r
+        return new TimeZone(java.util.TimeZone.getTimeZone(ID));\r
+    }\r
+\r
+    /**\r
+     * Gets the <code>TimeZone</code> for the given ID and the timezone type.\r
+     * @param ID the ID for a <code>TimeZone</code>, such as "America/Los_Angeles", or a\r
+     * custom ID such as "GMT-8:00". Note that the support of abbreviations, such as\r
+     * "PST", is for JDK 1.1.x compatibility only and full names should be used.\r
+     * @param type Time zone type, either <code>TIMEZONE_ICU</code> or\r
+     * <code>TIMEZONE_JDK</code>.\r
+     * @return the specified <code>TimeZone</code>, or the GMT zone if the given ID\r
+     * cannot be understood.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static synchronized TimeZone getTimeZone(String ID, int type) {\r
+        if (type == TIMEZONE_JDK) {\r
+            return new TimeZone(java.util.TimeZone.getTimeZone(ID));\r
+        }\r
+        throw new UnsupportedOperationException("TIMEZONE_ICU not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Sets the default time zone type used by <code>getTimeZone</code>.\r
+     * @param type time zone type, either <code>TIMEZONE_ICU</code> or\r
+     * <code>TIMEZONE_JDK</code>.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static synchronized void setDefaultTimeZoneType(int type) {\r
+        if (type != TIMEZONE_JDK) {\r
+            throw new UnsupportedOperationException("TimeZone type other than TIMEZONE_JDK is not supported by com.ibm.icu.base");\r
+        }\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the default time zone type currently used.\r
+     * @return The default time zone type, either <code>TIMEZONE_ICU</code> or\r
+     * <code>TIMEZONE_JDK</code>.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static int getDefaultTimeZoneType() {\r
+        return TIMEZONE_JDK;\r
+    }\r
+\r
+    /**\r
+     * Return a new String array containing all system TimeZone IDs\r
+     * with the given raw offset from GMT.  These IDs may be passed to\r
+     * <code>get()</code> to construct the corresponding TimeZone\r
+     * object.\r
+     * @param rawOffset the offset in milliseconds from GMT\r
+     * @return an array of IDs for system TimeZones with the given\r
+     * raw offset.  If there are none, return a zero-length array.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static String[] getAvailableIDs(int rawOffset) {\r
+        return java.util.TimeZone.getAvailableIDs(rawOffset);\r
+\r
+    }\r
+\r
+\r
+    /**\r
+     * Return a new String array containing all system TimeZone IDs\r
+     * associated with the given country.  These IDs may be passed to\r
+     * <code>get()</code> to construct the corresponding TimeZone\r
+     * object.\r
+     * @param country a two-letter ISO 3166 country code, or <code>null</code>\r
+     * to return zones not associated with any country\r
+     * @return an array of IDs for system TimeZones in the given\r
+     * country.  If there are none, return a zero-length array.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static String[] getAvailableIDs(String country) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Return a new String array containing all system TimeZone IDs.\r
+     * These IDs (and only these IDs) may be passed to\r
+     * <code>get()</code> to construct the corresponding TimeZone\r
+     * object.\r
+     * @return an array of all system TimeZone IDs\r
+     * @stable ICU 2.0\r
+     */\r
+    public static String[] getAvailableIDs() {\r
+        return java.util.TimeZone.getAvailableIDs();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the number of IDs in the equivalency group that\r
+     * includes the given ID.  An equivalency group contains zones\r
+     * that have the same GMT offset and rules.\r
+     *\r
+     * <p>The returned count includes the given ID; it is always >= 1\r
+     * for valid IDs.  The given ID must be a system time zone.  If it\r
+     * is not, returns zero.\r
+     * @param id a system time zone ID\r
+     * @return the number of zones in the equivalency group containing\r
+     * 'id', or zero if 'id' is not a valid system ID\r
+     * @see #getEquivalentID\r
+     * @stable ICU 2.0\r
+     */\r
+    public static int countEquivalentIDs(String id) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Returns an ID in the equivalency group that\r
+     * includes the given ID.  An equivalency group contains zones\r
+     * that have the same GMT offset and rules.\r
+     *\r
+     * <p>The given index must be in the range 0..n-1, where n is the\r
+     * value returned by <code>countEquivalentIDs(id)</code>.  For\r
+     * some value of 'index', the returned value will be equal to the\r
+     * given id.  If the given id is not a valid system time zone, or\r
+     * if 'index' is out of range, then returns an empty string.\r
+     * @param id a system time zone ID\r
+     * @param index a value from 0 to n-1, where n is the value\r
+     * returned by <code>countEquivalentIDs(id)</code>\r
+     * @return the ID of the index-th zone in the equivalency group\r
+     * containing 'id', or an empty string if 'id' is not a valid\r
+     * system ID or 'index' is out of range\r
+     * @see #countEquivalentIDs\r
+     * @stable ICU 2.0\r
+     */\r
+    public static String getEquivalentID(String id, int index) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * Gets the default <code>TimeZone</code> for this host.\r
+     * The source of the default <code>TimeZone</code>\r
+     * may vary with implementation.\r
+     * @return a default <code>TimeZone</code>.\r
+     * @stable ICU 2.0\r
+     */\r
+    public static TimeZone getDefault() {\r
+        return new TimeZone(java.util.TimeZone.getDefault());\r
+    }\r
+\r
+    /**\r
+     * Sets the <code>TimeZone</code> that is\r
+     * returned by the <code>getDefault</code> method.  If <code>zone</code>\r
+     * is null, reset the default to the value it had originally when the\r
+     * VM first started.\r
+     * @param tz the new default time zone\r
+     * @stable ICU 2.0\r
+     */\r
+    public static void setDefault(TimeZone tz) {\r
+        java.util.TimeZone.setDefault(tz.timeZone);\r
+    }\r
+\r
+    /**\r
+     * Returns true if this zone has the same rule and offset as another zone.\r
+     * That is, if this zone differs only in ID, if at all.  Returns false\r
+     * if the other zone is null.\r
+     * @param other the <code>TimeZone</code> object to be compared with\r
+     * @return true if the other zone is not null and is the same as this one,\r
+     * with the possible exception of the ID\r
+     * @stable ICU 2.0\r
+     */\r
+    public boolean hasSameRules(TimeZone other) {\r
+        return timeZone.hasSameRules(other.timeZone);\r
+    }\r
+\r
+    /**\r
+     * Overrides clone.\r
+     * @stable ICU 2.0\r
+     */\r
+    public Object clone() {\r
+        return new TimeZone((java.util.TimeZone)timeZone.clone());\r
+    }\r
+\r
+    /**\r
+     * Overrides equals.\r
+     * @stable ICU 3.6\r
+     */\r
+    public boolean equals(Object obj){\r
+        try {\r
+            return timeZone.equals(((TimeZone)obj).timeZone);\r
+        } catch (Exception e) {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * Overrides hashCode.\r
+     * @stable ICU 3.6\r
+     */\r
+    public int hashCode(){\r
+        return timeZone.hashCode();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the time zone data version currently used by ICU.\r
+     *\r
+     * @return the version string, such as "2007f"\r
+     * @throws MissingResourceException if ICU time zone resource bundle\r
+     * is missing or the version information is not available.\r
+     *\r
+     * @stable ICU 3.8\r
+     */\r
+    public static synchronized String getTZDataVersion() {\r
+        throw new UnsupportedOperationException("Method not supproted by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the canonical system time zone ID or the normalized\r
+     * custom time zone ID for the given time zone ID.\r
+     * @param id The input time zone ID to be canonicalized.\r
+     * @return The canonical system time zone ID or the custom time zone ID\r
+     * in normalized format for the given time zone ID.  When the given time zone ID\r
+     * is neither a known system time zone ID nor a valid custom time zone ID,\r
+     * null is returned.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static String getCanonicalID(String id) {\r
+        throw new UnsupportedOperationException("Method not supproted by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the canonical system time zone ID or the normalized\r
+     * custom time zone ID for the given time zone ID.\r
+     * @param id The input time zone ID to be canonicalized.\r
+     * @param isSystemID When non-null boolean array is specified and\r
+     * the given ID is a known system time zone ID, true is set to <code>isSystemID[0]</code>\r
+     * @return The canonical system time zone ID or the custom time zone ID\r
+     * in normalized format for the given time zone ID.  When the given time zone ID\r
+     * is neither a known system time zone ID nor a valid custom time zone ID,\r
+     * null is returned.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static String getCanonicalID(String id, boolean[] isSystemID) {\r
+        throw new UnsupportedOperationException("Method not supproted by com.ibm.icu.base");\r
+    }\r
+}\r
+\r
+//eof\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/ULocale.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/ULocale.java
new file mode 100644 (file)
index 0000000..7ffd322
--- /dev/null
@@ -0,0 +1,2493 @@
+/*\r
+******************************************************************************\r
+* Copyright (C) 2003-2011, International Business Machines Corporation and   *\r
+* others. All Rights Reserved.                                               *\r
+******************************************************************************\r
+*/\r
+\r
+package com.ibm.icu.util;\r
+\r
+import java.io.Serializable;\r
+import java.text.ParseException;\r
+import java.util.Iterator;\r
+import java.util.Locale;\r
+import java.util.MissingResourceException;\r
+import java.util.Set;\r
+import java.util.TreeMap;\r
+\r
+import com.ibm.icu.impl.ICUCache;\r
+import com.ibm.icu.impl.LocaleIDParser;\r
+import com.ibm.icu.impl.LocaleIDs;\r
+import com.ibm.icu.impl.LocaleUtility;\r
+import com.ibm.icu.impl.SimpleCache;\r
+import com.ibm.icu.impl.locale.AsciiUtil;\r
+\r
+/**\r
+ * {@icuenhanced java.util.Locale}.{@icu _usage_}\r
+ *\r
+ * A class analogous to {@link java.util.Locale} that provides additional\r
+ * support for ICU protocol.  In ICU 3.0 this class is enhanced to support\r
+ * RFC 3066 language identifiers.\r
+ *\r
+ * <p>Many classes and services in ICU follow a factory idiom, in\r
+ * which a factory method or object responds to a client request with\r
+ * an object.  The request includes a locale (the <i>requested</i>\r
+ * locale), and the returned object is constructed using data for that\r
+ * locale.  The system may lack data for the requested locale, in\r
+ * which case the locale fallback mechanism will be invoked until a\r
+ * populated locale is found (the <i>valid</i> locale).  Furthermore,\r
+ * even when a populated locale is found (the <i>valid</i> locale),\r
+ * further fallback may be required to reach a locale containing the\r
+ * specific data required by the service (the <i>actual</i> locale).\r
+ *\r
+ * <p>ULocale performs <b>'normalization'</b> and <b>'canonicalization'</b> of locale ids.\r
+ * Normalization 'cleans up' ICU locale ids as follows:\r
+ * <ul>\r
+ * <li>language, script, country, variant, and keywords are properly cased<br>\r
+ * (lower, title, upper, upper, and lower case respectively)</li>\r
+ * <li>hyphens used as separators are converted to underscores</li>\r
+ * <li>three-letter language and country ids are converted to two-letter\r
+ * equivalents where available</li>\r
+ * <li>surrounding spaces are removed from keywords and values</li>\r
+ * <li>if there are multiple keywords, they are put in sorted order</li>\r
+ * </ul>\r
+ * Canonicalization additionally performs the following:\r
+ * <ul>\r
+ * <li>POSIX ids are converted to ICU format IDs</li>\r
+ * <li>'grandfathered' 3066 ids are converted to ICU standard form</li>\r
+ * <li>'PREEURO' and 'EURO' variants are converted to currency keyword form,\r
+ * with the currency\r
+ * id appropriate to the country of the locale (for PREEURO) or EUR (for EURO).\r
+ * </ul>\r
+ * All ULocale constructors automatically normalize the locale id.  To handle\r
+ * POSIX ids, <code>canonicalize</code> can be called to convert the id\r
+ * to canonical form, or the <code>canonicalInstance</code> factory method\r
+ * can be called.</p>\r
+ *\r
+ * <p>This class provides selectors {@link #VALID_LOCALE} and {@link\r
+ * #ACTUAL_LOCALE} intended for use in methods named\r
+ * <tt>getLocale()</tt>.  These methods exist in several ICU classes,\r
+ * including {@link com.ibm.icu.util.Calendar}, {@link\r
+ * com.ibm.icu.util.Currency}, {@link com.ibm.icu.text.UFormat},\r
+ * {@link com.ibm.icu.text.BreakIterator},\r
+ * <a href="../text/Collator.html" title="class in com.ibm.icu.text"><code>Collator</code></a>,\r
+ * {@link com.ibm.icu.text.DateFormatSymbols}, and {@link\r
+ * com.ibm.icu.text.DecimalFormatSymbols} and their subclasses, if\r
+ * any.  Once an object of one of these classes has been created,\r
+ * <tt>getLocale()</tt> may be called on it to determine the valid and\r
+ * actual locale arrived at during the object's construction.\r
+ *\r
+ * <p>Note: The <i>actual</i> locale is returned correctly, but the <i>valid</i>\r
+ * locale is not, in most cases.\r
+ *\r
+ * @see java.util.Locale\r
+ * @author weiv\r
+ * @author Alan Liu\r
+ * @author Ram Viswanadha\r
+ * @stable ICU 2.8\r
+ */\r
+public final class ULocale implements Serializable {\r
+    private static final long serialVersionUID = 1L;\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale ENGLISH = new ULocale("en", Locale.ENGLISH);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale FRENCH = new ULocale("fr", Locale.FRENCH);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale GERMAN = new ULocale("de", Locale.GERMAN);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale ITALIAN = new ULocale("it", Locale.ITALIAN);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale JAPANESE = new ULocale("ja", Locale.JAPANESE);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale KOREAN = new ULocale("ko", Locale.KOREAN);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale CHINESE = new ULocale("zh", Locale.CHINESE);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale SIMPLIFIED_CHINESE = new ULocale("zh_Hans", Locale.CHINESE);\r
+\r
+    /**\r
+     * Useful constant for language.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale TRADITIONAL_CHINESE = new ULocale("zh_Hant", Locale.CHINESE);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale FRANCE = new ULocale("fr_FR", Locale.FRANCE);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale GERMANY = new ULocale("de_DE", Locale.GERMANY);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale ITALY = new ULocale("it_IT", Locale.ITALY);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale JAPAN = new ULocale("ja_JP", Locale.JAPAN);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale KOREA = new ULocale("ko_KR", Locale.KOREA);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale CHINA = new ULocale("zh_Hans_CN", Locale.CHINA);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale PRC = CHINA;\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale TAIWAN = new ULocale("zh_Hant_TW", Locale.TAIWAN);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale UK = new ULocale("en_GB", Locale.UK);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale US = new ULocale("en_US", Locale.US);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale CANADA = new ULocale("en_CA", Locale.CANADA);\r
+\r
+    /**\r
+     * Useful constant for country/region.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static final ULocale CANADA_FRENCH = new ULocale("fr_CA", Locale.CANADA_FRENCH);\r
+\r
+    /**\r
+     * Handy constant.\r
+     */\r
+    private static final String EMPTY_STRING = "";\r
+\r
+    // Used in both ULocale and LocaleIDParser, so moved up here.\r
+    private static final char UNDERSCORE            = '_';\r
+\r
+    // default empty locale\r
+    private static final Locale EMPTY_LOCALE = new Locale("", "");\r
+\r
+    /**\r
+     * The root ULocale.\r
+     * @stable ICU 2.8\r
+     */\r
+    public static final ULocale ROOT = new ULocale("", EMPTY_LOCALE);\r
+\r
+    private static final SimpleCache<Locale, ULocale> CACHE = new SimpleCache<Locale, ULocale>();\r
+\r
+    /**\r
+     * Cache the locale.\r
+     */\r
+    private transient volatile Locale locale;\r
+\r
+    /**\r
+     * The raw localeID that we were passed in.\r
+     */\r
+    private String localeID;\r
+\r
+    private static String[][] CANONICALIZE_MAP;\r
+    private static String[][] variantsToKeywords;\r
+\r
+    private static void initCANONICALIZE_MAP() {\r
+        if (CANONICALIZE_MAP == null) {\r
+            /**\r
+             * This table lists pairs of locale ids for canonicalization.  The\r
+             * The 1st item is the normalized id. The 2nd item is the\r
+             * canonicalized id. The 3rd is the keyword. The 4th is the keyword value.\r
+             */\r
+            String[][] tempCANONICALIZE_MAP = {\r
+//              { EMPTY_STRING,     "en_US_POSIX", null, null }, /* .NET name */\r
+                { "C",              "en_US_POSIX", null, null }, /* POSIX name */\r
+                { "art_LOJBAN",     "jbo", null, null }, /* registered name */\r
+                { "az_AZ_CYRL",     "az_Cyrl_AZ", null, null }, /* .NET name */\r
+                { "az_AZ_LATN",     "az_Latn_AZ", null, null }, /* .NET name */\r
+                { "ca_ES_PREEURO",  "ca_ES", "currency", "ESP" },\r
+                { "cel_GAULISH",    "cel__GAULISH", null, null }, /* registered name */\r
+                { "de_1901",        "de__1901", null, null }, /* registered name */\r
+                { "de_1906",        "de__1906", null, null }, /* registered name */\r
+                { "de__PHONEBOOK",  "de", "collation", "phonebook" }, /* Old ICU name */\r
+                { "de_AT_PREEURO",  "de_AT", "currency", "ATS" },\r
+                { "de_DE_PREEURO",  "de_DE", "currency", "DEM" },\r
+                { "de_LU_PREEURO",  "de_LU", "currency", "EUR" },\r
+                { "el_GR_PREEURO",  "el_GR", "currency", "GRD" },\r
+                { "en_BOONT",       "en__BOONT", null, null }, /* registered name */\r
+                { "en_SCOUSE",      "en__SCOUSE", null, null }, /* registered name */\r
+                { "en_BE_PREEURO",  "en_BE", "currency", "BEF" },\r
+                { "en_IE_PREEURO",  "en_IE", "currency", "IEP" },\r
+                { "es__TRADITIONAL", "es", "collation", "traditional" }, /* Old ICU name */\r
+                { "es_ES_PREEURO",  "es_ES", "currency", "ESP" },\r
+                { "eu_ES_PREEURO",  "eu_ES", "currency", "ESP" },\r
+                { "fi_FI_PREEURO",  "fi_FI", "currency", "FIM" },\r
+                { "fr_BE_PREEURO",  "fr_BE", "currency", "BEF" },\r
+                { "fr_FR_PREEURO",  "fr_FR", "currency", "FRF" },\r
+                { "fr_LU_PREEURO",  "fr_LU", "currency", "LUF" },\r
+                { "ga_IE_PREEURO",  "ga_IE", "currency", "IEP" },\r
+                { "gl_ES_PREEURO",  "gl_ES", "currency", "ESP" },\r
+                { "hi__DIRECT",     "hi", "collation", "direct" }, /* Old ICU name */\r
+                { "it_IT_PREEURO",  "it_IT", "currency", "ITL" },\r
+                { "ja_JP_TRADITIONAL", "ja_JP", "calendar", "japanese" },\r
+//              { "nb_NO_NY",       "nn_NO", null, null },\r
+                { "nl_BE_PREEURO",  "nl_BE", "currency", "BEF" },\r
+                { "nl_NL_PREEURO",  "nl_NL", "currency", "NLG" },\r
+                { "pt_PT_PREEURO",  "pt_PT", "currency", "PTE" },\r
+                { "sl_ROZAJ",       "sl__ROZAJ", null, null }, /* registered name */\r
+                { "sr_SP_CYRL",     "sr_Cyrl_RS", null, null }, /* .NET name */\r
+                { "sr_SP_LATN",     "sr_Latn_RS", null, null }, /* .NET name */\r
+                { "sr_YU_CYRILLIC", "sr_Cyrl_RS", null, null }, /* Linux name */\r
+                { "th_TH_TRADITIONAL", "th_TH", "calendar", "buddhist" }, /* Old ICU name */\r
+                { "uz_UZ_CYRILLIC", "uz_Cyrl_UZ", null, null }, /* Linux name */\r
+                { "uz_UZ_CYRL",     "uz_Cyrl_UZ", null, null }, /* .NET name */\r
+                { "uz_UZ_LATN",     "uz_Latn_UZ", null, null }, /* .NET name */\r
+                { "zh_CHS",         "zh_Hans", null, null }, /* .NET name */\r
+                { "zh_CHT",         "zh_Hant", null, null }, /* .NET name */\r
+                { "zh_GAN",         "zh__GAN", null, null }, /* registered name */\r
+                { "zh_GUOYU",       "zh", null, null }, /* registered name */\r
+                { "zh_HAKKA",       "zh__HAKKA", null, null }, /* registered name */\r
+                { "zh_MIN",         "zh__MIN", null, null }, /* registered name */\r
+                { "zh_MIN_NAN",     "zh__MINNAN", null, null }, /* registered name */\r
+                { "zh_WUU",         "zh__WUU", null, null }, /* registered name */\r
+                { "zh_XIANG",       "zh__XIANG", null, null }, /* registered name */\r
+                { "zh_YUE",         "zh__YUE", null, null } /* registered name */\r
+            };\r
+\r
+            synchronized (ULocale.class) {\r
+                if (CANONICALIZE_MAP == null) {\r
+                    CANONICALIZE_MAP = tempCANONICALIZE_MAP;\r
+                }\r
+            }\r
+        }\r
+        if (variantsToKeywords == null) {\r
+            /**\r
+             * This table lists pairs of locale ids for canonicalization.  The\r
+             * The first item is the normalized variant id.\r
+             */\r
+            String[][] tempVariantsToKeywords = {\r
+                    { "EURO",   "currency", "EUR" },\r
+                    { "PINYIN", "collation", "pinyin" }, /* Solaris variant */\r
+                    { "STROKE", "collation", "stroke" }  /* Solaris variant */\r
+            };\r
+\r
+            synchronized (ULocale.class) {\r
+                if (variantsToKeywords == null) {\r
+                    variantsToKeywords = tempVariantsToKeywords;\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    /*\r
+     * This table is used for mapping between ICU and special Java\r
+     * locales.  When an ICU locale matches <minumum base> with\r
+     * <keyword>/<value>, the ICU locale is mapped to <Java> locale.\r
+     * For example, both ja_JP@calendar=japanese and ja@calendar=japanese\r
+     * are mapped to Java locale "ja_JP_JP".  ICU locale "nn" is mapped\r
+     * to Java locale "no_NO_NY".\r
+     */\r
+    private static final String[][] _javaLocaleMap = {\r
+    //  { <Java>,       <ICU base>, <keyword>,  <value>,    <minimum base>\r
+        { "ja_JP_JP",   "ja_JP",    "calendar", "japanese", "ja"},\r
+        { "no_NO_NY",   "nn_NO",    null,       null,       "nn"},\r
+        { "th_TH_TH",   "th_TH",    "numbers",  "thai",     "th"},\r
+    };\r
+\r
+    /**\r
+     * Private constructor used by static initializers.\r
+     */\r
+    private ULocale(String localeID, Locale locale) {\r
+        this.localeID = localeID;\r
+        this.locale = locale;\r
+    }\r
+\r
+    /**\r
+     * Construct a ULocale object from a {@link java.util.Locale}.\r
+     * @param loc a JDK locale\r
+     */\r
+    private ULocale(Locale loc) {\r
+        this.localeID = getName(forLocale(loc).toString());\r
+        this.locale = loc;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a ULocale object for a {@link java.util.Locale}.\r
+     * The ULocale is canonicalized.\r
+     * @param loc a JDK locale\r
+     * @stable ICU 3.2\r
+     */\r
+    public static ULocale forLocale(Locale loc) {\r
+        if (loc == null) {\r
+            return null;\r
+        }\r
+        ULocale result = CACHE.get(loc);\r
+        if (result == null) {\r
+            if (defaultULocale != null && loc == defaultULocale.locale) {\r
+            result = defaultULocale;\r
+        } else {\r
+                String locStr = loc.toString();\r
+                if (locStr.length() == 0) {\r
+                    result = ROOT;\r
+                } else {\r
+                    for (int i = 0; i < _javaLocaleMap.length; i++) {\r
+                        if (_javaLocaleMap[i][0].equals(locStr)) {\r
+                            LocaleIDParser p = new LocaleIDParser(_javaLocaleMap[i][1]);\r
+                            p.setKeywordValue(_javaLocaleMap[i][2], _javaLocaleMap[i][3]);\r
+                            locStr = p.getName();\r
+                            break;\r
+                        }\r
+                    }\r
+                    result = new ULocale(locStr, loc);\r
+                }\r
+            }\r
+            CACHE.put(loc, result);\r
+        }\r
+        return result;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Constructs a ULocale from a RFC 3066 locale ID. The locale ID consists\r
+     * of optional language, script, country, and variant fields in that order,\r
+     * separated by underscores, followed by an optional keyword list.  The\r
+     * script, if present, is four characters long-- this distinguishes it\r
+     * from a country code, which is two characters long.  Other fields\r
+     * are distinguished by position as indicated by the underscores.  The\r
+     * start of the keyword list is indicated by '@', and consists of two\r
+     * or more keyword/value pairs separated by semicolons(';').\r
+     * \r
+     * <p>This constructor does not canonicalize the localeID.  So, for\r
+     * example, "zh__pinyin" remains unchanged instead of converting\r
+     * to "zh@collation=pinyin".  By default ICU only recognizes the\r
+     * latter as specifying pinyin collation.  Use {@link #createCanonical}\r
+     * or {@link #canonicalize} if you need to canonicalize the localeID.\r
+     *\r
+     * @param localeID string representation of the locale, e.g:\r
+     * "en_US", "sy_Cyrl_YU", "zh__pinyin", "es_ES@currency=EUR;collation=traditional"\r
+     * @stable ICU 2.8\r
+     */\r
+    public ULocale(String localeID) {\r
+        this.localeID = getName(localeID);\r
+    }\r
+\r
+    /**\r
+     * Convenience overload of ULocale(String, String, String) for\r
+     * compatibility with java.util.Locale.\r
+     * @see #ULocale(String, String, String)\r
+     * @stable ICU 3.4\r
+     */\r
+    public ULocale(String a, String b) {\r
+        this(a, b, null);\r
+    }\r
+\r
+    /**\r
+     * Constructs a ULocale from a localeID constructed from the three 'fields' a, b, and\r
+     * c.  These fields are concatenated using underscores to form a localeID of the form\r
+     * a_b_c, which is then handled like the localeID passed to <code>ULocale(String\r
+     * localeID)</code>.\r
+     *\r
+     * <p>Java locale strings consisting of language, country, and\r
+     * variant will be handled by this form, since the country code\r
+     * (being shorter than four letters long) will not be interpreted\r
+     * as a script code.  If a script code is present, the final\r
+     * argument ('c') will be interpreted as the country code.  It is\r
+     * recommended that this constructor only be used to ease porting,\r
+     * and that clients instead use the single-argument constructor\r
+     * when constructing a ULocale from a localeID.\r
+     * @param a first component of the locale id\r
+     * @param b second component of the locale id\r
+     * @param c third component of the locale id\r
+     * @see #ULocale(String)\r
+     * @stable ICU 3.0\r
+     */\r
+    public ULocale(String a, String b, String c) {\r
+        localeID = getName(lscvToID(a, b, c, EMPTY_STRING));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Creates a ULocale from the id by first canonicalizing the id.\r
+     * @param nonCanonicalID the locale id to canonicalize\r
+     * @return the locale created from the canonical version of the ID.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static ULocale createCanonical(String nonCanonicalID) {\r
+        return new ULocale(canonicalize(nonCanonicalID), (Locale)null);\r
+    }\r
+\r
+    private static String lscvToID(String lang, String script, String country, String variant) {\r
+        StringBuilder buf = new StringBuilder();\r
+\r
+        if (lang != null && lang.length() > 0) {\r
+            buf.append(lang);\r
+        }\r
+        if (script != null && script.length() > 0) {\r
+            buf.append(UNDERSCORE);\r
+            buf.append(script);\r
+        }\r
+        if (country != null && country.length() > 0) {\r
+            buf.append(UNDERSCORE);\r
+            buf.append(country);\r
+        }\r
+        if (variant != null && variant.length() > 0) {\r
+            if (country == null || country.length() == 0) {\r
+                buf.append(UNDERSCORE);\r
+            }\r
+            buf.append(UNDERSCORE);\r
+            buf.append(variant);\r
+        }\r
+        return buf.toString();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Converts this ULocale object to a {@link java.util.Locale}.\r
+     * @return a JDK locale that either exactly represents this object\r
+     * or is the closest approximation.\r
+     * @stable ICU 2.8\r
+     */\r
+    public Locale toLocale() {\r
+        if (locale == null) {\r
+            LocaleIDParser p = new LocaleIDParser(localeID);\r
+            String base = p.getBaseName();\r
+            for (int i = 0; i < _javaLocaleMap.length; i++) {\r
+                if (base.equals(_javaLocaleMap[i][1]) || base.equals(_javaLocaleMap[i][4])) {\r
+                    if (_javaLocaleMap[i][2] != null) {\r
+                        String val = p.getKeywordValue(_javaLocaleMap[i][2]);\r
+                        if (val != null && val.equals(_javaLocaleMap[i][3])) {\r
+                            p = new LocaleIDParser(_javaLocaleMap[i][0]);\r
+                            break;\r
+                        }\r
+                    } else {\r
+                        p = new LocaleIDParser(_javaLocaleMap[i][0]);\r
+                        break;\r
+                    }\r
+                }\r
+            }\r
+            String[] names = p.getLanguageScriptCountryVariant();\r
+            locale = new Locale(names[0], names[2], names[3]);\r
+        }\r
+        return locale;\r
+    }\r
+\r
+    private static ICUCache<String, String> nameCache = new SimpleCache<String, String>();\r
+    /**\r
+     * Keep our own default ULocale.\r
+     */\r
+    private static Locale defaultLocale = Locale.getDefault();\r
+    private static ULocale defaultULocale = new ULocale(defaultLocale);\r
+\r
+    /**\r
+     * Returns the current default ULocale.\r
+     * @stable ICU 2.8\r
+     */\r
+    public static ULocale getDefault() {\r
+        synchronized (ULocale.class) {\r
+            Locale currentDefault = Locale.getDefault();\r
+            if (!defaultLocale.equals(currentDefault)) {\r
+                defaultLocale = currentDefault;\r
+                defaultULocale = new ULocale(defaultLocale);\r
+            }\r
+            return defaultULocale;\r
+        }\r
+    }\r
+\r
+    /**\r
+     * {@icu} Sets the default ULocale.  This also sets the default Locale.\r
+     * If the caller does not have write permission to the\r
+     * user.language property, a security exception will be thrown,\r
+     * and the default ULocale will remain unchanged.\r
+     * @param newLocale the new default locale\r
+     * @throws SecurityException if a security manager exists and its\r
+     *        <code>checkPermission</code> method doesn't allow the operation.\r
+     * @throws NullPointerException if <code>newLocale</code> is null\r
+     * @see SecurityManager#checkPermission(java.security.Permission)\r
+     * @see java.util.PropertyPermission\r
+     * @stable ICU 3.0\r
+     */\r
+    public static synchronized void setDefault(ULocale newLocale){\r
+        Locale.setDefault(newLocale.toLocale());\r
+        defaultULocale = newLocale;\r
+    }\r
+\r
+    /**\r
+     * This is for compatibility with Locale-- in actuality, since ULocale is\r
+     * immutable, there is no reason to clone it, so this API returns 'this'.\r
+     * @stable ICU 3.0\r
+     */\r
+    public Object clone() {\r
+        return this;\r
+    }\r
+\r
+    /**\r
+     * Returns the hashCode.\r
+     * @stable ICU 3.0\r
+     */\r
+    public int hashCode() {\r
+        return localeID.hashCode();\r
+    }\r
+\r
+    /**\r
+     * Returns true if the other object is another ULocale with the\r
+     * same full name, or is a String localeID that matches the full name.\r
+     * Note that since names are not canonicalized, two ULocales that\r
+     * function identically might not compare equal.\r
+     *\r
+     * @return true if this Locale is equal to the specified object.\r
+     * @stable ICU 3.0\r
+     */\r
+    public boolean equals(Object obj) {\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+        if (obj instanceof String) {\r
+            return localeID.equals((String)obj);\r
+        }\r
+        if (obj instanceof ULocale) {\r
+            return localeID.equals(((ULocale)obj).localeID);\r
+        }\r
+        return false;\r
+    }\r
+\r
+    /**\r
+     * {@icunote} Unlike the Locale API, this returns an array of <code>ULocale</code>,\r
+     * not <code>Locale</code>.  Returns a list of all installed locales.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static ULocale[] getAvailableLocales() {\r
+        if (availableLocales == null) {\r
+            synchronized (ULocale.class) {\r
+                if (availableLocales == null) {\r
+                    Locale[] locales = Locale.getAvailableLocales();\r
+                    availableLocales = new ULocale[locales.length];\r
+                    for (int i = 0; i < locales.length; i++) {\r
+                        availableLocales[i] = ULocale.forLocale(locales[i]);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return availableLocales.clone();\r
+    }\r
+    private static volatile ULocale[] availableLocales = null;\r
+\r
+    /**\r
+     * Returns a list of all 2-letter country codes defined in ISO 3166.\r
+     * Can be used to create Locales.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String[] getISOCountries() {\r
+        return LocaleIDs.getISOCountries();\r
+    }\r
+\r
+    /**\r
+     * Returns a list of all 2-letter language codes defined in ISO 639.\r
+     * Can be used to create Locales.\r
+     * [NOTE:  ISO 639 is not a stable standard-- some languages' codes have changed.\r
+     * The list this function returns includes both the new and the old codes for the\r
+     * languages whose codes have changed.]\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String[] getISOLanguages() {\r
+        return LocaleIDs.getISOLanguages();\r
+    }\r
+\r
+    /**\r
+     * Returns the language code for this locale, which will either be the empty string\r
+     * or a lowercase ISO 639 code.\r
+     * @see #getDisplayLanguage()\r
+     * @see #getDisplayLanguage(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getLanguage() {\r
+        return getLanguage(localeID);\r
+    }\r
+\r
+    /**\r
+     * Returns the language code for the locale ID,\r
+     * which will either be the empty string\r
+     * or a lowercase ISO 639 code.\r
+     * @see #getDisplayLanguage()\r
+     * @see #getDisplayLanguage(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getLanguage(String localeID) {\r
+        return new LocaleIDParser(localeID).getLanguage();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the script code for this locale, which might be the empty string.\r
+     * @see #getDisplayScript()\r
+     * @see #getDisplayScript(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getScript() {\r
+        return getScript(localeID);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the script code for the specified locale, which might be the empty\r
+     * string.\r
+     * @see #getDisplayScript()\r
+     * @see #getDisplayScript(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getScript(String localeID) {\r
+        return new LocaleIDParser(localeID).getScript();\r
+    }\r
+\r
+    /**\r
+     * Returns the country/region code for this locale, which will either be the empty string\r
+     * or an uppercase ISO 3166 2-letter code.\r
+     * @see #getDisplayCountry()\r
+     * @see #getDisplayCountry(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getCountry() {\r
+        return getCountry(localeID);\r
+    }\r
+\r
+    /**\r
+     * Returns the country/region code for this locale, which will either be the empty string\r
+     * or an uppercase ISO 3166 2-letter code.\r
+     * @param localeID The locale identification string.\r
+     * @see #getDisplayCountry()\r
+     * @see #getDisplayCountry(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getCountry(String localeID) {\r
+        return new LocaleIDParser(localeID).getCountry();\r
+    }\r
+\r
+    /**\r
+     * Returns the variant code for this locale, which might be the empty string.\r
+     * @see #getDisplayVariant()\r
+     * @see #getDisplayVariant(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getVariant() {\r
+        return getVariant(localeID);\r
+    }\r
+\r
+    /**\r
+     * Returns the variant code for the specified locale, which might be the empty string.\r
+     * @see #getDisplayVariant()\r
+     * @see #getDisplayVariant(ULocale)\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getVariant(String localeID) {\r
+        return new LocaleIDParser(localeID).getVariant();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the fallback locale for the specified locale, which might be the\r
+     * empty string.\r
+     * @stable ICU 3.2\r
+     */\r
+    public static String getFallback(String localeID) {\r
+        return getFallbackString(getName(localeID));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the fallback locale for this locale.  If this locale is root,\r
+     * returns null.\r
+     * @stable ICU 3.2\r
+     */\r
+    public ULocale getFallback() {\r
+        if (localeID.length() == 0 || localeID.charAt(0) == '@') {\r
+            return null;\r
+        }\r
+        return new ULocale(getFallbackString(localeID), (Locale)null);\r
+    }\r
+\r
+    /**\r
+     * Returns the given (canonical) locale id minus the last part before the tags.\r
+     */\r
+    private static String getFallbackString(String fallback) {\r
+        int extStart = fallback.indexOf('@');\r
+        if (extStart == -1) {\r
+            extStart = fallback.length();\r
+        }\r
+        int last = fallback.lastIndexOf('_', extStart);\r
+        if (last == -1) {\r
+            last = 0;\r
+        } else {\r
+            // truncate empty segment\r
+            while (last > 0) {\r
+                if (fallback.charAt(last - 1) != '_') {\r
+                    break;\r
+                }\r
+                last--;\r
+            }\r
+        }\r
+        return fallback.substring(0, last) + fallback.substring(extStart);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the (normalized) base name for this locale.\r
+     * @return the base name as a String.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getBaseName() {\r
+        return getBaseName(localeID);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the (normalized) base name for the specified locale.\r
+     * @param localeID the locale ID as a string\r
+     * @return the base name as a String.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getBaseName(String localeID){\r
+        if (localeID.indexOf('@') == -1) {\r
+            return localeID;\r
+        }\r
+        return new LocaleIDParser(localeID).getBaseName();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the (normalized) full name for this locale.\r
+     *\r
+     * @return String the full name of the localeID\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getName() {\r
+        return localeID; // always normalized\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the (normalized) full name for the specified locale.\r
+     *\r
+     * @param localeID the localeID as a string\r
+     * @return String the full name of the localeID\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getName(String localeID){\r
+        String name = nameCache.get(localeID);\r
+        if (name == null) {\r
+            name = new LocaleIDParser(localeID).getName();\r
+            nameCache.put(localeID, name);\r
+        }\r
+        return name;\r
+    }\r
+\r
+    /**\r
+     * Returns a string representation of this object.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String toString() {\r
+        return localeID;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns an iterator over keywords for this locale.  If there\r
+     * are no keywords, returns null.\r
+     * @return iterator over keywords, or null if there are no keywords.\r
+     * @stable ICU 3.0\r
+     */\r
+    public Iterator<String> getKeywords() {\r
+        return getKeywords(localeID);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns an iterator over keywords for the specified locale.  If there\r
+     * are no keywords, returns null.\r
+     * @return an iterator over the keywords in the specified locale, or null\r
+     * if there are no keywords.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static Iterator<String> getKeywords(String localeID){\r
+        return new LocaleIDParser(localeID).getKeywords();\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the value for a keyword in this locale. If the keyword is not\r
+     * defined, returns null.\r
+     * @param keywordName name of the keyword whose value is desired. Case insensitive.\r
+     * @return the value of the keyword, or null.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getKeywordValue(String keywordName){\r
+        return getKeywordValue(localeID, keywordName);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the value for a keyword in the specified locale. If the keyword is\r
+     * not defined, returns null.  The locale name does not need to be normalized.\r
+     * @param keywordName name of the keyword whose value is desired. Case insensitive.\r
+     * @return String the value of the keyword as a string\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getKeywordValue(String localeID, String keywordName) {\r
+        return new LocaleIDParser(localeID).getKeywordValue(keywordName);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the canonical name for the specified locale ID.  This is used to\r
+     * convert POSIX and other grandfathered IDs to standard ICU form.\r
+     * @param localeID the locale id\r
+     * @return the canonicalized id\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String canonicalize(String localeID){\r
+        LocaleIDParser parser = new LocaleIDParser(localeID, true);\r
+        String baseName = parser.getBaseName();\r
+        boolean foundVariant = false;\r
+\r
+        // formerly, we always set to en_US_POSIX if the basename was empty, but\r
+        // now we require that the entire id be empty, so that "@foo=bar"\r
+        // will pass through unchanged.\r
+        // {dlf} I'd rather keep "" unchanged.\r
+        if (localeID.equals("")) {\r
+            return "";\r
+//              return "en_US_POSIX";\r
+        }\r
+\r
+        // we have an ID in the form xx_Yyyy_ZZ_KKKKK\r
+\r
+        initCANONICALIZE_MAP();\r
+\r
+        /* convert the variants to appropriate ID */\r
+        for (int i = 0; i < variantsToKeywords.length; i++) {\r
+            String[] vals = variantsToKeywords[i];\r
+            int idx = baseName.lastIndexOf("_" + vals[0]);\r
+            if (idx > -1) {\r
+                foundVariant = true;\r
+\r
+                baseName = baseName.substring(0, idx);\r
+                if (baseName.endsWith("_")) {\r
+                    baseName = baseName.substring(0, --idx);\r
+                }\r
+                parser.setBaseName(baseName);\r
+                parser.defaultKeywordValue(vals[1], vals[2]);\r
+                break;\r
+            }\r
+        }\r
+\r
+        /* See if this is an already known locale */\r
+        for (int i = 0; i < CANONICALIZE_MAP.length; i++) {\r
+            if (CANONICALIZE_MAP[i][0].equals(baseName)) {\r
+                foundVariant = true;\r
+\r
+                String[] vals = CANONICALIZE_MAP[i];\r
+                parser.setBaseName(vals[1]);\r
+                if (vals[2] != null) {\r
+                    parser.defaultKeywordValue(vals[2], vals[3]);\r
+                }\r
+                break;\r
+            }\r
+        }\r
+\r
+        /* total mondo hack for Norwegian, fortunately the main NY case is handled earlier */\r
+        if (!foundVariant) {\r
+            if (parser.getLanguage().equals("nb") && parser.getVariant().equals("NY")) {\r
+                parser.setBaseName(lscvToID("nn", parser.getScript(), parser.getCountry(), null));\r
+            }\r
+        }\r
+\r
+        return parser.getName();\r
+    }\r
+\r
+    /**\r
+     * Given a keyword and a value, return a new locale with an updated\r
+     * keyword and value.  If keyword is null, this removes all keywords from the locale id.\r
+     * Otherwise, if the value is null, this removes the value for this keyword from the\r
+     * locale id.  Otherwise, this adds/replaces the value for this keyword in the locale id.\r
+     * The keyword and value must not be empty.\r
+     * @param keyword the keyword to add/remove, or null to remove all keywords.\r
+     * @param value the value to add/set, or null to remove this particular keyword.\r
+     * @return the updated locale\r
+     * @stable ICU 3.2\r
+     */\r
+    public ULocale setKeywordValue(String keyword, String value) {\r
+        return new ULocale(setKeywordValue(localeID, keyword, value), (Locale)null);\r
+    }\r
+\r
+    /**\r
+     * Given a locale id, a keyword, and a value, return a new locale id with an updated\r
+     * keyword and value.  If keyword is null, this removes all keywords from the locale id.\r
+     * Otherwise, if the value is null, this removes the value for this keyword from the\r
+     * locale id.  Otherwise, this adds/replaces the value for this keyword in the locale id.\r
+     * The keyword and value must not be empty.\r
+     * @param localeID the locale id to modify\r
+     * @param keyword the keyword to add/remove, or null to remove all keywords.\r
+     * @param value the value to add/set, or null to remove this particular keyword.\r
+     * @return the updated locale id\r
+     * @stable ICU 3.2\r
+     */\r
+    public static String setKeywordValue(String localeID, String keyword, String value) {\r
+        LocaleIDParser parser = new LocaleIDParser(localeID);\r
+        parser.setKeywordValue(keyword, value);\r
+        return parser.getName();\r
+    }\r
+\r
+    /*\r
+     * Given a locale id, a keyword, and a value, return a new locale id with an updated\r
+     * keyword and value, if the keyword does not already have a value.  The keyword and\r
+     * value must not be null or empty.\r
+     * @param localeID the locale id to modify\r
+     * @param keyword the keyword to add, if not already present\r
+     * @param value the value to add, if not already present\r
+     * @return the updated locale id\r
+     */\r
+/*    private static String defaultKeywordValue(String localeID, String keyword, String value) {\r
+        LocaleIDParser parser = new LocaleIDParser(localeID);\r
+        parser.defaultKeywordValue(keyword, value);\r
+        return parser.getName();\r
+    }*/\r
+\r
+    /**\r
+     * Returns a three-letter abbreviation for this locale's language.  If the locale\r
+     * doesn't specify a language, returns the empty string.  Otherwise, returns\r
+     * a lowercase ISO 639-2/T language code.\r
+     * The ISO 639-2 language codes can be found on-line at\r
+     *   <a href="ftp://dkuug.dk/i18n/iso-639-2.txt"><code>ftp://dkuug.dk/i18n/iso-639-2.txt</code></a>\r
+     * @exception MissingResourceException Throws MissingResourceException if the\r
+     * three-letter language abbreviation is not available for this locale.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getISO3Language(){\r
+        return getISO3Language(localeID);\r
+    }\r
+\r
+    /**\r
+     * Returns a three-letter abbreviation for this locale's language.  If the locale\r
+     * doesn't specify a language, returns the empty string.  Otherwise, returns\r
+     * a lowercase ISO 639-2/T language code.\r
+     * The ISO 639-2 language codes can be found on-line at\r
+     *   <a href="ftp://dkuug.dk/i18n/iso-639-2.txt"><code>ftp://dkuug.dk/i18n/iso-639-2.txt</code></a>\r
+     * @exception MissingResourceException Throws MissingResourceException if the\r
+     * three-letter language abbreviation is not available for this locale.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getISO3Language(String localeID) {\r
+        return LocaleIDs.getISO3Language(getLanguage(localeID));\r
+    }\r
+\r
+    /**\r
+     * Returns a three-letter abbreviation for this locale's country/region.  If the locale\r
+     * doesn't specify a country, returns the empty string.  Otherwise, returns\r
+     * an uppercase ISO 3166 3-letter country code.\r
+     * @exception MissingResourceException Throws MissingResourceException if the\r
+     * three-letter country abbreviation is not available for this locale.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getISO3Country() {\r
+        return getISO3Country(localeID);\r
+    }\r
+\r
+    /**\r
+     * Returns a three-letter abbreviation for this locale's country/region.  If the locale\r
+     * doesn't specify a country, returns the empty string.  Otherwise, returns\r
+     * an uppercase ISO 3166 3-letter country code.\r
+     * @exception MissingResourceException Throws MissingResourceException if the\r
+     * three-letter country abbreviation is not available for this locale.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getISO3Country(String localeID) {\r
+        return LocaleIDs.getISO3Country(getCountry(localeID));\r
+    }\r
+\r
+    // display names\r
+\r
+    /**\r
+     * Returns this locale's language localized for display in the default locale.\r
+     * @return the localized language name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayLanguage() {\r
+        return getDisplayLanguageInternal(this, getDefault(), false);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale's language localized for display in the provided locale.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized language name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayLanguage(ULocale displayLocale) {\r
+        return getDisplayLanguageInternal(this, displayLocale, false);\r
+    }\r
+\r
+    /**\r
+     * Returns a locale's language localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose language will be displayed\r
+     * @param displayLocaleID the id of the locale in which to display the name.\r
+     * @return the localized language name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayLanguage(String localeID, String displayLocaleID) {\r
+        return getDisplayLanguageInternal(new ULocale(localeID), new ULocale(displayLocaleID),\r
+                false);\r
+    }\r
+\r
+    /**\r
+     * Returns a locale's language localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose language will be displayed.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized language name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayLanguage(String localeID, ULocale displayLocale) {\r
+        return getDisplayLanguageInternal(new ULocale(localeID), displayLocale, false);\r
+    }\r
+    /**\r
+     * {@icu} Returns this locale's language localized for display in the default locale.\r
+     * If a dialect name is present in the data, then it is returned.\r
+     * @return the localized language name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public String getDisplayLanguageWithDialect() {\r
+        return getDisplayLanguageInternal(this, getDefault(), true);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale's language localized for display in the provided locale.\r
+     * If a dialect name is present in the data, then it is returned.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized language name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public String getDisplayLanguageWithDialect(ULocale displayLocale) {\r
+        return getDisplayLanguageInternal(this, displayLocale, true);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a locale's language localized for display in the provided locale.\r
+     * If a dialect name is present in the data, then it is returned.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose language will be displayed\r
+     * @param displayLocaleID the id of the locale in which to display the name.\r
+     * @return the localized language name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static String getDisplayLanguageWithDialect(String localeID, String displayLocaleID) {\r
+        return getDisplayLanguageInternal(new ULocale(localeID), new ULocale(displayLocaleID),\r
+                true);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a locale's language localized for display in the provided locale.\r
+     * If a dialect name is present in the data, then it is returned.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose language will be displayed.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized language name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static String getDisplayLanguageWithDialect(String localeID, ULocale displayLocale) {\r
+        return getDisplayLanguageInternal(new ULocale(localeID), displayLocale, true);\r
+    }\r
+\r
+    private static String getDisplayLanguageInternal(ULocale locale, ULocale displayLocale,\r
+            boolean useDialect) {\r
+        // No dialect support\r
+        return locale.toLocale().getDisplayLanguage(displayLocale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale's script localized for display in the default locale.\r
+     * @return the localized script name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayScript() {\r
+        return getDisplayScriptInternal(this, getDefault());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale's script localized for display in the provided locale.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized script name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayScript(ULocale displayLocale) {\r
+        return getDisplayScriptInternal(this, displayLocale);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a locale's script localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose script will be displayed\r
+     * @param displayLocaleID the id of the locale in which to display the name.\r
+     * @return the localized script name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayScript(String localeID, String displayLocaleID) {\r
+        return getDisplayScriptInternal(new ULocale(localeID), new ULocale(displayLocaleID));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a locale's script localized for display in the provided locale.\r
+     * @param localeID the id of the locale whose script will be displayed.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized script name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayScript(String localeID, ULocale displayLocale) {\r
+        return getDisplayScriptInternal(new ULocale(localeID), displayLocale);\r
+    }\r
+\r
+    // displayLocaleID is canonical, localeID need not be since parsing will fix this.\r
+    private static String getDisplayScriptInternal(ULocale locale, ULocale displayLocale) {\r
+        // No localization, just return the script code\r
+        return locale.getScript();\r
+    }\r
+\r
+    /**\r
+     * Returns this locale's country localized for display in the default locale.\r
+     * @return the localized country name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayCountry() {\r
+        return getDisplayCountryInternal(this, getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns this locale's country localized for display in the provided locale.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized country name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayCountry(ULocale displayLocale){\r
+        return getDisplayCountryInternal(this, displayLocale);\r
+    }\r
+\r
+    /**\r
+     * Returns a locale's country localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose country will be displayed\r
+     * @param displayLocaleID the id of the locale in which to display the name.\r
+     * @return the localized country name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayCountry(String localeID, String displayLocaleID) {\r
+        return getDisplayCountryInternal(new ULocale(localeID), new ULocale(displayLocaleID));\r
+    }\r
+\r
+    /**\r
+     * Returns a locale's country localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose country will be displayed.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized country name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayCountry(String localeID, ULocale displayLocale) {\r
+        return getDisplayCountryInternal(new ULocale(localeID), displayLocale);\r
+    }\r
+\r
+    // displayLocaleID is canonical, localeID need not be since parsing will fix this.\r
+    private static String getDisplayCountryInternal(ULocale locale, ULocale displayLocale) {\r
+        return locale.toLocale().getDisplayCountry(displayLocale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * Returns this locale's variant localized for display in the default locale.\r
+     * @return the localized variant name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayVariant() {\r
+        return getDisplayVariantInternal(this, getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns this locale's variant localized for display in the provided locale.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized variant name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayVariant(ULocale displayLocale) {\r
+        return getDisplayVariantInternal(this, displayLocale);\r
+    }\r
+\r
+    /**\r
+     * Returns a locale's variant localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose variant will be displayed\r
+     * @param displayLocaleID the id of the locale in which to display the name.\r
+     * @return the localized variant name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayVariant(String localeID, String displayLocaleID){\r
+        return getDisplayVariantInternal(new ULocale(localeID), new ULocale(displayLocaleID));\r
+    }\r
+\r
+    /**\r
+     * Returns a locale's variant localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose variant will be displayed.\r
+     * @param displayLocale the locale in which to display the name.\r
+     * @return the localized variant name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayVariant(String localeID, ULocale displayLocale) {\r
+        return getDisplayVariantInternal(new ULocale(localeID), displayLocale);\r
+    }\r
+\r
+    private static String getDisplayVariantInternal(ULocale locale, ULocale displayLocale) {\r
+        return locale.toLocale().getDisplayVariant(displayLocale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a keyword localized for display in the default locale.\r
+     * @param keyword the keyword to be displayed.\r
+     * @return the localized keyword name.\r
+     * @see #getKeywords()\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayKeyword(String keyword) {\r
+        return getDisplayKeywordInternal(keyword, getDefault());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a keyword localized for display in the specified locale.\r
+     * @param keyword the keyword to be displayed.\r
+     * @param displayLocaleID the id of the locale in which to display the keyword.\r
+     * @return the localized keyword name.\r
+     * @see #getKeywords(String)\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayKeyword(String keyword, String displayLocaleID) {\r
+        return getDisplayKeywordInternal(keyword, new ULocale(displayLocaleID));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a keyword localized for display in the specified locale.\r
+     * @param keyword the keyword to be displayed.\r
+     * @param displayLocale the locale in which to display the keyword.\r
+     * @return the localized keyword name.\r
+     * @see #getKeywords(String)\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayKeyword(String keyword, ULocale displayLocale) {\r
+        return getDisplayKeywordInternal(keyword, displayLocale);\r
+    }\r
+\r
+    private static String getDisplayKeywordInternal(String keyword, ULocale displayLocale) {\r
+        // No localization\r
+        return keyword;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a keyword value localized for display in the default locale.\r
+     * @param keyword the keyword whose value is to be displayed.\r
+     * @return the localized value name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayKeywordValue(String keyword) {\r
+        return getDisplayKeywordValueInternal(this, keyword, getDefault());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a keyword value localized for display in the specified locale.\r
+     * @param keyword the keyword whose value is to be displayed.\r
+     * @param displayLocale the locale in which to display the value.\r
+     * @return the localized value name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayKeywordValue(String keyword, ULocale displayLocale) {\r
+        return getDisplayKeywordValueInternal(this, keyword, displayLocale);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a keyword value localized for display in the specified locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose keyword value is to be displayed.\r
+     * @param keyword the keyword whose value is to be displayed.\r
+     * @param displayLocaleID the id of the locale in which to display the value.\r
+     * @return the localized value name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayKeywordValue(String localeID, String keyword,\r
+            String displayLocaleID) {\r
+        return getDisplayKeywordValueInternal(new ULocale(localeID), keyword,\r
+                new ULocale(displayLocaleID));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a keyword value localized for display in the specified locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the id of the locale whose keyword value is to be displayed.\r
+     * @param keyword the keyword whose value is to be displayed.\r
+     * @param displayLocale the id of the locale in which to display the value.\r
+     * @return the localized value name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayKeywordValue(String localeID, String keyword,\r
+            ULocale displayLocale) {\r
+        return getDisplayKeywordValueInternal(new ULocale(localeID), keyword, displayLocale);\r
+    }\r
+\r
+    // displayLocaleID is canonical, localeID need not be since parsing will fix this.\r
+    private static String getDisplayKeywordValueInternal(ULocale locale, String keyword,\r
+            ULocale displayLocale) {\r
+        keyword = AsciiUtil.toLowerString(keyword.trim());\r
+        String value = locale.getKeywordValue(keyword);\r
+        return value;\r
+    }\r
+\r
+    /**\r
+     * Returns this locale name localized for display in the default locale.\r
+     * @return the localized locale name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayName() {\r
+        return getDisplayNameInternal(this, getDefault());\r
+    }\r
+\r
+    /**\r
+     * Returns this locale name localized for display in the provided locale.\r
+     * @param displayLocale the locale in which to display the locale name.\r
+     * @return the localized locale name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public String getDisplayName(ULocale displayLocale) {\r
+        return getDisplayNameInternal(this, displayLocale);\r
+    }\r
+\r
+    /**\r
+     * Returns the locale ID localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the locale whose name is to be displayed.\r
+     * @param displayLocaleID the id of the locale in which to display the locale name.\r
+     * @return the localized locale name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayName(String localeID, String displayLocaleID) {\r
+        return getDisplayNameInternal(new ULocale(localeID), new ULocale(displayLocaleID));\r
+    }\r
+\r
+    /**\r
+     * Returns the locale ID localized for display in the provided locale.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the locale whose name is to be displayed.\r
+     * @param displayLocale the locale in which to display the locale name.\r
+     * @return the localized locale name.\r
+     * @stable ICU 3.0\r
+     */\r
+    public static String getDisplayName(String localeID, ULocale displayLocale) {\r
+        return getDisplayNameInternal(new ULocale(localeID), displayLocale);\r
+    }\r
+\r
+    private static String getDisplayNameInternal(ULocale locale, ULocale displayLocale) {\r
+        // No localization, no script and keywords\r
+        return locale.toLocale().getDisplayName(displayLocale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale name localized for display in the default locale.\r
+     * If a dialect name is present in the locale data, then it is returned.\r
+     * @return the localized locale name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public String getDisplayNameWithDialect() {\r
+        return getDisplayNameWithDialectInternal(this, getDefault());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale name localized for display in the provided locale.\r
+     * If a dialect name is present in the locale data, then it is returned.\r
+     * @param displayLocale the locale in which to display the locale name.\r
+     * @return the localized locale name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public String getDisplayNameWithDialect(ULocale displayLocale) {\r
+        return getDisplayNameWithDialectInternal(this, displayLocale);\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the locale ID localized for display in the provided locale.\r
+     * If a dialect name is present in the locale data, then it is returned.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the locale whose name is to be displayed.\r
+     * @param displayLocaleID the id of the locale in which to display the locale name.\r
+     * @return the localized locale name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static String getDisplayNameWithDialect(String localeID, String displayLocaleID) {\r
+        return getDisplayNameWithDialectInternal(new ULocale(localeID),\r
+                new ULocale(displayLocaleID));\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the locale ID localized for display in the provided locale.\r
+     * If a dialect name is present in the locale data, then it is returned.\r
+     * This is a cover for the ICU4C API.\r
+     * @param localeID the locale whose name is to be displayed.\r
+     * @param displayLocale the locale in which to display the locale name.\r
+     * @return the localized locale name.\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static String getDisplayNameWithDialect(String localeID, ULocale displayLocale) {\r
+        return getDisplayNameWithDialectInternal(new ULocale(localeID), displayLocale);\r
+    }\r
+\r
+    private static String getDisplayNameWithDialectInternal(ULocale locale, ULocale displayLocale) {\r
+        // No dialect support, no script and keyword support\r
+        return locale.toLocale().getDisplayName(displayLocale.toLocale());\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale's layout orientation for characters.  The possible\r
+     * values are "left-to-right", "right-to-left", "top-to-bottom" or\r
+     * "bottom-to-top".\r
+     * @return The locale's layout orientation for characters.\r
+     * @stable ICU 4.0\r
+     */\r
+    public String getCharacterOrientation() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns this locale's layout orientation for lines.  The possible\r
+     * values are "left-to-right", "right-to-left", "top-to-bottom" or\r
+     * "bottom-to-top".\r
+     * @return The locale's layout orientation for lines.\r
+     * @stable ICU 4.0\r
+     */\r
+    public String getLineOrientation() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Selector for <tt>getLocale()</tt> indicating the locale of the\r
+     * resource containing the data.  This is always at or above the\r
+     * valid locale.  If the valid locale does not contain the\r
+     * specific data being requested, then the actual locale will be\r
+     * above the valid locale.  If the object was not constructed from\r
+     * locale data, then the valid locale is <i>null</i>.\r
+     *\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static Type ACTUAL_LOCALE = new Type();\r
+\r
+    /**\r
+     * {@icu} Selector for <tt>getLocale()</tt> indicating the most specific\r
+     * locale for which any data exists.  This is always at or above\r
+     * the requested locale, and at or below the actual locale.  If\r
+     * the requested locale does not correspond to any resource data,\r
+     * then the valid locale will be above the requested locale.  If\r
+     * the object was not constructed from locale data, then the\r
+     * actual locale is <i>null</i>.\r
+     *\r
+     * <p>Note: The valid locale will be returned correctly in ICU\r
+     * 3.0 or later.  In ICU 2.8, it is not returned correctly.\r
+     * @draft ICU 2.8 (retain)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static Type VALID_LOCALE = new Type();\r
+\r
+    /**\r
+     * Opaque selector enum for <tt>getLocale()</tt>.\r
+     * @see com.ibm.icu.util.ULocale\r
+     * @see com.ibm.icu.util.ULocale#ACTUAL_LOCALE\r
+     * @see com.ibm.icu.util.ULocale#VALID_LOCALE\r
+     * @draft ICU 2.8 (retainAll)\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final class Type {\r
+        private Type() {}\r
+    }\r
+\r
+  /**\r
+    * {@icu} Based on a HTTP formatted list of acceptable locales, determine an available\r
+    * locale for the user.  NullPointerException is thrown if acceptLanguageList or\r
+    * availableLocales is null.  If fallback is non-null, it will contain true if a\r
+    * fallback locale (one not in the acceptLanguageList) was returned.  The value on\r
+    * entry is ignored.  ULocale will be one of the locales in availableLocales, or the\r
+    * ROOT ULocale if if a ROOT locale was used as a fallback (because nothing else in\r
+    * availableLocales matched).  No ULocale array element should be null; behavior is\r
+    * undefined if this is the case.\r
+    * @param acceptLanguageList list in HTTP "Accept-Language:" format of acceptable locales\r
+    * @param availableLocales list of available locales. One of these will be returned.\r
+    * @param fallback if non-null, a 1-element array containing a boolean to be set with\r
+    * the fallback status\r
+    * @return one of the locales from the availableLocales list, or null if none match\r
+    * @stable ICU 3.4\r
+    */\r
+    public static ULocale acceptLanguage(String acceptLanguageList, ULocale[] availableLocales,\r
+                                         boolean[] fallback) {\r
+        if (acceptLanguageList == null) {\r
+            throw new NullPointerException();\r
+        }\r
+        ULocale acceptList[] = null;\r
+        try {\r
+            acceptList = parseAcceptLanguage(acceptLanguageList, true);\r
+        } catch (ParseException pe) {\r
+            acceptList = null;\r
+        }\r
+        if (acceptList == null) {\r
+            return null;\r
+        }\r
+        return acceptLanguage(acceptList, availableLocales, fallback);\r
+    }\r
+\r
+    /**\r
+    * {@icu} Based on a list of acceptable locales, determine an available locale for the\r
+    * user.  NullPointerException is thrown if acceptLanguageList or availableLocales is\r
+    * null.  If fallback is non-null, it will contain true if a fallback locale (one not\r
+    * in the acceptLanguageList) was returned.  The value on entry is ignored.  ULocale\r
+    * will be one of the locales in availableLocales, or the ROOT ULocale if if a ROOT\r
+    * locale was used as a fallback (because nothing else in availableLocales matched).\r
+    * No ULocale array element should be null; behavior is undefined if this is the case.\r
+    * @param acceptLanguageList list of acceptable locales\r
+    * @param availableLocales list of available locales. One of these will be returned.\r
+    * @param fallback if non-null, a 1-element array containing a boolean to be set with\r
+    * the fallback status\r
+    * @return one of the locales from the availableLocales list, or null if none match\r
+    * @stable ICU 3.4\r
+    */\r
+\r
+    public static ULocale acceptLanguage(ULocale[] acceptLanguageList, ULocale[]\r
+    availableLocales, boolean[] fallback) {\r
+        // fallbacklist\r
+        int i,j;\r
+        if(fallback != null) {\r
+            fallback[0]=true;\r
+        }\r
+        for(i=0;i<acceptLanguageList.length;i++) {\r
+            ULocale aLocale = acceptLanguageList[i];\r
+            boolean[] setFallback = fallback;\r
+            do {\r
+                for(j=0;j<availableLocales.length;j++) {\r
+                    if(availableLocales[j].equals(aLocale)) {\r
+                        if(setFallback != null) {\r
+                            setFallback[0]=false; // first time with this locale - not a fallback.\r
+                        }\r
+                        return availableLocales[j];\r
+                    }\r
+                }\r
+                Locale loc = aLocale.toLocale();\r
+                Locale parent = LocaleUtility.fallback(loc);\r
+                if(parent != null) {\r
+                    aLocale = new ULocale(parent);\r
+                } else {\r
+                    aLocale = null;\r
+                }\r
+                setFallback = null; // Do not set fallback in later iterations\r
+            } while (aLocale != null);\r
+        }\r
+        return null;\r
+    }\r
+\r
+   /**\r
+    * {@icu} Based on a HTTP formatted list of acceptable locales, determine an available\r
+    * locale for the user.  NullPointerException is thrown if acceptLanguageList or\r
+    * availableLocales is null.  If fallback is non-null, it will contain true if a\r
+    * fallback locale (one not in the acceptLanguageList) was returned.  The value on\r
+    * entry is ignored.  ULocale will be one of the locales in availableLocales, or the\r
+    * ROOT ULocale if if a ROOT locale was used as a fallback (because nothing else in\r
+    * availableLocales matched).  No ULocale array element should be null; behavior is\r
+    * undefined if this is the case.  This function will choose a locale from the\r
+    * ULocale.getAvailableLocales() list as available.\r
+    * @param acceptLanguageList list in HTTP "Accept-Language:" format of acceptable locales\r
+    * @param fallback if non-null, a 1-element array containing a boolean to be set with\r
+    * the fallback status\r
+    * @return one of the locales from the ULocale.getAvailableLocales() list, or null if\r
+    * none match\r
+    * @stable ICU 3.4\r
+    */\r
+    public static ULocale acceptLanguage(String acceptLanguageList, boolean[] fallback) {\r
+        return acceptLanguage(acceptLanguageList, ULocale.getAvailableLocales(),\r
+                                fallback);\r
+    }\r
+\r
+   /**\r
+    * {@icu} Based on an ordered array of acceptable locales, determine an available\r
+    * locale for the user.  NullPointerException is thrown if acceptLanguageList or\r
+    * availableLocales is null.  If fallback is non-null, it will contain true if a\r
+    * fallback locale (one not in the acceptLanguageList) was returned.  The value on\r
+    * entry is ignored.  ULocale will be one of the locales in availableLocales, or the\r
+    * ROOT ULocale if if a ROOT locale was used as a fallback (because nothing else in\r
+    * availableLocales matched).  No ULocale array element should be null; behavior is\r
+    * undefined if this is the case.  This function will choose a locale from the\r
+    * ULocale.getAvailableLocales() list as available.\r
+    * @param acceptLanguageList ordered array of acceptable locales (preferred are listed first)\r
+    * @param fallback if non-null, a 1-element array containing a boolean to be set with\r
+    * the fallback status\r
+    * @return one of the locales from the ULocale.getAvailableLocales() list, or null if none match\r
+    * @stable ICU 3.4\r
+    */\r
+    public static ULocale acceptLanguage(ULocale[] acceptLanguageList, boolean[] fallback) {\r
+        return acceptLanguage(acceptLanguageList, ULocale.getAvailableLocales(),\r
+                fallback);\r
+    }\r
+\r
+    /**\r
+     * Package local method used for parsing Accept-Language string\r
+     */\r
+    static ULocale[] parseAcceptLanguage(String acceptLanguage, boolean isLenient) \r
+        throws ParseException {\r
+        class ULocaleAcceptLanguageQ implements Comparable<ULocaleAcceptLanguageQ> {\r
+            private double q;\r
+            private double serial;\r
+            public ULocaleAcceptLanguageQ(double theq, int theserial) {\r
+                q = theq;\r
+                serial = theserial;\r
+            }\r
+            public int compareTo(ULocaleAcceptLanguageQ other) {\r
+                if (q > other.q) { // reverse - to sort in descending order\r
+                    return -1;\r
+                } else if (q < other.q) {\r
+                    return 1;\r
+                }\r
+                if (serial < other.serial) {\r
+                    return -1;\r
+                } else if (serial > other.serial) {\r
+                    return 1;\r
+                } else {\r
+                    return 0; // same object\r
+                }\r
+            }\r
+        }\r
+\r
+        // parse out the acceptLanguage into an array\r
+        TreeMap<ULocaleAcceptLanguageQ, ULocale> map = \r
+            new TreeMap<ULocaleAcceptLanguageQ, ULocale>();\r
+        StringBuilder languageRangeBuf = new StringBuilder();\r
+        StringBuilder qvalBuf = new StringBuilder();\r
+        int state = 0;\r
+        acceptLanguage += ","; // append comma to simplify the parsing code\r
+        int n;\r
+        boolean subTag = false;\r
+        boolean q1 = false;\r
+        for (n = 0; n < acceptLanguage.length(); n++) {\r
+            boolean gotLanguageQ = false;\r
+            char c = acceptLanguage.charAt(n);\r
+            switch (state) {\r
+            case 0: // before language-range start\r
+                if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) {\r
+                    // in language-range\r
+                    languageRangeBuf.append(c);\r
+                    state = 1;\r
+                    subTag = false;\r
+                } else if (c == '*') {\r
+                    languageRangeBuf.append(c);\r
+                    state = 2;\r
+                } else if (c != ' ' && c != '\t') {\r
+                    // invalid character\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 1: // in language-range\r
+                if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) {\r
+                    languageRangeBuf.append(c);\r
+                } else if (c == '-') {\r
+                    subTag = true;\r
+                    languageRangeBuf.append(c);\r
+                } else if (c == '_') {\r
+                    if (isLenient) {\r
+                        subTag = true;\r
+                        languageRangeBuf.append(c);\r
+                    } else {\r
+                        state = -1;\r
+                    }\r
+                } else if ('0' <= c && c <= '9') {\r
+                    if (subTag) {\r
+                        languageRangeBuf.append(c);\r
+                    } else {\r
+                        // DIGIT is allowed only in language sub tag\r
+                        state = -1;\r
+                    }\r
+                } else if (c == ',') {\r
+                    // language-q end\r
+                    gotLanguageQ = true;\r
+                } else if (c == ' ' || c == '\t') {\r
+                    // language-range end\r
+                    state = 3;\r
+                } else if (c == ';') {\r
+                    // before q\r
+                    state = 4;\r
+                } else {\r
+                    // invalid character for language-range\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 2: // saw wild card range\r
+                if (c == ',') {\r
+                    // language-q end\r
+                    gotLanguageQ = true;\r
+                } else if (c == ' ' || c == '\t') {\r
+                    // language-range end\r
+                    state = 3;\r
+                } else if (c == ';') {\r
+                    // before q\r
+                    state = 4;\r
+                } else {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 3: // language-range end\r
+                if (c == ',') {\r
+                    // language-q end\r
+                    gotLanguageQ = true;\r
+                } else if (c == ';') {\r
+                    // before q\r
+                    state =4;\r
+                } else if (c != ' ' && c != '\t') {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 4: // before q\r
+                if (c == 'q') {\r
+                    // before equal\r
+                    state = 5;\r
+                } else if (c != ' ' && c != '\t') {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 5: // before equal\r
+                if (c == '=') {\r
+                    // before q value\r
+                    state = 6;\r
+                } else if (c != ' ' && c != '\t') {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 6: // before q value\r
+                if (c == '0') {\r
+                    // q value start with 0\r
+                    q1 = false;\r
+                    qvalBuf.append(c);\r
+                    state = 7;\r
+                } else if (c == '1') {\r
+                    // q value start with 1\r
+                    qvalBuf.append(c);\r
+                    state = 7;\r
+                } else if (c == '.') {\r
+                    if (isLenient) {\r
+                        qvalBuf.append(c);\r
+                        state = 8;\r
+                    } else {\r
+                        state = -1;\r
+                    }\r
+                } else if (c != ' ' && c != '\t') {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 7: // q value start\r
+                if (c == '.') {\r
+                    // before q value fraction part\r
+                    qvalBuf.append(c);\r
+                    state = 8;\r
+                } else if (c == ',') {\r
+                    // language-q end\r
+                    gotLanguageQ = true;\r
+                } else if (c == ' ' || c == '\t') {\r
+                    // after q value\r
+                    state = 10;\r
+                } else {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 8: // before q value fraction part\r
+                if ('0' <= c || c <= '9') {\r
+                    if (q1 && c != '0' && !isLenient) {\r
+                        // if q value starts with 1, the fraction part must be 0\r
+                        state = -1;\r
+                    } else {\r
+                        // in q value fraction part\r
+                        qvalBuf.append(c);\r
+                        state = 9;\r
+                    }\r
+                } else {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 9: // in q value fraction part\r
+                if ('0' <= c && c <= '9') {\r
+                    if (q1 && c != '0') {\r
+                        // if q value starts with 1, the fraction part must be 0\r
+                        state = -1;\r
+                    } else {\r
+                        qvalBuf.append(c);\r
+                    }\r
+                } else if (c == ',') {\r
+                    // language-q end\r
+                    gotLanguageQ = true;\r
+                } else if (c == ' ' || c == '\t') {\r
+                    // after q value\r
+                    state = 10;\r
+                } else {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            case 10: // after q value\r
+                if (c == ',') {\r
+                    // language-q end\r
+                    gotLanguageQ = true;\r
+                } else if (c != ' ' && c != '\t') {\r
+                    // invalid\r
+                    state = -1;\r
+                }\r
+                break;\r
+            }\r
+            if (state == -1) {\r
+                // error state\r
+                throw new ParseException("Invalid Accept-Language", n);\r
+            }\r
+            if (gotLanguageQ) {\r
+                double q = 1.0;\r
+                if (qvalBuf.length() != 0) {\r
+                    try {\r
+                        q = Double.parseDouble(qvalBuf.toString());\r
+                    } catch (NumberFormatException nfe) {\r
+                        // Already validated, so it should never happen\r
+                        q = 1.0;\r
+                    }\r
+                    if (q > 1.0) {\r
+                        q = 1.0;\r
+                    }\r
+                }\r
+                if (languageRangeBuf.charAt(0) != '*') {\r
+                    int serial = map.size();\r
+                    ULocaleAcceptLanguageQ entry = new ULocaleAcceptLanguageQ(q, serial);\r
+                    // sort in reverse order..   1.0, 0.9, 0.8 .. etc\r
+                    map.put(entry, new ULocale(canonicalize(languageRangeBuf.toString())));\r
+                }\r
+\r
+                // reset buffer and parse state\r
+                languageRangeBuf.setLength(0);\r
+                qvalBuf.setLength(0);\r
+                state = 0;\r
+            }\r
+        }\r
+        if (state != 0) {\r
+            // Well, the parser should handle all cases.  So just in case.\r
+            throw new ParseException("Invalid AcceptlLanguage", n);\r
+        }\r
+\r
+        // pull out the map\r
+        ULocale acceptList[] = map.values().toArray(new ULocale[map.size()]);\r
+        return acceptList;\r
+    }\r
+\r
+    /**\r
+     * {@icu} Adds the likely subtags for a provided locale ID, per the algorithm\r
+     * described in the following CLDR technical report:\r
+     *\r
+     *   http://www.unicode.org/reports/tr35/#Likely_Subtags\r
+     *\r
+     * If the provided ULocale instance is already in the maximal form, or there is no\r
+     * data available available for maximization, it will be returned.  For example,\r
+     * "und-Zzzz" cannot be maximized, since there is no reasonable maximization.\r
+     * Otherwise, a new ULocale instance with the maximal form is returned.\r
+     *\r
+     * Examples:\r
+     *\r
+     * "en" maximizes to "en_Latn_US"\r
+     *\r
+     * "de" maximizes to "de_Latn_US"\r
+     *\r
+     * "sr" maximizes to "sr_Cyrl_RS"\r
+     *\r
+     * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)\r
+     *\r
+     * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)\r
+     *\r
+     * @param loc The ULocale to maximize\r
+     * @return The maximized ULocale instance.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static ULocale addLikelySubtags(ULocale loc) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Minimizes the subtags for a provided locale ID, per the algorithm described\r
+     * in the following CLDR technical report:<blockquote>\r
+     *\r
+     *   <a href="http://www.unicode.org/reports/tr35/#Likely_Subtags"\r
+     *>http://www.unicode.org/reports/tr35/#Likely_Subtags</a></blockquote>\r
+     *\r
+     * If the provided ULocale instance is already in the minimal form, or there\r
+     * is no data available for minimization, it will be returned.  Since the\r
+     * minimization algorithm relies on proper maximization, see the comments\r
+     * for addLikelySubtags for reasons why there might not be any data.\r
+     *\r
+     * Examples:<pre>\r
+     *\r
+     * "en_Latn_US" minimizes to "en"\r
+     *\r
+     * "de_Latn_US" minimizes to "de"\r
+     *\r
+     * "sr_Cyrl_RS" minimizes to "sr"\r
+     *\r
+     * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the\r
+     * script, and minimizing to "zh" would imply "zh_Hans_CN".) </pre>\r
+     *\r
+     * @param loc The ULocale to minimize\r
+     * @return The minimized ULocale instance.\r
+     * @stable ICU 4.0\r
+     */\r
+    public static ULocale minimizeSubtags(ULocale loc) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    // --------------------------------\r
+    //      BCP47/OpenJDK APIs\r
+    // --------------------------------\r
+\r
+    /**\r
+     * {@icu} The key for the private use locale extension ('x').\r
+     *\r
+     * @see #getExtension(char)\r
+     * @see Builder#setExtension(char, String)\r
+     *\r
+     * @draft ICU 4.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final char PRIVATE_USE_EXTENSION = 'x';\r
+\r
+    /**\r
+     * {@icu} The key for Unicode locale extension ('u').\r
+     *\r
+     * @see #getExtension(char)\r
+     * @see Builder#setExtension(char, String)\r
+     *\r
+     * @draft ICU 4.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final char UNICODE_LOCALE_EXTENSION = 'u';\r
+\r
+    /**\r
+     * {@icu} Returns the extension (or private use) value associated with\r
+     * the specified singleton key, or null if there is no extension\r
+     * associated with the key.  To be valid, the key must be one\r
+     * of <code>[0-9A-Za-z]</code>.  Keys are case-insensitive, so\r
+     * for example 'z' and 'Z' represent the same extension.\r
+     *\r
+     * @param key the extension key\r
+     * @return the extension, or null if this locale defines no\r
+     * extension for the specified key\r
+     * @throws IllegalArgumentException if the key is not valid\r
+     * @see #PRIVATE_USE_EXTENSION\r
+     * @see #UNICODE_LOCALE_EXTENSION\r
+     *\r
+     * @draft ICU 4.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public String getExtension(char key) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the set of extension keys associated with this locale, or the\r
+     * empty set if it has no extensions.  The returned set is unmodifiable.\r
+     *\r
+     * @return the set of extension keys, or the empty set if this locale has\r
+     * no extensions\r
+     *\r
+     * @draft ICU 4.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public Set<Character> getExtensionKeys() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the Unicode locale type associated with the specified Unicode\r
+     * locale key for this locale.  Unicode locale keywrods are specified\r
+     * by the 'u' extension and consist of key/type pairs.  The key must be\r
+     * two alphanumeric characters in length, or an IllegalArgumentException\r
+     * is thrown.\r
+     * @param key the Unicode locale key\r
+     * @return the Unicode locale type associated with the key, or null if the\r
+     * locale does not define a value for the key.\r
+     * @throws IllegalArgumentException if the key is not valid.\r
+     *\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public String getUnicodeLocaleType(String key) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns the set of keys for Unicode locale keywords defined by this locale,\r
+     * or null if this locale has no locale extension.  The returned set is\r
+     * immutable.\r
+     *\r
+     * @return the set of the Unicode locale keys, or null\r
+     *\r
+     * @draft ICU 4.4\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public Set<String> getUnicodeLocaleKeys() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a well-formed IETF BCP 47 language tag representing\r
+     * this locale.\r
+     *\r
+     * <p>\r
+     * If this <code>ULocale</code> object has language, country, or variant\r
+     * that does not satisfy the IETF BCP 47 language tag syntax requirements,\r
+     * this method handles these fields as described below:\r
+     * <p>\r
+     * <b>Language:</b> If language is empty or ill-formed (for example "a" or "e2"),\r
+     * it will be emitted as "und" (Undetermined).\r
+     * <p>\r
+     * <b>Country:</b> If country is ill-formed (for example "12" or "USA"), it\r
+     * will be omitted.\r
+     * <p>\r
+     * <b>Variant:</b> Variant is treated as consisting of subtags separated by\r
+     * underscore and converted to lower case letters.  'Well-formed' subtags\r
+     * consist of either an ASCII letter followed by 4-7 ASCII characters, or an\r
+     * ASCII digit followed by 3-7 ASCII characters.  If well-formed, the variant\r
+     * is emitted as each subtag in order (separated by hyphen).  Otherwise:\r
+     * <ul>\r
+     * <li>if all sub-segments consist of 1 to 8 ASCII alphanumerics (for example\r
+     * "WIN", "WINDOWS_XP", "SOLARIS_10"), the first ill-formed variant subtag\r
+     * and all following sub-segments will be emitted as private use subtags prefixed\r
+     * by the special private use subtag "variant" followed by each subtag in order\r
+     * (separated by hyphen).  For example, locale "en_US_WIN" is converted to language\r
+     * tag "en-US-x-variant-win", locale "de_WINDOWS_XP" is converted to language tag\r
+     * "de-windows-x-variant-xp".  If this locale has a private use extension value,\r
+     * the special private use subtags prefixed by "variant" are appended after the\r
+     * locale's private use value.\r
+     * <li>if any subtag does not consist of 1 to 8 ASCII alphanumerics, the\r
+     * variant will be truncated and the problematic subtag and all following\r
+     * sub-segments will be omitted.  If the remainder is non-empty, it will be\r
+     * emitted as a private use subtag as above (even if the remainder turns out\r
+     * to be well-formed).  For example, "Solaris_isjustthecoolestthing" is emitted\r
+     * as "x-jvariant-Solaris", not as "solaris".</li>\r
+     * </ul>\r
+     *\r
+     * <p><b>Note:</b> Although the language tag created by this method\r
+     * satisfies the syntax requirements defined by the IETF BCP 47\r
+     * specification, it is not always a valid BCP 47 language tag.\r
+     * For example,\r
+     * <pre>\r
+     *   new ULocale("xx_YY").toLanguageTag();\r
+     * </pre>\r
+     * will return "xx-YY", but the language subtag "xx" and the region subtag "YY"\r
+     * are invalid because they are not registered in the\r
+     * <a href="http://www.iana.org/assignments/language-subtag-registry">\r
+     * IANA Language Subtag Registry</a>.\r
+     *\r
+     * @return a BCP47 language tag representing the locale\r
+     * @see #forLanguageTag(String)\r
+     *\r
+     * @draft ICU 4.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public String toLanguageTag() {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+    /**\r
+     * {@icu} Returns a locale for the specified IETF BCP 47 language tag string.\r
+     * If the specified language tag contains any ill-formed subtags,\r
+     * the first such subtag and all following subtags are ignored.\r
+     *\r
+     * <p>This implements the 'Language-Tag' production of BCP47, and\r
+     * so supports grandfathered (regular and irregular) as well as\r
+     * private use language tags.  Stand alone private use tags are\r
+     * represented as empty language and extension 'x-whatever',\r
+     * and grandfathered tags are converted to their canonical replacements\r
+     * where they exist.  Note that a few grandfathered tags have no\r
+     * modern replacement; these will be converted using the fallback\r
+     * described above so some information might be lost.\r
+     *\r
+     * <p>For a list of grandfathered tags, see the\r
+     * <a href="http://www.iana.org/assignments/language-subtag-registry">\r
+     * IANA Language Subtag Registry</a>.\r
+     *\r
+     * <p><b>Notes:</b> This method converts private use subtags prefixed\r
+     * by "variant" to variant field in the result locale.  For example,\r
+     * the code below will return "POSIX".\r
+     * <pre>\r
+     *   ULocale.forLanguageTag("en-US-x-variant-posix).getVariant();\r
+     * </pre>\r
+     *\r
+     * @param languageTag the language tag\r
+     * @return the locale that best represents the language tag\r
+     * @exception NullPointerException if <code>languageTag</code> is <code>null</code>\r
+     * @see #toLanguageTag()\r
+     *\r
+     * @draft ICU 4.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static ULocale forLanguageTag(String languageTag) {\r
+        throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+    }\r
+\r
+\r
+    /**\r
+     * <code>Builder</code> is used to build instances of <code>ULocale</code>\r
+     * from values configured by the setter.  Unlike the <code>ULocale</code>\r
+     * constructors, the <code>Builder</code> checks if a value configured by a\r
+     * setter satisfies the syntactical requirements defined by the <code>ULocale</code>\r
+     * class.  A <code>ULocale</code> object created by a <code>Builder</code> is\r
+     * well-formed and can be transformed to a well-formed IETF BCP 47 language tag\r
+     * without losing information.\r
+     *\r
+     * <p>\r
+     * <b>Note:</b> The <code>ULocale</code> class does not provide\r
+     * any syntactical restrictions on variant, while BCP 47\r
+     * requires each variant subtag to be 5 to 8 alphanumeric letters or a single\r
+     * numeric letter followed by 3 alphanumeric letters.  By default,\r
+     * the <code>setVariant</code> method throws <code>IllformedLocaleException</code>\r
+     * for a variant that does not satisfy the syntax above.  If it is\r
+     * necessary to support such a variant, you could use the constructor <code>\r
+     * Builder(boolean isLenientVariant)</code> passing <code>true</code> to\r
+     * skip the syntax validation for variant.  However, you should keep in\r
+     * mind that a <code>Locale</code> object created this way might lose\r
+     * the variant information when transformed to a BCP 47 language tag.\r
+     *\r
+     * <p>\r
+     * The following example shows how to create a <code>ULocale</code> object\r
+     * with the <code>Builder</code>.\r
+     * <blockquote>\r
+     * <pre>\r
+     *     ULocale aLocale = new Builder().setLanguage("sr").setScript("Latn").setRegion("RS").build();\r
+     * </pre>\r
+     * </blockquote>\r
+     *\r
+     * <p>Builders can be reused; <code>clear()</code> resets all\r
+     * fields to their default values.\r
+     *\r
+     * @see ULocale#toLanguageTag()\r
+     *\r
+     * @draft ICU 4.2\r
+     * @provisional This API might change or be removed in a future release.\r
+     */\r
+    public static final class Builder {\r
+\r
+        /**\r
+         * Constructs an empty Builder. The default value of all\r
+         * fields, extensions, and private use information is the\r
+         * empty string.\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder() {\r
+            throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Constructs an empty Builder with an option whether to allow\r
+         * <code>setVariant</code> to accept a value that does not\r
+         * conform to the IETF BCP 47 variant subtag's syntax requirements.\r
+         *\r
+         * @param isLenientVariant When true, this <code>Builder</code>\r
+         * will accept an ill-formed variant.\r
+         * @see #setVariant(String)\r
+         *\r
+         * @draft ICU 4.4\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder(boolean isLenientVariant) {\r
+            throw new UnsupportedOperationException("Constructor not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Returns true if this <code>Builder</code> accepts a value that does\r
+         * not conform to the IETF BCP 47 variant subtag's syntax requirements\r
+         * in <code>setVariant</code>\r
+         *\r
+         * @return true if this <code>Build</code> accepts an ill-formed variant.\r
+         *\r
+         * @draft ICU 4.4\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public boolean isLenientVariant() {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+\r
+        /**\r
+         * Resets the <code>Builder</code> to match the provided <code>locale</code>.\r
+         * The previous state of the builder is discarded.  Fields that do\r
+         * not conform to the <code>ULocale</code> class specification, for example,\r
+         * a single letter language, are ill-formed.\r
+         *\r
+         * @param locale the locale\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>locale</code> has\r
+         * any ill-formed fields.\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setLocale(ULocale locale) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Resets the builder to match the provided IETF BCP 47 language tag.\r
+         * The previous state of the builder is discarded.\r
+         *\r
+         * @param languageTag the language tag\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>languageTag</code> is ill-formed.\r
+         * @throws NullPointerException if <code>languageTag</code> is null.\r
+         * @see ULocale#forLanguageTag(String)\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setLanguageTag(String languageTag) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Sets the language.  If <code>language</code> is the empty string,\r
+         * the language in this <code>Builder</code> will be removed.\r
+         * Typical language value is a two or three-letter language\r
+         * code as defined in ISO639.\r
+         * Well-formed values are any string of two to eight alpha\r
+         * letters.  This method accepts upper case alpha letters\r
+         * [A-Z], but the language value in the <code>ULocale</code>\r
+         * created by the <code>Builder</code> is always normalized\r
+         * to lower case letters.\r
+         *\r
+         * @param language the language\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>language</code> is ill-formed\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setLanguage(String language) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Sets the script.  If <code>script</code> is the empty string,\r
+         * the script in this <code>Builder</code> is removed.\r
+         * Typical script value is a four-letter script code as defined by ISO 15924.\r
+         * Well-formed values are any string of four alpha letters.\r
+         * This method accepts both upper and lower case alpha letters [a-zA-Z],\r
+         * but the script value in the <code>ULocale</code> created by the\r
+         * <code>Builder</code> is always normalized to title case\r
+         * (the first letter is upper case and the rest of letters are lower case).\r
+         *\r
+         * @param script the script\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>script</code> is ill-formed\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setScript(String script) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Sets the region.  If region is the empty string, the region\r
+         * in this <code>Builder</code> is removed.\r
+         * Typical region value is a two-letter ISO 3166 code or a three-digit UN M.49\r
+         * area code.  Well-formed values are any two-letter or three-digit string.\r
+         * This method accepts lower case letters [a-z], but the country value in\r
+         * the <code>ULocale</code> created by the <code>Builder</code> is always\r
+         * normalized to upper case.\r
+         *\r
+         * @param region the region\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>region</code> is ill-formed\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setRegion(String region) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Sets the variant.  If variant is the empty string, the\r
+         * variant in this <code>Builder</code> is removed.\r
+         * <p>\r
+         * <b>Note:</b> By default, this method checks if <code>variant</code>\r
+         * satisfies the IETF BCP 47 variant subtag's syntax requirements.\r
+         * However, the <code>ULocale</code> class itself does not impose any syntactical\r
+         * restriction on variant.  When a <code>Builder</code> is created by the\r
+         * constructor <code>Builder(boolean isLenientVariant)</code>\r
+         * with <code>true</code>, this method skips the syntax check.\r
+         *\r
+         * @param variant the variant\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>variant</code> is ill-formed\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setVariant(String variant) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Sets the extension for the given key. If the value is the\r
+         * empty string, the extension is removed. Legal keys are\r
+         * characters in the ranges <code>[0-9A-Za-z]</code>.  Keys\r
+         * are case-insensitive, so for example 'z' and 'Z' represent\r
+         * the same extension. In general, well-formed values are any\r
+         * series of fields of two to eight alphanumeric characters,\r
+         * separated by hyphen or underscore.\r
+         *\r
+         * <p><b>Note:</b> The key {@link ULocale#UNICODE_LOCALE_EXTENSION\r
+         * UNICODE_LOCALE_EXTENSION} ('u') is used for the Unicode locale extension.\r
+         * Setting a value for this key replaces any existing Unicode locale key/type\r
+         * pairs with those defined in the extension.\r
+         * To be well-formed, a value for this extension must meet the additional\r
+         * constraints that each locale key is two alphanumeric characters,\r
+         * followed by at least one locale type subtag represented by\r
+         * three to eight alphanumeric characters, and that the keys and types\r
+         * be legal Unicode locale keys and values.\r
+         *\r
+         * <p><b>Note:</b> The key {@link ULocale#PRIVATE_USE_EXTENSION\r
+         * PRIVATE_USE_EXTENSION} ('x') is used for the private use code. To be\r
+         * well-formed, the value for this key needs only to have fields of one to\r
+         * eight alphanumeric characters, not two to eight as in the general case.\r
+         *\r
+         * @param key the extension key\r
+         * @param value the extension value\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>key</code> is illegal\r
+         * or <code>value</code> is ill-formed\r
+         * @see #setUnicodeLocaleKeyword(String, String)\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setExtension(char key, String value) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Sets the Unicode locale keyword type for the given key.  If the\r
+         * value is the empty string, the Unicode keyword is removed.\r
+         * Well-formed keys are strings of two alphanumeric characters.\r
+         * Well-formed types are one or more subtags where each of them is\r
+         * three to eight alphanumeric characters.\r
+         * <p>\r
+         * <b>Note</b>:Setting the 'u' extension replaces all Unicode locale\r
+         * keywords with those defined in the extension.\r
+         * @param key the Unicode locale key\r
+         * @param type the Unicode locale type\r
+         * @return this builder\r
+         * @throws IllformedLocaleException if <code>key</code> or <code>type</code>\r
+         * is ill-formed\r
+         * @see #setExtension(char, String)\r
+         *\r
+         * @draft ICU 4.4\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder setUnicodeLocaleKeyword(String key, String type) {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Resets the builder to its initial, empty state.\r
+         *\r
+         * @return this builder\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder clear() {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Resets the extensions to their initial, empty state.\r
+         * Language, script, region and variant are unchanged.\r
+         *\r
+         * @return this builder\r
+         * @see #setExtension(char, String)\r
+         *\r
+         * @draft ICU 4.2\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public Builder clearExtensions() {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+\r
+        /**\r
+         * Returns an instance of Locale created from the fields set\r
+         * on this builder.\r
+         *\r
+         * @return a new Locale\r
+         *\r
+         * @draft ICU 4.4\r
+         * @provisional This API might change or be removed in a future release.\r
+         */\r
+        public ULocale build() {\r
+            throw new UnsupportedOperationException("Method not supported by com.ibm.icu.base");\r
+        }\r
+    }\r
+}\r
diff --git a/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/VersionInfo.java b/eclipse-build/plugins.template/com.ibm.icu.base/src/com/ibm/icu/util/VersionInfo.java
new file mode 100644 (file)
index 0000000..0bac81d
--- /dev/null
@@ -0,0 +1,14 @@
+/*\r
+ *******************************************************************************\r
+ * Copyright (C) 2011, International Business Machines Corporation and         *\r
+ * others. All Rights Reserved.                                                *\r
+ *******************************************************************************\r
+ */\r
+package com.ibm.icu.util;\r
+\r
+/*\r
+ * Empty stub\r
+ */\r
+public final class VersionInfo {\r
+    private VersionInfo() {}\r
+}\r