FileDocCategorySizeDatePackage
CollationAbstractionLayerImpl.javaAPI DocphoneME MR2 API (J2ME)3716Wed May 02 18:00:46 BST 2007com.sun.j2me.global

CollationAbstractionLayerImpl

public class CollationAbstractionLayerImpl extends CollationAbstractionLayer
This class customizes the {@link javax.microedition.global.StringComparator} implementation to rely on platform string comparison capabilities.

Fields Summary
Constructors Summary
public CollationAbstractionLayerImpl()
Create instance of CollationAbstractionLayerImpl. This constructor is necessary because of Class.forName() creation call in {@link com.sun.j2me.global.CollationAbstractionLayer#getInstance}.

 
Methods Summary
public static native intgetCollationLocaleIndex(java.lang.String locale)
Get index of supported locales for string collation by its name.

param
locale name of locale
return
index of locale

public static native java.lang.StringgetCollationLocaleName(int index)
Get one of supported locales (by number).

param
index index of locale to select
return
locale

public static native intgetCollationLocalesCount()
Get number of supported locales for string collation.

return
number of locales

public CommonStringComparatorgetStringComparator(java.lang.String locale, int level)
Returns an instance of the {@link StringComparatorImpl} class, which realizes all StringComparator methods in a platform-specific way.

param
locale the locale
param
level the level of comparison
return
the instance of the StringComparatorImpl

        return new StringComparatorImpl(locale, level);
    
public java.lang.String[]getSupportedLocales()
Gets the locales for which a StringComparator is available in this implementation. If no locales are supported, the returned array must be empty, not null. As the value null is not technically a valid locale, but a special value to trigger the generic collation algorithm, it must not appear in the array.

return
an array of valid microedition.locale values

        int lcount = getCollationLocalesCount();
		if (lcount == 0) return new String[0];
		int index = 0;
		String locale = getCollationLocaleName(0);
		if (locale == null || locale.equals("")){
			index = 1;
		}
        String[] locales = new String[lcount-index];
        for (int i=0; index < lcount; index++) {
            locales[i++] = getCollationLocaleName(index);
        }

        return locales;