/// <summary> /// Return a snapshot of the mapping from display names to visible IDs for /// this service. This set will not change as factories are added or removed, /// but the supported ids will, so there is no guarantee that all and only /// the ids in the returned map will be visible and supported by the service /// in subsequent calls, nor is there any guarantee that the current display /// names match those in the set. The display names are sorted based on the /// comparator provided. /// </summary> /// public SortedList GetDisplayNames(ULocale locale, IComparer com, String matchID) { SortedList dncache = null; ICUService.LocaleRef xref = dnref; if (xref != null) { dncache = xref.Get(locale, com); } while (dncache == null) { lock (this) { if (xref == dnref || dnref == null) { dncache = new SortedList(com); // sorted IDictionary m = GetVisibleIDMap(); IIterator ei = new ILOG.J2CsMapping.Collections.IteratorAdapter(m.GetEnumerator()); while (ei.HasNext()) { DictionaryEntry e = (DictionaryEntry)ei.Next(); String id_0 = (String)((DictionaryEntry)e).Key; ICUService.Factory f = (ICUService.Factory)((DictionaryEntry)e).Value; ILOG.J2CsMapping.Collections.Collections.Put(dncache, f.GetDisplayName(id_0, locale), id_0); } dncache = /*ILOG.J2CsMapping.Collections.Generics.Collections.UnmodifiableSortedMap(*/ dncache /*)*/; dnref = new ICUService.LocaleRef(dncache, locale, com); } else { xref = dnref; dncache = xref.Get(locale, com); } } } ICUService.Key matchKey = CreateKey(matchID); if (matchKey == null) { return(dncache); } SortedList result = new SortedList(dncache); IIterator iter = new ILOG.J2CsMapping.Collections.IteratorAdapter(result.GetEnumerator()); while (iter.HasNext()) { DictionaryEntry e_1 = (DictionaryEntry)iter.Next(); if (!matchKey.IsFallbackOf((String)((DictionaryEntry)e_1).Value)) { iter.Remove(); } } return(result); }
/// <summary> /// Given a visible id, return the display name in the requested locale. If /// there is no directly supported id corresponding to this id, return null. /// </summary> /// public String GetDisplayName(String id_0, ULocale locale) { IDictionary m = GetVisibleIDMap(); ICUService.Factory f = (ICUService.Factory)ILOG.J2CsMapping.Collections.Collections.Get(m, id_0); if (f != null) { return(f.GetDisplayName(id_0, locale)); } ICUService.Key key = CreateKey(id_0); while (key.Fallback()) { f = (ICUService.Factory)ILOG.J2CsMapping.Collections.Collections.Get(m, key.CurrentID()); if (f != null) { return(f.GetDisplayName(id_0, locale)); } } return(null); }