"
+ "
+ "
+ " // s-zet
+ "
+ "&th, \u00FE & TH, \u00DE" // thorn
+ "
+ "
+ "
+ "
+ "
+ "
+ "&AE,\u00C6" // ae & AE ligature
+ "&AE,\u00E6"
+ "&OE,\u0152" // oe & OE ligature
+ "&OE,\u0153";
/*
* Data for TestPrimary()
*/
private static final String[] primarySourceData = {
"p\u00EAche",
"abc",
"abc",
"abc",
"abc",
"abc",
"a\u00E6c",
"acHc",
"black"
};
private static final String[] primaryTargetData = {
"p\u00E9ch\u00E9",
"abc",
"aBC",
"abch",
"abd",
"\u00E4bc",
"a\u00C6c",
"aCHc",
"black-bird"
};
private static final int[] primaryResults = {
0, 0, 0, -1, -1, 0, 0, 0, -1
};
/*
* Data for TestSecondary()
*/
private static final String[] secondarySourceData = {
"four",
"five",
"1",
"abc",
"abc",
"abcH",
"abc",
"acHc"
};
private static final String[] secondaryTargetData = {
"4",
"5",
"one",
"abc",
"aBc",
"abch",
"abd",
"aCHc"
};
private static final int[] secondaryResults = {
0, 0, 0, 0, 0, 0, -1, 0
};
/*
* Data for TestTertiary()
*/
private static final String[] tertiarySourceData = {
"ab'c",
"co-op",
"ab",
"ampersad",
"all",
"four",
"five",
"1",
"1",
"1",
"2",
"2",
"Hello",
"a,
"a,
"acc",
"acHc"
};
private static final String[] tertiaryTargetData = {
"abc",
"COOP",
"abc",
"&",
"&",
"4",
"5",
"one",
"nne",
"pne",
"two",
"uwo",
"hellO",
"a<=b",
"abc",
"aCHc",
"aCHc"
};
private static final int[] tertiaryResults = {
-1, 1, -1, -1, -1, -1, -1, 1, 1, -1,
1, -1, 1, 1, -1, -1, -1
};
private static final String[] testData = {
"a",
"A",
"\u00e4",
"\u00c4",
"ae",
"aE",
"Ae",
"AE",
"\u00e6",
"\u00c6",
"b",
"c",
"z"
};
public void TestPrimary() {
doTest(getCollator(), Collator.PRIMARY,
primarySourceData, primaryTargetData, primaryResults);
}
public void TestSecondary() {
doTest(getCollator(), Collator.SECONDARY,
secondarySourceData, secondaryTargetData, secondaryResults);
}
public void TestTertiary() {
Collator col = getCollator();
doTest(col, Collator.TERTIARY,
tertiarySourceData, tertiaryTargetData, tertiaryResults);
for (int i = 0; i < testData.length-1; i++) {
for (int j = i+1; j < testData.length; j++) {
doTest(col, testData[i], testData[j], -1);
}
}
}
private RuleBasedCollator myCollation = null;
private Collator getCollator() {
if (myCollation == null) {
try {
myCollation = new RuleBasedCollator
(DEFAULTRULES + "& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ");
} catch (Exception foo) {
errln("Collator creation failed.");
myCollation = (RuleBasedCollator)Collator.getInstance();
}
}
return myCollation;
}
}
[ zur Elbe Produktseite wechseln0.26Quellennavigators
Analyse erneut starten
]