private void addIndexExemplars ( ULocale locale ) { UnicodeSet exemplars = LocaleData . getExemplarSet ( locale , 0 , LocaleData . ES_INDEX ) ; if ( exemplars != null ) { initialLabels . addAll ( exemplars ) ; return ; } // The locale data did not include explicit Index characters. // Synthesize a set of them from the locale's standard exemplar characters. exemplars = LocaleData . getExemplarSet ( locale , 0 , LocaleData . ES_STANDARD ) ; exemplars = exemplars . cloneAsThawed ( ) ; // question: should we add auxiliary exemplars? if ( exemplars . containsSome ( ' ' , ' ' ) || exemplars . size ( ) == 0 ) { exemplars . addAll ( ' ' , ' ' ) ; } if ( exemplars . containsSome ( 0xAC00 , 0xD7A3 ) ) { // Hangul syllables // cut down to small list exemplars . remove ( 0xAC00 , 0xD7A3 ) . add ( 0xAC00 ) . add ( 0xB098 ) . add ( 0xB2E4 ) . add ( 0xB77C ) . add ( 0xB9C8 ) . add ( 0xBC14 ) . add ( 0xC0AC ) . add ( 0xC544 ) . add ( 0xC790 ) . add ( 0xCC28 ) . add ( 0xCE74 ) . add ( 0xD0C0 ) . add ( 0xD30C ) . add ( 0xD558 ) ; } if ( exemplars . containsSome ( 0x1200 , 0x137F ) ) { // Ethiopic block // cut down to small list // make use of the fact that Ethiopic is allocated in 8's, where // the base is 0 mod 8. UnicodeSet ethiopic = new UnicodeSet ( "[[:Block=Ethiopic:]&[:Script=Ethiopic:]]" ) ; UnicodeSetIterator it = new UnicodeSetIterator ( ethiopic ) ; while ( it . next ( ) && it . codepoint != UnicodeSetIterator . IS_STRING ) { if ( ( it . codepoint & 0x7 ) != 0 ) { exemplars . remove ( it . codepoint ) ; } } } // Upper-case any that aren't already so. // (We only do this for synthesized index characters.) for ( String item : exemplars ) { initialLabels . add ( UCharacter . toUpperCase ( locale , item ) ) ; } }
This method is called to get the index exemplars . Normally these come from the locale directly but if they aren t available we have to synthesize them .