StringComparatorpublic final class StringComparator extends Object
Fields Summary |
---|
public static final int | LEVEL1 | public static final int | LEVEL2 | public static final int | LEVEL3 | public static final int | IDENTICAL | private int | levelCollation level | private String | localeLocale | private static com.sun.j2me.global.CollationAbstractionLayer | collationAbstractionLayerInstance of the CollationAbstractionLayer | private com.sun.j2me.global.CommonStringComparator | stringComparatorImplString comparator |
Constructors Summary |
---|
public StringComparator()
// JAVADOC COMMENT ELIDED
this(System.getProperty("microedition.locale"), LEVEL1);
| public StringComparator(String locale)
this(locale, LEVEL1);
| public StringComparator(String locale, int level)
// check the level
if ((level < LEVEL1) || (level > LEVEL3) && (level != IDENTICAL)) {
throw new IllegalArgumentException("Invalid level");
}
if (!LocaleHelpers.isValidLocale(locale) && !("".equals(locale))) {
throw new IllegalArgumentException("Invalid locale format");
}
locale = LocaleHelpers.normalizeLocale(locale);
if ("".equals(locale)) {
this.locale = null;
} else {
this.locale = locale;
}
this.level = level;
if (locale == null) {
locale = "";
}
stringComparatorImpl = collationAbstractionLayer.getStringComparator(
locale, level);
|
|