warnln("Unable to open collator with rules " + rules[i]);
}
logln("Test rule["+i+"]"+rules[i]);
CollationKey keyA = coll.getCollationKey("a");
logln("Key for \"a\":"+ prettify(keyA));
if (keyA.compareTo(coll.getCollationKey(lastPrimIgn))<=0) {
CollationKey key = coll.getCollationKey(lastPrimIgn);
logln("Collation key for 0xD800 0xDDFD: "+prettify(key));
errln("Error! String \"a\" must be greater than \uD800\uDDFD -"+
"[Last Primary Ignorable]");
}
if (keyA.compareTo(coll.getCollationKey(firstVariable))>=0) {
CollationKey key = coll.getCollationKey(firstVariable);
logln("Collation key for 0x0009: "+prettify(key));
errln("Error! String \"a\" must be less than 0x0009 - [First Variable]");
}
CollationKey keyB = coll.getCollationKey("b");
logln("Key for \"b\":"+ prettify(keyB));
if (keyB.compareTo(coll.getCollationKey(firstPrimIgn))<=0) {
CollationKey key = coll.getCollationKey(firstPrimIgn);
logln("Collation key for 0x0332: "+prettify(key));
errln("Error! String \"b\" must be greater than 0x0332 -"+
"[First Primary Ignorable]");
}
if (keyB.compareTo(coll.getCollationKey(firstVariable))>=0) {
CollationKey key = coll.getCollationKey(firstVariable);
logln("Collation key for 0x0009: "+prettify(key));
errln("Error! String \"b\" must be less than 0x0009 - [First Variable]");
}
}
{
i=1;
RuleBasedCollator coll = null;
try {
coll = new RuleBasedCollator(rules[i]);
} catch (Exception e) {
warnln("Unable to open collator with rules " + rules[i]);
}
logln("Test rule["+i+"]"+rules[i]);
CollationKey keyA = coll.getCollationKey("a");
logln("Key for \"a\":"+ prettify(keyA));
byte[] keyAInBytes = keyA.toByteArray();
for (int j=0; j<keyAInBytes.length && j<secIgnKey.length; j++) {
if (keyAInBytes[j]!=secIgnKey[j]) {
if ((char)keyAInBytes[j]<=(char)secIgnKey[j]) {
logln("Error! String \"a\" must be greater than [Last Secondary Ignorable]");
}
break;
}
}
if (keyA.compareTo(coll.getCollationKey(firstVariable))>=0) {
errln("Error! String \"a\" must be less than 0x0009 - [First Variable]");
CollationKey key = coll.getCollationKey(firstVariable);
logln("Collation key for 0x0009: "+prettify(key));
}
CollationKey keyB = coll.getCollationKey("b");
logln("Key for \"b\":"+ prettify(keyB));
byte[] keyBInBytes = keyB.toByteArray();
for (int j=0; j<keyBInBytes.length && j<secIgnKey.length; j++) {
if (keyBInBytes[j]!=secIgnKey[j]) {
if ((char)keyBInBytes[j]<=(char)secIgnKey[j]) {
errln("Error! String \"b\" must be greater than [Last Secondary Ignorable]");
}
break;
}
}
if (keyB.compareTo(coll.getCollationKey(firstVariable))>=0) {
CollationKey key = coll.getCollationKey(firstVariable);
logln("Collation key for 0x0009: "+prettify(key));
errln("Error! String \"b\" must be less than 0x0009 - [First Variable]");
}
}
}