]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - jars/icu4j-4_2_1-src/src/com/ibm/icu/dev/test/collator/IndexCharactersTest.java
go
[Dictionary.git] / jars / icu4j-4_2_1-src / src / com / ibm / icu / dev / test / collator / IndexCharactersTest.java
old mode 100755 (executable)
new mode 100644 (file)
index 7443921..1714734
@@ -1,84 +1,84 @@
-//##header\r
-//#if defined(FOUNDATION10) || defined(J2SE13)\r
-//#else\r
-/*\r
- *******************************************************************************\r
- * Copyright (C) 2008-2009, International Business Machines Corporation and    *\r
- * others. All Rights Reserved.                                                *\r
- *******************************************************************************\r
- */\r
-package com.ibm.icu.dev.test.collator;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import com.ibm.icu.dev.test.TestFmwk;\r
-import com.ibm.icu.text.Collator;\r
-import com.ibm.icu.text.IndexCharacters;\r
-import com.ibm.icu.util.ULocale;\r
-\r
-/**\r
- * @author markdavis\r
- *\r
- */\r
-public class IndexCharactersTest extends TestFmwk {\r
-    public static void main(String[] args) throws Exception{\r
-        new IndexCharactersTest().run(args);\r
-    }\r
-\r
-    public void TestBasics() {\r
-        ULocale[] list = ULocale.getAvailableLocales();\r
-        // get keywords combinations\r
-        // don't bother with multiple combinations at this poin\r
-        List keywords = new ArrayList();\r
-        keywords.add("");\r
-\r
-        String[] collationValues = Collator.getKeywordValues("collation");\r
-        for (int j = 0; j < collationValues.length; ++j) {\r
-            keywords.add("@collation=" + collationValues[j]);\r
-        }\r
-        \r
-        for (int i = 0; i < list.length; ++i) {\r
-            for (Iterator it = keywords.iterator(); it.hasNext();) {\r
-                String collationValue = (String) it.next();\r
-                ULocale locale = new ULocale(list[i].toString() + collationValue);\r
-                if (collationValue.length() > 0 && !Collator.getFunctionalEquivalent("collation", locale).equals(locale)) {\r
-                    //logln("Skipping " + locale);\r
-                    continue;\r
-                }\r
-\r
-                if (locale.getCountry().length() != 0) {\r
-                    continue;\r
-                }\r
-                IndexCharacters indexCharacters = new IndexCharacters(locale);\r
-                final Collection mainChars = indexCharacters.getIndexCharacters();\r
-                String mainCharString = mainChars.toString();\r
-                if (mainCharString.length() > 500) {\r
-                    mainCharString = mainCharString.substring(0,500) + "...";\r
-                }\r
-                logln(mainChars.size() + "\t" + locale + "\t" + locale.getDisplayName(ULocale.ENGLISH));\r
-                logln("Index:\t" + mainCharString);\r
-                if (mainChars.size() > 100) {\r
-                    errln("Index character set too large");\r
-                }\r
-                showIfNotEmpty("A sequence sorting the same is already present", indexCharacters.getAlreadyIn());\r
-                showIfNotEmpty("A sequence sorts the same as components", indexCharacters.getNoDistinctSorting());\r
-                showIfNotEmpty("A sequence has only Marks or Nonalphabetics", indexCharacters.getNotAlphabetic());\r
-            }\r
-        }\r
-    }\r
-    private void showIfNotEmpty(String title, List alreadyIn) {\r
-        if (alreadyIn.size() != 0) {\r
-            logln("\t" + title + ":\t" + alreadyIn);\r
-        }\r
-    }\r
-    private void showIfNotEmpty(String title, Map alreadyIn) {\r
-        if (alreadyIn.size() != 0) {\r
-            logln("\t" + title + ":\t" + alreadyIn);\r
-        }\r
-    }\r
-}\r
-//#endif\r
+//##header J2SE15
+//#if defined(FOUNDATION10) || defined(J2SE13)
+//#else
+/*
+ *******************************************************************************
+ * Copyright (C) 2008-2009, International Business Machines Corporation and    *
+ * others. All Rights Reserved.                                                *
+ *******************************************************************************
+ */
+package com.ibm.icu.dev.test.collator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.ibm.icu.dev.test.TestFmwk;
+import com.ibm.icu.text.Collator;
+import com.ibm.icu.text.IndexCharacters;
+import com.ibm.icu.util.ULocale;
+
+/**
+ * @author markdavis
+ *
+ */
+public class IndexCharactersTest extends TestFmwk {
+    public static void main(String[] args) throws Exception{
+        new IndexCharactersTest().run(args);
+    }
+
+    public void TestBasics() {
+        ULocale[] list = ULocale.getAvailableLocales();
+        // get keywords combinations
+        // don't bother with multiple combinations at this poin
+        List keywords = new ArrayList();
+        keywords.add("");
+
+        String[] collationValues = Collator.getKeywordValues("collation");
+        for (int j = 0; j < collationValues.length; ++j) {
+            keywords.add("@collation=" + collationValues[j]);
+        }
+        
+        for (int i = 0; i < list.length; ++i) {
+            for (Iterator it = keywords.iterator(); it.hasNext();) {
+                String collationValue = (String) it.next();
+                ULocale locale = new ULocale(list[i].toString() + collationValue);
+                if (collationValue.length() > 0 && !Collator.getFunctionalEquivalent("collation", locale).equals(locale)) {
+                    //logln("Skipping " + locale);
+                    continue;
+                }
+
+                if (locale.getCountry().length() != 0) {
+                    continue;
+                }
+                IndexCharacters indexCharacters = new IndexCharacters(locale);
+                final Collection mainChars = indexCharacters.getIndexCharacters();
+                String mainCharString = mainChars.toString();
+                if (mainCharString.length() > 500) {
+                    mainCharString = mainCharString.substring(0,500) + "...";
+                }
+                logln(mainChars.size() + "\t" + locale + "\t" + locale.getDisplayName(ULocale.ENGLISH));
+                logln("Index:\t" + mainCharString);
+                if (mainChars.size() > 100) {
+                    errln("Index character set too large");
+                }
+                showIfNotEmpty("A sequence sorting the same is already present", indexCharacters.getAlreadyIn());
+                showIfNotEmpty("A sequence sorts the same as components", indexCharacters.getNoDistinctSorting());
+                showIfNotEmpty("A sequence has only Marks or Nonalphabetics", indexCharacters.getNotAlphabetic());
+            }
+        }
+    }
+    private void showIfNotEmpty(String title, List alreadyIn) {
+        if (alreadyIn.size() != 0) {
+            logln("\t" + title + ":\t" + alreadyIn);
+        }
+    }
+    private void showIfNotEmpty(String title, Map alreadyIn) {
+        if (alreadyIn.size() != 0) {
+            logln("\t" + title + ":\t" + alreadyIn);
+        }
+    }
+}
+//#endif