Search in sources :

Example 1 with UnicodeMapIterator

use of android.icu.dev.util.UnicodeMapIterator in project j2objc by google.

the class UnicodeMapTest method checkNext.

private void checkNext(UnicodeMap<String> map1, Map<Integer, String> map2, int limit) {
    logln("Comparing nextRange");
    Map localMap = new TreeMap();
    UnicodeMapIterator<String> mi = new UnicodeMapIterator<String>(map1);
    while (mi.nextRange()) {
        logln(Utility.hex(mi.codepoint) + ".." + Utility.hex(mi.codepointEnd) + " => " + mi.value);
        for (int i = mi.codepoint; i <= mi.codepointEnd; ++i) {
            // if (i >= limit) continue;
            localMap.put(i, mi.value);
        }
    }
    checkMap(map2, localMap);
    logln("Comparing next");
    mi.reset();
    localMap = new TreeMap();
    // String lastValue = null;
    while (mi.next()) {
        // if (!UnicodeMap.areEqual(lastValue, mi.value)) {
        // // System.out.println("Change: " + Utility.hex(mi.codepoint) + " => " + mi.value);
        // lastValue = mi.value;
        // }
        // if (mi.codepoint >= limit) continue;
        localMap.put(mi.codepoint, mi.value);
    }
    checkMap(map2, localMap);
}
Also used : UnicodeMapIterator(android.icu.dev.util.UnicodeMapIterator) TreeMap(java.util.TreeMap) UnicodeMap(android.icu.dev.util.UnicodeMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map) SortedMap(java.util.SortedMap)

Aggregations

UnicodeMap (android.icu.dev.util.UnicodeMap)1 UnicodeMapIterator (android.icu.dev.util.UnicodeMapIterator)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1