mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-7869 Escaped the unicode; moved hacks to the end of the file; some minor cleanup
X-SVN-Rev: 28529
This commit is contained in:
parent
804efbcf22
commit
8717b90914
2 changed files with 398 additions and 416 deletions
|
@ -108,6 +108,8 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
|
|||
*/
|
||||
static final boolean HACK_CODED_FIRSTS = true;
|
||||
|
||||
private static UnicodeSet UNIHAN = new UnicodeSet("[:script=Hani:]");
|
||||
|
||||
private static final char CGJ = '\u034F';
|
||||
private static final UnicodeSet ALPHABETIC = new UnicodeSet("[[:alphabetic:]-[:mark:]]");
|
||||
private static final UnicodeSet HANGUL = new UnicodeSet(
|
||||
|
@ -116,7 +118,6 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
|
|||
private static final UnicodeSet CORE_LATIN = new UnicodeSet("[a-z]");
|
||||
|
||||
private final RuleBasedCollator comparator;
|
||||
private final List<String> firstScriptCharacters;
|
||||
|
||||
// for testing
|
||||
private final LinkedHashMap<String, Set<String>> alreadyIn = new LinkedHashMap<String, Set<String>>();
|
||||
|
@ -198,7 +199,6 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
|
|||
}
|
||||
comparator = collator != null ? (RuleBasedCollator) collator : (RuleBasedCollator) Collator.getInstance(locale);
|
||||
comparator.setStrength(Collator.PRIMARY);
|
||||
firstScriptCharacters = FIRST_CHARS_IN_SCRIPTS;
|
||||
addLabels(exemplarChars);
|
||||
}
|
||||
|
||||
|
@ -493,76 +493,6 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
|
|||
return this;
|
||||
}
|
||||
|
||||
private static UnicodeSet UNIHAN = new UnicodeSet("[:script=Hani:]");
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static CharSequence hackKey(CharSequence key, Comparator comparator) {
|
||||
if (!UNIHAN.contains(Character.codePointAt(key, 0))) {
|
||||
return null;
|
||||
}
|
||||
int index = Arrays.binarySearch(PINYIN_LOOKUP, key, comparator);
|
||||
if (index < 0) {
|
||||
index = -index - 2;
|
||||
}
|
||||
//if (true) return index + "";
|
||||
return "ābcdēfghjklmnōpqrstwxyz".substring(index, index + 1);
|
||||
}
|
||||
|
||||
private static String[] PINYIN_LOOKUP = {
|
||||
// "呵", // a
|
||||
// "㭭", // b
|
||||
// "䃰", // c
|
||||
// "㙮", // d
|
||||
// "䋪", // e
|
||||
// "发", // f
|
||||
// "旮", // g
|
||||
// "哈", // h
|
||||
// "㚻", // i = j
|
||||
// "㚻", // j
|
||||
// "䘔", // k
|
||||
// "㕇", // l
|
||||
// "呒", // m
|
||||
// "唔", // n
|
||||
// "喔", // o
|
||||
// "䔤", // p
|
||||
// "㠌", // q
|
||||
// "儿", // r
|
||||
// "仨", // s
|
||||
// "㯚", // t
|
||||
// "䨟", // u = w
|
||||
// "䨟", // v = w
|
||||
// "䨟", // w
|
||||
// "㓾", // x
|
||||
// "㝞", // y
|
||||
// "㞉", // z
|
||||
"", //A
|
||||
"八", //B
|
||||
"嚓", //C
|
||||
"咑", //D
|
||||
"妸", //E
|
||||
"发", //F
|
||||
"猤", //G
|
||||
"妎", //H
|
||||
"丌", //J
|
||||
"咔", //K
|
||||
"垃", //L
|
||||
"嘸", //M
|
||||
"拿", //N
|
||||
"噢", //O
|
||||
"妑", //P
|
||||
"七", //Q
|
||||
"呥", //R
|
||||
"仨", //S
|
||||
"他", //T
|
||||
"屲", //W
|
||||
"夕", //X
|
||||
"丫", //Y
|
||||
"帀", //Z
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the index.
|
||||
*
|
||||
|
@ -701,7 +631,8 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
|
|||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public String getOverflowComparisonString(String lowerLimit) {
|
||||
for (String s : firstScriptCharacters) {
|
||||
// TODO Use collator method instead of this hack
|
||||
for (String s : HACK_FIRST_CHARS_IN_SCRIPTS) {
|
||||
if (comparator.compare(s, lowerLimit) > 0) {
|
||||
return s;
|
||||
}
|
||||
|
@ -717,7 +648,7 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
|
|||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
public List<String> getFirstScriptCharacters() {
|
||||
return firstScriptCharacters;
|
||||
return HACK_FIRST_CHARS_IN_SCRIPTS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -761,307 +692,352 @@ public final class AlphabeticIndex<V> implements Iterable<Bucket<V>> {
|
|||
"[[:sc=Common:][:sc=inherited:][:script=Unknown:][:script=braille:]]").freeze();
|
||||
private static final UnicodeSet TO_TRY = new UnicodeSet("[:^nfcqc=no:]").removeAll(IGNORE_SCRIPTS).freeze();
|
||||
|
||||
private static final List<String> FIRST_CHARS_IN_SCRIPTS =
|
||||
HACK_CODED_FIRSTS ? Arrays.asList(new String[] { "a",
|
||||
"α", "ⲁ", "а", "ⰰ", "ა", "ա", "א", "𐤀", "ࠀ", "ء", "ܐ", "ހ", "ߊ", "ⴰ", "ሀ", "ॐ", "অ", "ੴ", "ૐ", "ଅ", "ௐ",
|
||||
"అ", "ಅ", "അ", "අ", "ꯀ", "ꠀ", "ꢂ", "𑂃", "ᮃ", "𐨀", "ก", "ກ", "ꪀ", "ཀ", "ᰀ", "ꡀ", "ᤀ", "ᜀ", "ᜠ", "ᝀ", "ᝠ",
|
||||
"ᨀ", "ꤰ", "ꤊ", "က", "ក", "ᥐ", "ᦀ", "ᨠ", "ꨀ", "ᬅ", "ꦄ", "ᢀ", "ᱚ", "Ꭰ", "ᐁ", "ᚁ", "ᚠ", "𐰀", "ꔀ", "ꚠ", "ᄀ",
|
||||
"ぁ", "ァ", "ㄅ", "ꀀ", "ꓸ", "𐊀", "𐊠", "𐤠", "𐌀", "𐌰", "𐐨", "𐑐", "𐒀", "𐀀", "𐠀", "𐩠", "𐬀", "𐡀",
|
||||
"𐭀", "𐭠", "𐎀", "𐎠", "𒀀", "𓀀", "一"})
|
||||
: firstStringsInScript((RuleBasedCollator) Collator
|
||||
.getInstance(ULocale.ROOT));
|
||||
// /**
|
||||
// * Returns a list of all the "First" characters of scripts, according to the collation, and sorted according to the
|
||||
// * collation.
|
||||
// *
|
||||
// * @param ruleBasedCollator
|
||||
// * TODO
|
||||
// * @param comparator
|
||||
// * @param lowerLimit
|
||||
// * @param testScript
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
//
|
||||
// private static List<String> firstStringsInScript(RuleBasedCollator ruleBasedCollator) {
|
||||
// String[] results = new String[UScript.CODE_LIMIT];
|
||||
// for (String current : TO_TRY) {
|
||||
// if (ruleBasedCollator.compare(current, "a") < 0) { // TODO fix; we only want "real" script characters, not
|
||||
// // symbols.
|
||||
// continue;
|
||||
// }
|
||||
// int script = UScript.getScript(current.codePointAt(0));
|
||||
// if (results[script] == null) {
|
||||
// results[script] = current;
|
||||
// } else if (ruleBasedCollator.compare(current, results[script]) < 0) {
|
||||
// results[script] = current;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// UnicodeSet extras = new UnicodeSet();
|
||||
// UnicodeSet expansions = new UnicodeSet();
|
||||
// ruleBasedCollator.getContractionsAndExpansions(extras, expansions, true);
|
||||
// extras.addAll(expansions).removeAll(TO_TRY);
|
||||
// if (extras.size() != 0) {
|
||||
// Normalizer2 normalizer = Normalizer2.getInstance(null, "nfkc", Mode.COMPOSE);
|
||||
// for (String current : extras) {
|
||||
// if (!TO_TRY.containsAll(current))
|
||||
// continue;
|
||||
// if (!normalizer.isNormalized(current) || ruleBasedCollator.compare(current, "a") < 0) {
|
||||
// continue;
|
||||
// }
|
||||
// int script = UScript.getScript(current.codePointAt(0));
|
||||
// if (results[script] == null) {
|
||||
// results[script] = current;
|
||||
// } else if (ruleBasedCollator.compare(current, results[script]) < 0) {
|
||||
// results[script] = current;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// } // why have a checked exception???
|
||||
//
|
||||
// TreeSet<String> sorted = new TreeSet<String>(ruleBasedCollator);
|
||||
// for (int i = 0; i < results.length; ++i) {
|
||||
// if (results[i] != null) {
|
||||
// sorted.add(results[i]);
|
||||
// }
|
||||
// }
|
||||
// if (true) {
|
||||
// for (String s : sorted) {
|
||||
// System.out.println("\"" + s + "\",");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<String> result = Collections.unmodifiableList(new ArrayList<String>(sorted));
|
||||
// return result;
|
||||
// }
|
||||
|
||||
private static final PreferenceComparator PREFERENCE_COMPARATOR = new PreferenceComparator();
|
||||
private int maxLabelCount = 99;
|
||||
|
||||
/**
|
||||
* Comparator that returns "better" strings first, where shorter NFKD is better, and otherwise NFKD binary order is
|
||||
* better, and otherwise binary order is better.
|
||||
*/
|
||||
private static class PreferenceComparator implements Comparator<Object> {
|
||||
static final Comparator<String> binary = new UTF16.StringComparator(true, false, 0);
|
||||
|
||||
public int compare(Object o1, Object o2) {
|
||||
return compare((String) o1, (String) o2);
|
||||
}
|
||||
|
||||
public int compare(String s1, String s2) {
|
||||
if (s1 == s2) {
|
||||
return 0;
|
||||
}
|
||||
String n1 = Normalizer.decompose(s1, true);
|
||||
String n2 = Normalizer.decompose(s2, true);
|
||||
int result = n1.length() - n2.length();
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
result = binary.compare(n1, n2);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
return binary.compare(s1, s2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A record to be sorted into buckets with getIndexBucketCharacters.
|
||||
*
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static class Record<V> {
|
||||
private CharSequence substitute;
|
||||
private CharSequence key;
|
||||
private V value;
|
||||
private int counter;
|
||||
|
||||
private Record(CharSequence key, V value, int counter) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all the "First" characters of scripts, according to the collation, and sorted according to the
|
||||
* collation.
|
||||
*
|
||||
* @param ruleBasedCollator
|
||||
* TODO
|
||||
* @param comparator
|
||||
* @param lowerLimit
|
||||
* @param testScript
|
||||
*
|
||||
* @param upperBoundary
|
||||
* @return
|
||||
*/
|
||||
|
||||
private static List<String> firstStringsInScript(RuleBasedCollator ruleBasedCollator) {
|
||||
String[] results = new String[UScript.CODE_LIMIT];
|
||||
for (String current : TO_TRY) {
|
||||
if (ruleBasedCollator.compare(current, "a") < 0) { // TODO fix; we only want "real" script characters, not
|
||||
// symbols.
|
||||
continue;
|
||||
}
|
||||
int script = UScript.getScript(current.codePointAt(0));
|
||||
if (results[script] == null) {
|
||||
results[script] = current;
|
||||
} else if (ruleBasedCollator.compare(current, results[script]) < 0) {
|
||||
results[script] = current;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
UnicodeSet extras = new UnicodeSet();
|
||||
UnicodeSet expansions = new UnicodeSet();
|
||||
ruleBasedCollator.getContractionsAndExpansions(extras, expansions, true);
|
||||
extras.addAll(expansions).removeAll(TO_TRY);
|
||||
if (extras.size() != 0) {
|
||||
Normalizer2 normalizer = Normalizer2.getInstance(null, "nfkc", Mode.COMPOSE);
|
||||
for (String current : extras) {
|
||||
if (!TO_TRY.containsAll(current))
|
||||
continue;
|
||||
if (!normalizer.isNormalized(current) || ruleBasedCollator.compare(current, "a") < 0) {
|
||||
continue;
|
||||
}
|
||||
int script = UScript.getScript(current.codePointAt(0));
|
||||
if (results[script] == null) {
|
||||
results[script] = current;
|
||||
} else if (ruleBasedCollator.compare(current, results[script]) < 0) {
|
||||
results[script] = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} // why have a checked exception???
|
||||
|
||||
TreeSet<String> sorted = new TreeSet<String>(ruleBasedCollator);
|
||||
for (int i = 0; i < results.length; ++i) {
|
||||
if (results[i] != null) {
|
||||
sorted.add(results[i]);
|
||||
}
|
||||
}
|
||||
if (true) {
|
||||
for (String s : sorted) {
|
||||
System.out.println("\"" + s + "\",");
|
||||
}
|
||||
}
|
||||
|
||||
List<String> result = Collections.unmodifiableList(new ArrayList<String>(sorted));
|
||||
return result;
|
||||
private boolean isGreater(Comparator comparator, String upperBoundary) {
|
||||
return comparator.compare(substitute == null ? key : substitute, upperBoundary) >= 0;
|
||||
}
|
||||
|
||||
private static final PreferenceComparator PREFERENCE_COMPARATOR = new PreferenceComparator();
|
||||
private int maxLabelCount = 99;
|
||||
|
||||
/**
|
||||
* Comparator that returns "better" strings first, where shorter NFKD is better, and otherwise NFKD binary order is
|
||||
* better, and otherwise binary order is better.
|
||||
* Get the key
|
||||
*
|
||||
* @return the key
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
private static class PreferenceComparator implements Comparator<Object> {
|
||||
static final Comparator<String> binary = new UTF16.StringComparator(true, false, 0);
|
||||
|
||||
public int compare(Object o1, Object o2) {
|
||||
return compare((String) o1, (String) o2);
|
||||
}
|
||||
|
||||
public int compare(String s1, String s2) {
|
||||
if (s1 == s2) {
|
||||
return 0;
|
||||
}
|
||||
String n1 = Normalizer.decompose(s1, true);
|
||||
String n2 = Normalizer.decompose(s2, true);
|
||||
int result = n1.length() - n2.length();
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
result = binary.compare(n1, n2);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
return binary.compare(s1, s2);
|
||||
}
|
||||
public CharSequence getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* A record to be sorted into buckets with getIndexBucketCharacters.
|
||||
* Get the value
|
||||
*
|
||||
* @return the value
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + "=" + value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A "bucket", containing records sorted under an index string by getIndexBucketCharacters. Is created by the
|
||||
* addBucket method in BucketList. A typical implementation will provide methods getLabel(), getSpecial(), and
|
||||
* getValues().<br>
|
||||
* See com.ibm.icu.dev.test.collator.IndexCharactersTest for an example.
|
||||
*
|
||||
* @param <V>
|
||||
* Value type
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static class Bucket<V> implements Iterable<Record<V>> {
|
||||
private final String label;
|
||||
private final String lowerBoundary;
|
||||
private final LabelType labelType;
|
||||
private final List<Record<V>> values = new ArrayList<Record<V>>();
|
||||
|
||||
/**
|
||||
* Type of the label
|
||||
*
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static class Record<V> {
|
||||
private CharSequence substitute;
|
||||
private CharSequence key;
|
||||
private V value;
|
||||
private int counter;
|
||||
|
||||
private Record(CharSequence key, V value, int counter) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.counter = counter;
|
||||
this.substitute = substitute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param upperBoundary
|
||||
* @return
|
||||
*/
|
||||
public boolean isGreater(Comparator comparator, String upperBoundary) {
|
||||
return comparator.compare(substitute == null ? key : substitute, upperBoundary) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the key
|
||||
*
|
||||
* @return the key
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public CharSequence getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value
|
||||
*
|
||||
* @return the value
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + "=" + value;
|
||||
}
|
||||
public enum LabelType {
|
||||
NORMAL, UNDERFLOW, INFLOW, OVERFLOW
|
||||
}
|
||||
|
||||
/**
|
||||
* A "bucket", containing records sorted under an index string by getIndexBucketCharacters. Is created by the
|
||||
* addBucket method in BucketList. A typical implementation will provide methods getLabel(), getSpecial(), and
|
||||
* getValues().<br>
|
||||
* See com.ibm.icu.dev.test.collator.IndexCharactersTest for an example.
|
||||
* Set up the bucket.
|
||||
*
|
||||
* @param <V>
|
||||
* Value type
|
||||
* @param label
|
||||
* label for the bucket
|
||||
* @param labelType
|
||||
* is an underflow, overflow, or inflow bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static class Bucket<V> implements Iterable<Record<V>> {
|
||||
private final String label;
|
||||
private final String lowerBoundary;
|
||||
private final LabelType labelType;
|
||||
private final List<Record<V>> values = new ArrayList<Record<V>>();
|
||||
|
||||
/**
|
||||
* Type of the label
|
||||
*
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public enum LabelType {
|
||||
NORMAL, UNDERFLOW, INFLOW, OVERFLOW
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the bucket.
|
||||
*
|
||||
* @param label
|
||||
* label for the bucket
|
||||
* @param labelType
|
||||
* is an underflow, overflow, or inflow bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
private Bucket(String label, String lowerBoundary, LabelType labelType) {
|
||||
this.label = label;
|
||||
this.lowerBoundary = lowerBoundary;
|
||||
this.labelType = labelType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the label
|
||||
*
|
||||
* @return label for the bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a normal, underflow, overflow, or inflow bucket
|
||||
*
|
||||
* @return is an underflow, overflow, or inflow bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public LabelType getLabelType() {
|
||||
return labelType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of records in the bucket.
|
||||
*
|
||||
* @return number of records in bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public int size() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterator over the records in the bucket
|
||||
*/
|
||||
public Iterator<Record<V>> iterator() {
|
||||
return values.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
"labelType=" + labelType
|
||||
+ ", " +
|
||||
"lowerBoundary=" + lowerBoundary
|
||||
+ ", " +
|
||||
"label=" + label
|
||||
+ "}"
|
||||
;
|
||||
}
|
||||
private Bucket(String label, String lowerBoundary, LabelType labelType) {
|
||||
this.label = label;
|
||||
this.lowerBoundary = lowerBoundary;
|
||||
this.labelType = labelType;
|
||||
}
|
||||
|
||||
private class BucketList implements Iterable<Bucket<V>> {
|
||||
private ArrayList<Bucket<V>> bucketList = new ArrayList<Bucket<V>>();
|
||||
/**
|
||||
* Get the label
|
||||
*
|
||||
* @return label for the bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
BucketList() {
|
||||
// initialize indexCharacters;
|
||||
getLabels();
|
||||
/**
|
||||
* Is a normal, underflow, overflow, or inflow bucket
|
||||
*
|
||||
* @return is an underflow, overflow, or inflow bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public LabelType getLabelType() {
|
||||
return labelType;
|
||||
}
|
||||
|
||||
bucketList.add(new Bucket<V>(getUnderflowLabel(), "", Bucket.LabelType.UNDERFLOW));
|
||||
/**
|
||||
* Get the number of records in the bucket.
|
||||
*
|
||||
* @return number of records in bucket
|
||||
* @draft ICU 4.6
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public int size() {
|
||||
return values.size();
|
||||
}
|
||||
|
||||
// fix up the list, adding underflow, additions, overflow
|
||||
// insert infix labels as needed, using \uFFFF.
|
||||
String last = indexCharacters.get(0);
|
||||
bucketList.add(new Bucket<V>(last, last, Bucket.LabelType.NORMAL));
|
||||
UnicodeSet lastSet = getScriptSet(last).removeAll(IGNORE_SCRIPTS);
|
||||
/**
|
||||
* Iterator over the records in the bucket
|
||||
*/
|
||||
public Iterator<Record<V>> iterator() {
|
||||
return values.iterator();
|
||||
}
|
||||
|
||||
for (int i = 1; i < indexCharacters.size(); ++i) {
|
||||
String current = indexCharacters.get(i);
|
||||
UnicodeSet set = getScriptSet(current).removeAll(IGNORE_SCRIPTS);
|
||||
if (lastSet.containsNone(set)) {
|
||||
// check for adjacent
|
||||
String overflowComparisonString = getOverflowComparisonString(last);
|
||||
if (comparator.compare(overflowComparisonString, current) < 0) {
|
||||
bucketList.add(new Bucket<V>(getInflowLabel(), overflowComparisonString,
|
||||
Bucket.LabelType.INFLOW));
|
||||
i++;
|
||||
lastSet = set;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" +
|
||||
"labelType=" + labelType
|
||||
+ ", " +
|
||||
"lowerBoundary=" + lowerBoundary
|
||||
+ ", " +
|
||||
"label=" + label
|
||||
+ "}"
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
private class BucketList implements Iterable<Bucket<V>> {
|
||||
private ArrayList<Bucket<V>> bucketList = new ArrayList<Bucket<V>>();
|
||||
|
||||
BucketList() {
|
||||
// initialize indexCharacters;
|
||||
getLabels();
|
||||
|
||||
bucketList.add(new Bucket<V>(getUnderflowLabel(), "", Bucket.LabelType.UNDERFLOW));
|
||||
|
||||
// fix up the list, adding underflow, additions, overflow
|
||||
// insert infix labels as needed, using \uFFFF.
|
||||
String last = indexCharacters.get(0);
|
||||
bucketList.add(new Bucket<V>(last, last, Bucket.LabelType.NORMAL));
|
||||
UnicodeSet lastSet = getScriptSet(last).removeAll(IGNORE_SCRIPTS);
|
||||
|
||||
for (int i = 1; i < indexCharacters.size(); ++i) {
|
||||
String current = indexCharacters.get(i);
|
||||
UnicodeSet set = getScriptSet(current).removeAll(IGNORE_SCRIPTS);
|
||||
if (lastSet.containsNone(set)) {
|
||||
// check for adjacent
|
||||
String overflowComparisonString = getOverflowComparisonString(last);
|
||||
if (comparator.compare(overflowComparisonString, current) < 0) {
|
||||
bucketList.add(new Bucket<V>(getInflowLabel(), overflowComparisonString,
|
||||
Bucket.LabelType.INFLOW));
|
||||
i++;
|
||||
lastSet = set;
|
||||
}
|
||||
bucketList.add(new Bucket<V>(current, current, Bucket.LabelType.NORMAL));
|
||||
last = current;
|
||||
lastSet = set;
|
||||
}
|
||||
String limitString = getOverflowComparisonString(last);
|
||||
bucketList.add(new Bucket<V>(getOverflowLabel(), limitString, Bucket.LabelType.OVERFLOW)); // final,
|
||||
// overflow
|
||||
// bucket
|
||||
}
|
||||
|
||||
public Iterator<Bucket<V>> iterator() {
|
||||
return bucketList.iterator();
|
||||
bucketList.add(new Bucket<V>(current, current, Bucket.LabelType.NORMAL));
|
||||
last = current;
|
||||
lastSet = set;
|
||||
}
|
||||
String limitString = getOverflowComparisonString(last);
|
||||
bucketList.add(new Bucket<V>(getOverflowLabel(), limitString, Bucket.LabelType.OVERFLOW)); // final,
|
||||
// overflow
|
||||
// bucket
|
||||
}
|
||||
|
||||
public Iterator<Bucket<V>> iterator() {
|
||||
return bucketList.iterator();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HACKS
|
||||
*/
|
||||
private static CharSequence hackKey(CharSequence key, Comparator comparator) {
|
||||
if (!UNIHAN.contains(Character.codePointAt(key, 0))) {
|
||||
return null;
|
||||
}
|
||||
int index = Arrays.binarySearch(HACK_PINYIN_LOOKUP, key, comparator);
|
||||
if (index < 0) {
|
||||
index = -index - 2;
|
||||
}
|
||||
//if (true) return index + "";
|
||||
return "ābcdēfghjklmnōpqrstwxyz".substring(index, index + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* HACKS
|
||||
*/
|
||||
private static String[] HACK_PINYIN_LOOKUP = {
|
||||
"", // A
|
||||
"\u516B", // B
|
||||
"\u5693", // C
|
||||
"\u5491", // D
|
||||
"\u59B8", // E
|
||||
"\u53D1", // F
|
||||
"\u7324", // G
|
||||
"\u598E", // H
|
||||
"\u4E0C", // J
|
||||
"\u5494", // K
|
||||
"\u5783", // L
|
||||
"\u5638", // M
|
||||
"\u62FF", // N
|
||||
"\u5662", // O
|
||||
"\u5991", // P
|
||||
"\u4E03", // Q
|
||||
"\u5465", // R
|
||||
"\u4EE8", // S
|
||||
"\u4ED6", // T
|
||||
"\u5C72", // W
|
||||
"\u5915", // X
|
||||
"\u4E2B", // Y
|
||||
"\u5E00", // Z
|
||||
};
|
||||
|
||||
/**
|
||||
* HACKS
|
||||
*/
|
||||
private static final List<String> HACK_FIRST_CHARS_IN_SCRIPTS =
|
||||
Arrays.asList(new String[] {
|
||||
"a", "\u03B1", "\u2C81", "\u0430", "\u2C30", "\u10D0", "\u0561", "\u05D0", "\uD802\uDD00", "\u0800", "\u0621", "\u0710", "\u0780", "\u07CA", "\u2D30", "\u1200", "\u0950", "\u0985", "\u0A74", "\u0AD0", "\u0B05", "\u0BD0",
|
||||
"\u0C05", "\u0C85", "\u0D05", "\u0D85", "\uABC0", "\uA800", "\uA882", "\uD804\uDC83", "\u1B83", "\uD802\uDE00", "\u0E01", "\u0E81", "\uAA80", "\u0F40", "\u1C00", "\uA840", "\u1900", "\u1700", "\u1720", "\u1740", "\u1760",
|
||||
"\u1A00", "\uA930", "\uA90A", "\u1000", "\u1780", "\u1950", "\u1980", "\u1A20", "\uAA00", "\u1B05", "\uA984", "\u1880", "\u1C5A", "\u13A0", "\u1401", "\u1681", "\u16A0", "\uD803\uDC00", "\uA500", "\uA6A0", "\u1100",
|
||||
"\u3041", "\u30A1", "\u3105", "\uA000", "\uA4F8", "\uD800\uDE80", "\uD800\uDEA0", "\uD802\uDD20", "\uD800\uDF00", "\uD800\uDF30", "\uD801\uDC28", "\uD801\uDC50", "\uD801\uDC80", "\uD800\uDC00", "\uD802\uDC00", "\uD802\uDE60", "\uD802\uDF00", "\uD802\uDC40",
|
||||
"\uD802\uDF40", "\uD802\uDF60", "\uD800\uDF80", "\uD800\uDFA0", "\uD808\uDC00", "\uD80C\uDC00", "\u4E00"
|
||||
});
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -18,8 +17,8 @@ import java.util.Set;
|
|||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.lang.UProperty;
|
||||
import com.ibm.icu.lang.UScript;
|
||||
import com.ibm.icu.text.Collator;
|
||||
import com.ibm.icu.text.AlphabeticIndex;
|
||||
import com.ibm.icu.text.Collator;
|
||||
import com.ibm.icu.text.RuleBasedCollator;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
|
@ -175,18 +174,10 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
}
|
||||
|
||||
public void TestBuckets() {
|
||||
String[] test = { "$", "£", "12", "2",
|
||||
"Edgar", "edgar", "Abbot", "Effron", "Zach", "Effron", "Ƶ", "İstanbul", "Istanbul", "istanbul", "ıstanbul",
|
||||
"Þor", "Åberg", "Östlund",
|
||||
"Ἥρα", "Ἀθηνᾶ", "Ζεύς", "Ποσειδὣν", "Ἅιδης", "Δημήτηρ", "Ἑστιά",
|
||||
//"Ἀπόλλων", "Ἄρτεμις", "Ἑρμἣς", "Ἄρης", "Ἀφροδίτη", "Ἥφαιστος", "Διόνυσος",
|
||||
"斉藤", "佐藤", "鈴木", "高橋", "田中", "渡辺", "伊藤", "山本", "中村", "小林", "斎藤", "加藤",
|
||||
//"吉田", "山田", "佐々木", "山口", "松本", "井上", "木村", "林", "清水"
|
||||
};
|
||||
ULocale additionalLocale = ULocale.ENGLISH;
|
||||
|
||||
for (String[] pair : localeAndIndexCharactersLists) {
|
||||
checkBuckets(pair[0], test, additionalLocale, "E", "edgar", "Effron", "Effron");
|
||||
checkBuckets(pair[0], SimpleTests, additionalLocale, "E", "edgar", "Effron", "Effron");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +239,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
}
|
||||
|
||||
private void showIndexedItem(StringBuilder buffer, CharSequence key, Integer value) {
|
||||
buffer.append("\t " + key + "→" + value);
|
||||
buffer.append("\t " + key + "\u2192" + value);
|
||||
}
|
||||
|
||||
private void showLabelInList(StringBuilder buffer, String label) {
|
||||
|
@ -359,71 +350,86 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
}
|
||||
}
|
||||
public void TestZZZ() {
|
||||
// stub
|
||||
int x = 3;
|
||||
}
|
||||
|
||||
public void TestSimplified() {
|
||||
checkBuckets("zh", simplifiedNames, ULocale.ENGLISH, "W", "西");
|
||||
checkBuckets("zh", simplifiedNames, ULocale.ENGLISH, "W", "\u897f");
|
||||
}
|
||||
public void TestTraditional() {
|
||||
checkBuckets("zh_Hant", traditionalNames, ULocale.ENGLISH, "亟", "南門");
|
||||
checkBuckets("zh_Hant", traditionalNames, ULocale.ENGLISH, "\u4e9f", "\u5357\u9580");
|
||||
}
|
||||
|
||||
static final String[] hackPinyin = { "吖", "墺", "八", "b", "拔", "蔀", "嚓", "c", "礸", "鹾", "咑", "d", "迏", "陊", "妸", "e",
|
||||
"鋨", "荋", "发", "f", "醗", "馥", "猤", "g", "釓", "腂", "妎", "h", "鉿", "夻", "丌", "j", "枅", "鵘", "咔", "k", "開",
|
||||
"穒", "垃", "l", "拉", "鮥", "嘸", "m", "麻", "旀", "拿", "n", "肭", "桛", "噢", "o", "毮", "讴", "妑", "p", "耙", "谱",
|
||||
"七", "q", "恓", "罖", "呥", "r", "犪", "渃", "仨", "s", "钑", "鏁", "他", "t", "鉈", "柝", "屲", "w", "啘", "婺", "夕",
|
||||
"x", "吸", "殾", "丫", "y", "芽", "蕴", "帀", "z", "災", "尊"};
|
||||
|
||||
static final String[] simplifiedNames = { "Abbot", "Morton", "Zachary", "Williams", "赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "楮", "卫", "蒋", "沈",
|
||||
"韩", "杨", "朱", "秦", "尤", "许", "何", "吕", "施", "张", "孔", "曹", "严", "华", "金", "魏", "陶", "姜", "戚", "谢", "邹",
|
||||
"喻", "柏", "水", "窦", "章", "云", "苏", "潘", "葛", "奚", "范", "彭", "郎", "鲁", "韦", "昌", "马", "苗", "凤", "花", "方",
|
||||
"俞", "任", "袁", "柳", "酆", "鲍", "史", "唐", "费", "廉", "岑", "薛", "雷", "贺", "倪", "汤", "滕", "殷", "罗", "毕", "郝",
|
||||
"邬", "安", "常", "乐", "于", "时", "傅", "皮", "卞", "齐", "康", "伍", "余", "元", "卜", "顾", "孟", "平", "黄", "和", "穆",
|
||||
"萧", "尹", "姚", "邵", "湛", "汪", "祁", "毛", "禹", "狄", "米", "贝", "明", "臧", "计", "伏", "成", "戴", "谈", "宋", "茅",
|
||||
"庞", "熊", "纪", "舒", "屈", "项", "祝", "董", "梁", "杜", "阮", "蓝", "闽", "席", "季", "麻", "强", "贾", "路", "娄", "危",
|
||||
"江", "童", "颜", "郭", "梅", "盛", "林", "刁", "锺", "徐", "丘", "骆", "高", "夏", "蔡", "田", "樊", "胡", "凌", "霍", "虞",
|
||||
"万", "支", "柯", "昝", "管", "卢", "莫", "经", "房", "裘", "缪", "干", "解", "应", "宗", "丁", "宣", "贲", "邓", "郁", "单",
|
||||
"杭", "洪", "包", "诸", "左", "石", "崔", "吉", "钮", "龚", "程", "嵇", "邢", "滑", "裴", "陆", "荣", "翁", "荀", "羊", "於",
|
||||
"惠", "甄", "麹", "家", "封", "芮", "羿", "储", "靳", "汲", "邴", "糜", "松", "井", "段", "富", "巫", "乌", "焦", "巴", "弓",
|
||||
"牧", "隗", "山", "谷", "车", "侯", "宓", "蓬", "全", "郗", "班", "仰", "秋", "仲", "伊", "宫", "宁", "仇", "栾", "暴", "甘",
|
||||
"斜", "厉", "戎", "祖", "武", "符", "刘", "景", "詹", "束", "龙", "叶", "幸", "司", "韶", "郜", "黎", "蓟", "薄", "印", "宿",
|
||||
"白", "怀", "蒲", "邰", "从", "鄂", "索", "咸", "籍", "赖", "卓", "蔺", "屠", "蒙", "池", "乔", "阴", "郁", "胥", "能", "苍",
|
||||
"双", "闻", "莘", "党", "翟", "谭", "贡", "劳", "逄", "姬", "申", "扶", "堵", "冉", "宰", "郦", "雍", "郤", "璩", "桑", "桂",
|
||||
"濮", "牛", "寿", "通", "边", "扈", "燕", "冀", "郏", "浦", "尚", "农", "温", "别", "庄", "晏", "柴", "瞿", "阎", "充", "慕",
|
||||
"连", "茹", "习", "宦", "艾", "鱼", "容", "向", "古", "易", "慎", "戈", "廖", "庾", "终", "暨", "居", "衡", "步", "都", "耿",
|
||||
"满", "弘", "匡", "国", "文", "寇", "广", "禄", "阙", "东", "欧", "殳", "沃", "利", "蔚", "越", "夔", "隆", "师", "巩", "厍",
|
||||
"聂", "晁", "勾", "敖", "融", "冷", "訾", "辛", "阚", "那", "简", "饶", "空", "曾", "毋", "沙", "乜", "养", "鞠", "须", "丰",
|
||||
"巢", "关", "蒯", "相", "查", "后", "荆", "红", "游", "竺", "权", "逑", "盖", "益", "桓", "公", "万俟", "司马", "上官", "欧阳",
|
||||
"夏侯", "诸葛", "闻人", "东方", "赫连", "皇甫", "尉迟", "公羊", "澹台", "公冶", "宗政", "濮阳", "淳于", "单于", "太叔", "申屠", "公孙", "仲孙",
|
||||
"轩辕", "令狐", "锺离", "宇文", "长孙", "慕容", "鲜于", "闾丘", "司徒", "司空", "丌官", "司寇", "仉", "督", "子车", "颛孙", "端木", "巫马",
|
||||
"公西", "漆雕", "乐正", "壤驷", "公良", "拓拔", "夹谷", "宰父", "谷梁", "晋", "楚", "阎", "法", "汝", "鄢", "涂", "钦", "段干", "百里",
|
||||
"东郭", "南门", "呼延", "归", "海", "羊舌", "微生", "岳", "帅", "缑", "亢", "况", "后", "有", "琴", "梁丘", "左丘", "东门", "西门",
|
||||
"商", "牟", "佘", "佴", "伯", "赏", "南宫", "墨", "哈", "谯", "笪", "年", "爱", "阳", "佟" };
|
||||
static final String[] SimpleTests = { "$", "\u00a3", "12", "2",
|
||||
"Edgar", "edgar", "Abbot", "Effron", "Zach", "Effron", "\u01b5", "\u0130stanbul", "Istanbul", "istanbul", "\u0131stanbul",
|
||||
"\u00deor", "\u00c5berg", "\u00d6stlund",
|
||||
"\u1f2d\u03c1\u03b1", "\u1f08\u03b8\u03b7\u03bd\u1fb6", "\u0396\u03b5\u03cd\u03c2", "\u03a0\u03bf\u03c3\u03b5\u03b9\u03b4\u1f63\u03bd", "\u1f0d\u03b9\u03b4\u03b7\u03c2", "\u0394\u03b7\u03bc\u03ae\u03c4\u03b7\u03c1", "\u1f19\u03c3\u03c4\u03b9\u03ac",
|
||||
//"\u1f08\u03c0\u03cc\u03bb\u03bb\u03c9\u03bd", "\u1f0c\u03c1\u03c4\u03b5\u03bc\u03b9\u03c2", "\u1f19\u03c1\u03bc\u1f23\u03c2", "\u1f0c\u03c1\u03b7\u03c2", "\u1f08\u03c6\u03c1\u03bf\u03b4\u03af\u03c4\u03b7", "\u1f2d\u03c6\u03b1\u03b9\u03c3\u03c4\u03bf\u03c2", "\u0394\u03b9\u03cc\u03bd\u03c5\u03c3\u03bf\u03c2",
|
||||
"\u6589\u85e4", "\u4f50\u85e4", "\u9234\u6728", "\u9ad8\u6a4b", "\u7530\u4e2d", "\u6e21\u8fba", "\u4f0a\u85e4", "\u5c71\u672c", "\u4e2d\u6751", "\u5c0f\u6797", "\u658e\u85e4", "\u52a0\u85e4",
|
||||
//"\u5409\u7530", "\u5c71\u7530", "\u4f50\u3005\u6728", "\u5c71\u53e3", "\u677e\u672c", "\u4e95\u4e0a", "\u6728\u6751", "\u6797", "\u6e05\u6c34"
|
||||
};
|
||||
|
||||
static final String[] traditionalNames = { "Abbot", "Morton", "Zachary", "Williams", "趙", "錢", "孫", "李", "周", "吳", "鄭", "王", "馮", "陳", "楮", "衛", "蔣", "沈",
|
||||
"韓", "楊", "朱", "秦", "尤", "許", "何", "呂", "施", "張", "孔", "曹", "嚴", "華", "金", "魏", "陶", "姜", "戚", "謝", "鄒",
|
||||
"喻", "柏", "水", "竇", "章", "雲", "蘇", "潘", "葛", "奚", "範", "彭", "郎", "魯", "韋", "昌", "馬", "苗", "鳳", "花", "方",
|
||||
"俞", "任", "袁", "柳", "酆", "鮑", "史", "唐", "費", "廉", "岑", "薛", "雷", "賀", "倪", "湯", "滕", "殷", "羅", "畢", "郝",
|
||||
"鄔", "安", "常", "樂", "於", "時", "傅", "皮", "卞", "齊", "康", "伍", "餘", "元", "卜", "顧", "孟", "平", "黃", "和", "穆",
|
||||
"蕭", "尹", "姚", "邵", "湛", "汪", "祁", "毛", "禹", "狄", "米", "貝", "明", "臧", "計", "伏", "成", "戴", "談", "宋", "茅",
|
||||
"龐", "熊", "紀", "舒", "屈", "項", "祝", "董", "梁", "杜", "阮", "藍", "閩", "席", "季", "麻", "強", "賈", "路", "婁", "危",
|
||||
"江", "童", "顏", "郭", "梅", "盛", "林", "刁", "鍾", "徐", "丘", "駱", "高", "夏", "蔡", "田", "樊", "胡", "凌", "霍", "虞",
|
||||
"萬", "支", "柯", "昝", "管", "盧", "莫", "經", "房", "裘", "繆", "幹", "解", "應", "宗", "丁", "宣", "賁", "鄧", "鬱", "單",
|
||||
"杭", "洪", "包", "諸", "左", "石", "崔", "吉", "鈕", "龔", "程", "嵇", "邢", "滑", "裴", "陸", "榮", "翁", "荀", "羊", "於",
|
||||
"惠", "甄", "麴", "家", "封", "芮", "羿", "儲", "靳", "汲", "邴", "糜", "松", "井", "段", "富", "巫", "烏", "焦", "巴", "弓",
|
||||
"牧", "隗", "山", "谷", "車", "侯", "宓", "蓬", "全", "郗", "班", "仰", "秋", "仲", "伊", "宮", "寧", "仇", "欒", "暴", "甘",
|
||||
"斜", "厲", "戎", "祖", "武", "符", "劉", "景", "詹", "束", "龍", "葉", "幸", "司", "韶", "郜", "黎", "薊", "薄", "印", "宿",
|
||||
"白", "懷", "蒲", "邰", "從", "鄂", "索", "咸", "籍", "賴", "卓", "藺", "屠", "蒙", "池", "喬", "陰", "鬱", "胥", "能", "蒼",
|
||||
"雙", "聞", "莘", "黨", "翟", "譚", "貢", "勞", "逄", "姬", "申", "扶", "堵", "冉", "宰", "酈", "雍", "郤", "璩", "桑", "桂",
|
||||
"濮", "牛", "壽", "通", "邊", "扈", "燕", "冀", "郟", "浦", "尚", "農", "溫", "別", "莊", "晏", "柴", "瞿", "閻", "充", "慕",
|
||||
"連", "茹", "習", "宦", "艾", "魚", "容", "向", "古", "易", "慎", "戈", "廖", "庾", "終", "暨", "居", "衡", "步", "都", "耿",
|
||||
"滿", "弘", "匡", "國", "文", "寇", "廣", "祿", "闕", "東", "歐", "殳", "沃", "利", "蔚", "越", "夔", "隆", "師", "鞏", "厙",
|
||||
"聶", "晁", "勾", "敖", "融", "冷", "訾", "辛", "闞", "那", "簡", "饒", "空", "曾", "毋", "沙", "乜", "養", "鞠", "須", "豐",
|
||||
"巢", "關", "蒯", "相", "查", "後", "荊", "紅", "遊", "竺", "權", "逑", "蓋", "益", "桓", "公", "万俟", "司馬", "上官", "歐陽",
|
||||
"夏侯", "諸葛", "聞人", "東方", "赫連", "皇甫", "尉遲", "公羊", "澹台", "公冶", "宗政", "濮陽", "淳于", "單于", "太叔", "申屠", "公孫", "仲孫",
|
||||
"軒轅", "令狐", "鍾離", "宇文", "長孫", "慕容", "鮮于", "閭丘", "司徒", "司空", "丌官", "司寇", "仉", "督", "子車", "顓孫", "端木", "巫馬",
|
||||
"公西", "漆雕", "樂正", "壤駟", "公良", "拓拔", "夾谷", "宰父", "穀梁", "晉", "楚", "閻", "法", "汝", "鄢", "塗", "欽", "段干", "百里",
|
||||
"東郭", "南門", "呼延", "歸", "海", "羊舌", "微生", "岳", "帥", "緱", "亢", "況", "後", "有", "琴", "梁丘", "左丘", "東門", "西門",
|
||||
"商", "牟", "佘", "佴", "伯", "賞", "南宮", "墨", "哈", "譙", "笪", "年", "愛", "陽", "佟" };
|
||||
static final String[] hackPinyin = {
|
||||
"\u5416", "\u58ba", "\u516b", "b", "\u62d4", "\u8500", "\u5693", "c", "\u7938", "\u9e7e", "\u5491", "d", "\u8fcf", "\u964a", "\u59b8", "e",
|
||||
"\u92e8", "\u834b", "\u53d1", "f", "\u9197", "\u99a5", "\u7324", "g", "\u91d3", "\u8142", "\u598e", "h", "\u927f", "\u593b", "\u4e0c", "j", "\u6785", "\u9d58", "\u5494", "k", "\u958b",
|
||||
"\u7a52", "\u5783", "l", "\u62c9", "\u9ba5", "\u5638", "m", "\u9ebb", "\u65c0", "\u62ff", "n", "\u80ad", "\u685b", "\u5662", "o", "\u6bee", "\u8bb4", "\u5991", "p", "\u8019", "\u8c31",
|
||||
"\u4e03", "q", "\u6053", "\u7f56", "\u5465", "r", "\u72aa", "\u6e03", "\u4ee8", "s", "\u9491", "\u93c1", "\u4ed6", "t", "\u9248", "\u67dd", "\u5c72", "w", "\u5558", "\u5a7a", "\u5915",
|
||||
"x", "\u5438", "\u6bbe", "\u4e2b", "y", "\u82bd", "\u8574", "\u5e00", "z", "\u707d", "\u5c0a"
|
||||
};
|
||||
|
||||
static final String[] simplifiedNames = {
|
||||
"Abbot", "Morton", "Zachary", "Williams", "\u8d75", "\u94b1", "\u5b59", "\u674e", "\u5468", "\u5434", "\u90d1", "\u738b", "\u51af", "\u9648", "\u696e", "\u536b", "\u848b", "\u6c88",
|
||||
"\u97e9", "\u6768", "\u6731", "\u79e6", "\u5c24", "\u8bb8", "\u4f55", "\u5415", "\u65bd", "\u5f20", "\u5b54", "\u66f9", "\u4e25", "\u534e", "\u91d1", "\u9b4f", "\u9676", "\u59dc", "\u621a", "\u8c22", "\u90b9",
|
||||
"\u55bb", "\u67cf", "\u6c34", "\u7aa6", "\u7ae0", "\u4e91", "\u82cf", "\u6f58", "\u845b", "\u595a", "\u8303", "\u5f6d", "\u90ce", "\u9c81", "\u97e6", "\u660c", "\u9a6c", "\u82d7", "\u51e4", "\u82b1", "\u65b9",
|
||||
"\u4fde", "\u4efb", "\u8881", "\u67f3", "\u9146", "\u9c8d", "\u53f2", "\u5510", "\u8d39", "\u5ec9", "\u5c91", "\u859b", "\u96f7", "\u8d3a", "\u502a", "\u6c64", "\u6ed5", "\u6bb7", "\u7f57", "\u6bd5", "\u90dd",
|
||||
"\u90ac", "\u5b89", "\u5e38", "\u4e50", "\u4e8e", "\u65f6", "\u5085", "\u76ae", "\u535e", "\u9f50", "\u5eb7", "\u4f0d", "\u4f59", "\u5143", "\u535c", "\u987e", "\u5b5f", "\u5e73", "\u9ec4", "\u548c", "\u7a46",
|
||||
"\u8427", "\u5c39", "\u59da", "\u90b5", "\u6e5b", "\u6c6a", "\u7941", "\u6bdb", "\u79b9", "\u72c4", "\u7c73", "\u8d1d", "\u660e", "\u81e7", "\u8ba1", "\u4f0f", "\u6210", "\u6234", "\u8c08", "\u5b8b", "\u8305",
|
||||
"\u5e9e", "\u718a", "\u7eaa", "\u8212", "\u5c48", "\u9879", "\u795d", "\u8463", "\u6881", "\u675c", "\u962e", "\u84dd", "\u95fd", "\u5e2d", "\u5b63", "\u9ebb", "\u5f3a", "\u8d3e", "\u8def", "\u5a04", "\u5371",
|
||||
"\u6c5f", "\u7ae5", "\u989c", "\u90ed", "\u6885", "\u76db", "\u6797", "\u5201", "\u953a", "\u5f90", "\u4e18", "\u9a86", "\u9ad8", "\u590f", "\u8521", "\u7530", "\u6a0a", "\u80e1", "\u51cc", "\u970d", "\u865e",
|
||||
"\u4e07", "\u652f", "\u67ef", "\u661d", "\u7ba1", "\u5362", "\u83ab", "\u7ecf", "\u623f", "\u88d8", "\u7f2a", "\u5e72", "\u89e3", "\u5e94", "\u5b97", "\u4e01", "\u5ba3", "\u8d32", "\u9093", "\u90c1", "\u5355",
|
||||
"\u676d", "\u6d2a", "\u5305", "\u8bf8", "\u5de6", "\u77f3", "\u5d14", "\u5409", "\u94ae", "\u9f9a", "\u7a0b", "\u5d47", "\u90a2", "\u6ed1", "\u88f4", "\u9646", "\u8363", "\u7fc1", "\u8340", "\u7f8a", "\u65bc",
|
||||
"\u60e0", "\u7504", "\u9eb9", "\u5bb6", "\u5c01", "\u82ae", "\u7fbf", "\u50a8", "\u9773", "\u6c72", "\u90b4", "\u7cdc", "\u677e", "\u4e95", "\u6bb5", "\u5bcc", "\u5deb", "\u4e4c", "\u7126", "\u5df4", "\u5f13",
|
||||
"\u7267", "\u9697", "\u5c71", "\u8c37", "\u8f66", "\u4faf", "\u5b93", "\u84ec", "\u5168", "\u90d7", "\u73ed", "\u4ef0", "\u79cb", "\u4ef2", "\u4f0a", "\u5bab", "\u5b81", "\u4ec7", "\u683e", "\u66b4", "\u7518",
|
||||
"\u659c", "\u5389", "\u620e", "\u7956", "\u6b66", "\u7b26", "\u5218", "\u666f", "\u8a79", "\u675f", "\u9f99", "\u53f6", "\u5e78", "\u53f8", "\u97f6", "\u90dc", "\u9ece", "\u84df", "\u8584", "\u5370", "\u5bbf",
|
||||
"\u767d", "\u6000", "\u84b2", "\u90b0", "\u4ece", "\u9102", "\u7d22", "\u54b8", "\u7c4d", "\u8d56", "\u5353", "\u853a", "\u5c60", "\u8499", "\u6c60", "\u4e54", "\u9634", "\u90c1", "\u80e5", "\u80fd", "\u82cd",
|
||||
"\u53cc", "\u95fb", "\u8398", "\u515a", "\u7fdf", "\u8c2d", "\u8d21", "\u52b3", "\u9004", "\u59ec", "\u7533", "\u6276", "\u5835", "\u5189", "\u5bb0", "\u90e6", "\u96cd", "\u90e4", "\u74a9", "\u6851", "\u6842",
|
||||
"\u6fee", "\u725b", "\u5bff", "\u901a", "\u8fb9", "\u6248", "\u71d5", "\u5180", "\u90cf", "\u6d66", "\u5c1a", "\u519c", "\u6e29", "\u522b", "\u5e84", "\u664f", "\u67f4", "\u77bf", "\u960e", "\u5145", "\u6155",
|
||||
"\u8fde", "\u8339", "\u4e60", "\u5ba6", "\u827e", "\u9c7c", "\u5bb9", "\u5411", "\u53e4", "\u6613", "\u614e", "\u6208", "\u5ed6", "\u5ebe", "\u7ec8", "\u66a8", "\u5c45", "\u8861", "\u6b65", "\u90fd", "\u803f",
|
||||
"\u6ee1", "\u5f18", "\u5321", "\u56fd", "\u6587", "\u5bc7", "\u5e7f", "\u7984", "\u9619", "\u4e1c", "\u6b27", "\u6bb3", "\u6c83", "\u5229", "\u851a", "\u8d8a", "\u5914", "\u9686", "\u5e08", "\u5de9", "\u538d",
|
||||
"\u8042", "\u6641", "\u52fe", "\u6556", "\u878d", "\u51b7", "\u8a3e", "\u8f9b", "\u961a", "\u90a3", "\u7b80", "\u9976", "\u7a7a", "\u66fe", "\u6bcb", "\u6c99", "\u4e5c", "\u517b", "\u97a0", "\u987b", "\u4e30",
|
||||
"\u5de2", "\u5173", "\u84af", "\u76f8", "\u67e5", "\u540e", "\u8346", "\u7ea2", "\u6e38", "\u7afa", "\u6743", "\u9011", "\u76d6", "\u76ca", "\u6853", "\u516c", "\u4e07\u4fdf", "\u53f8\u9a6c", "\u4e0a\u5b98", "\u6b27\u9633",
|
||||
"\u590f\u4faf", "\u8bf8\u845b", "\u95fb\u4eba", "\u4e1c\u65b9", "\u8d6b\u8fde", "\u7687\u752b", "\u5c09\u8fdf", "\u516c\u7f8a", "\u6fb9\u53f0", "\u516c\u51b6", "\u5b97\u653f", "\u6fee\u9633", "\u6df3\u4e8e", "\u5355\u4e8e", "\u592a\u53d4", "\u7533\u5c60", "\u516c\u5b59", "\u4ef2\u5b59",
|
||||
"\u8f69\u8f95", "\u4ee4\u72d0", "\u953a\u79bb", "\u5b87\u6587", "\u957f\u5b59", "\u6155\u5bb9", "\u9c9c\u4e8e", "\u95fe\u4e18", "\u53f8\u5f92", "\u53f8\u7a7a", "\u4e0c\u5b98", "\u53f8\u5bc7", "\u4ec9", "\u7763", "\u5b50\u8f66", "\u989b\u5b59", "\u7aef\u6728", "\u5deb\u9a6c",
|
||||
"\u516c\u897f", "\u6f06\u96d5", "\u4e50\u6b63", "\u58e4\u9a77", "\u516c\u826f", "\u62d3\u62d4", "\u5939\u8c37", "\u5bb0\u7236", "\u8c37\u6881", "\u664b", "\u695a", "\u960e", "\u6cd5", "\u6c5d", "\u9122", "\u6d82", "\u94a6", "\u6bb5\u5e72", "\u767e\u91cc",
|
||||
"\u4e1c\u90ed", "\u5357\u95e8", "\u547c\u5ef6", "\u5f52", "\u6d77", "\u7f8a\u820c", "\u5fae\u751f", "\u5cb3", "\u5e05", "\u7f11", "\u4ea2", "\u51b5", "\u540e", "\u6709", "\u7434", "\u6881\u4e18", "\u5de6\u4e18", "\u4e1c\u95e8", "\u897f\u95e8",
|
||||
"\u5546", "\u725f", "\u4f58", "\u4f74", "\u4f2f", "\u8d4f", "\u5357\u5bab", "\u58a8", "\u54c8", "\u8c2f", "\u7b2a", "\u5e74", "\u7231", "\u9633", "\u4f5f"
|
||||
};
|
||||
|
||||
static final String[] traditionalNames = {
|
||||
"Abbot", "Morton", "Zachary", "Williams", "\u8d99", "\u9322", "\u5b6b", "\u674e", "\u5468", "\u5433", "\u912d", "\u738b", "\u99ae", "\u9673", "\u696e", "\u885b", "\u8523", "\u6c88",
|
||||
"\u97d3", "\u694a", "\u6731", "\u79e6", "\u5c24", "\u8a31", "\u4f55", "\u5442", "\u65bd", "\u5f35", "\u5b54", "\u66f9", "\u56b4", "\u83ef", "\u91d1", "\u9b4f", "\u9676", "\u59dc", "\u621a", "\u8b1d", "\u9112",
|
||||
"\u55bb", "\u67cf", "\u6c34", "\u7ac7", "\u7ae0", "\u96f2", "\u8607", "\u6f58", "\u845b", "\u595a", "\u7bc4", "\u5f6d", "\u90ce", "\u9b6f", "\u97cb", "\u660c", "\u99ac", "\u82d7", "\u9cf3", "\u82b1", "\u65b9",
|
||||
"\u4fde", "\u4efb", "\u8881", "\u67f3", "\u9146", "\u9b91", "\u53f2", "\u5510", "\u8cbb", "\u5ec9", "\u5c91", "\u859b", "\u96f7", "\u8cc0", "\u502a", "\u6e6f", "\u6ed5", "\u6bb7", "\u7f85", "\u7562", "\u90dd",
|
||||
"\u9114", "\u5b89", "\u5e38", "\u6a02", "\u65bc", "\u6642", "\u5085", "\u76ae", "\u535e", "\u9f4a", "\u5eb7", "\u4f0d", "\u9918", "\u5143", "\u535c", "\u9867", "\u5b5f", "\u5e73", "\u9ec3", "\u548c", "\u7a46",
|
||||
"\u856d", "\u5c39", "\u59da", "\u90b5", "\u6e5b", "\u6c6a", "\u7941", "\u6bdb", "\u79b9", "\u72c4", "\u7c73", "\u8c9d", "\u660e", "\u81e7", "\u8a08", "\u4f0f", "\u6210", "\u6234", "\u8ac7", "\u5b8b", "\u8305",
|
||||
"\u9f90", "\u718a", "\u7d00", "\u8212", "\u5c48", "\u9805", "\u795d", "\u8463", "\u6881", "\u675c", "\u962e", "\u85cd", "\u95a9", "\u5e2d", "\u5b63", "\u9ebb", "\u5f37", "\u8cc8", "\u8def", "\u5a41", "\u5371",
|
||||
"\u6c5f", "\u7ae5", "\u984f", "\u90ed", "\u6885", "\u76db", "\u6797", "\u5201", "\u937e", "\u5f90", "\u4e18", "\u99f1", "\u9ad8", "\u590f", "\u8521", "\u7530", "\u6a0a", "\u80e1", "\u51cc", "\u970d", "\u865e",
|
||||
"\u842c", "\u652f", "\u67ef", "\u661d", "\u7ba1", "\u76e7", "\u83ab", "\u7d93", "\u623f", "\u88d8", "\u7e46", "\u5e79", "\u89e3", "\u61c9", "\u5b97", "\u4e01", "\u5ba3", "\u8cc1", "\u9127", "\u9b31", "\u55ae",
|
||||
"\u676d", "\u6d2a", "\u5305", "\u8af8", "\u5de6", "\u77f3", "\u5d14", "\u5409", "\u9215", "\u9f94", "\u7a0b", "\u5d47", "\u90a2", "\u6ed1", "\u88f4", "\u9678", "\u69ae", "\u7fc1", "\u8340", "\u7f8a", "\u65bc",
|
||||
"\u60e0", "\u7504", "\u9eb4", "\u5bb6", "\u5c01", "\u82ae", "\u7fbf", "\u5132", "\u9773", "\u6c72", "\u90b4", "\u7cdc", "\u677e", "\u4e95", "\u6bb5", "\u5bcc", "\u5deb", "\u70cf", "\u7126", "\u5df4", "\u5f13",
|
||||
"\u7267", "\u9697", "\u5c71", "\u8c37", "\u8eca", "\u4faf", "\u5b93", "\u84ec", "\u5168", "\u90d7", "\u73ed", "\u4ef0", "\u79cb", "\u4ef2", "\u4f0a", "\u5bae", "\u5be7", "\u4ec7", "\u6b12", "\u66b4", "\u7518",
|
||||
"\u659c", "\u53b2", "\u620e", "\u7956", "\u6b66", "\u7b26", "\u5289", "\u666f", "\u8a79", "\u675f", "\u9f8d", "\u8449", "\u5e78", "\u53f8", "\u97f6", "\u90dc", "\u9ece", "\u858a", "\u8584", "\u5370", "\u5bbf",
|
||||
"\u767d", "\u61f7", "\u84b2", "\u90b0", "\u5f9e", "\u9102", "\u7d22", "\u54b8", "\u7c4d", "\u8cf4", "\u5353", "\u85fa", "\u5c60", "\u8499", "\u6c60", "\u55ac", "\u9670", "\u9b31", "\u80e5", "\u80fd", "\u84bc",
|
||||
"\u96d9", "\u805e", "\u8398", "\u9ee8", "\u7fdf", "\u8b5a", "\u8ca2", "\u52de", "\u9004", "\u59ec", "\u7533", "\u6276", "\u5835", "\u5189", "\u5bb0", "\u9148", "\u96cd", "\u90e4", "\u74a9", "\u6851", "\u6842",
|
||||
"\u6fee", "\u725b", "\u58fd", "\u901a", "\u908a", "\u6248", "\u71d5", "\u5180", "\u90df", "\u6d66", "\u5c1a", "\u8fb2", "\u6eab", "\u5225", "\u838a", "\u664f", "\u67f4", "\u77bf", "\u95bb", "\u5145", "\u6155",
|
||||
"\u9023", "\u8339", "\u7fd2", "\u5ba6", "\u827e", "\u9b5a", "\u5bb9", "\u5411", "\u53e4", "\u6613", "\u614e", "\u6208", "\u5ed6", "\u5ebe", "\u7d42", "\u66a8", "\u5c45", "\u8861", "\u6b65", "\u90fd", "\u803f",
|
||||
"\u6eff", "\u5f18", "\u5321", "\u570b", "\u6587", "\u5bc7", "\u5ee3", "\u797f", "\u95d5", "\u6771", "\u6b50", "\u6bb3", "\u6c83", "\u5229", "\u851a", "\u8d8a", "\u5914", "\u9686", "\u5e2b", "\u978f", "\u5399",
|
||||
"\u8076", "\u6641", "\u52fe", "\u6556", "\u878d", "\u51b7", "\u8a3e", "\u8f9b", "\u95de", "\u90a3", "\u7c21", "\u9952", "\u7a7a", "\u66fe", "\u6bcb", "\u6c99", "\u4e5c", "\u990a", "\u97a0", "\u9808", "\u8c50",
|
||||
"\u5de2", "\u95dc", "\u84af", "\u76f8", "\u67e5", "\u5f8c", "\u834a", "\u7d05", "\u904a", "\u7afa", "\u6b0a", "\u9011", "\u84cb", "\u76ca", "\u6853", "\u516c", "\u4e07\u4fdf", "\u53f8\u99ac", "\u4e0a\u5b98", "\u6b50\u967d",
|
||||
"\u590f\u4faf", "\u8af8\u845b", "\u805e\u4eba", "\u6771\u65b9", "\u8d6b\u9023", "\u7687\u752b", "\u5c09\u9072", "\u516c\u7f8a", "\u6fb9\u53f0", "\u516c\u51b6", "\u5b97\u653f", "\u6fee\u967d", "\u6df3\u4e8e", "\u55ae\u4e8e", "\u592a\u53d4", "\u7533\u5c60", "\u516c\u5b6b", "\u4ef2\u5b6b",
|
||||
"\u8ed2\u8f45", "\u4ee4\u72d0", "\u937e\u96e2", "\u5b87\u6587", "\u9577\u5b6b", "\u6155\u5bb9", "\u9bae\u4e8e", "\u95ad\u4e18", "\u53f8\u5f92", "\u53f8\u7a7a", "\u4e0c\u5b98", "\u53f8\u5bc7", "\u4ec9", "\u7763", "\u5b50\u8eca", "\u9853\u5b6b", "\u7aef\u6728", "\u5deb\u99ac",
|
||||
"\u516c\u897f", "\u6f06\u96d5", "\u6a02\u6b63", "\u58e4\u99df", "\u516c\u826f", "\u62d3\u62d4", "\u593e\u8c37", "\u5bb0\u7236", "\u7a40\u6881", "\u6649", "\u695a", "\u95bb", "\u6cd5", "\u6c5d", "\u9122", "\u5857", "\u6b3d", "\u6bb5\u5e72", "\u767e\u91cc",
|
||||
"\u6771\u90ed", "\u5357\u9580", "\u547c\u5ef6", "\u6b78", "\u6d77", "\u7f8a\u820c", "\u5fae\u751f", "\u5cb3", "\u5e25", "\u7df1", "\u4ea2", "\u6cc1", "\u5f8c", "\u6709", "\u7434", "\u6881\u4e18", "\u5de6\u4e18", "\u6771\u9580", "\u897f\u9580",
|
||||
"\u5546", "\u725f", "\u4f58", "\u4f74", "\u4f2f", "\u8cde", "\u5357\u5bae", "\u58a8", "\u54c8", "\u8b59", "\u7b2a", "\u5e74", "\u611b", "\u967d", "\u4f5f"
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue