ICU-6824 Fix minor items in map and iteration with null values

X-SVN-Rev: 26383
This commit is contained in:
Mark Davis 2009-07-19 03:30:17 +00:00
parent 9f373b4b5a
commit 7483f806ff
2 changed files with 15 additions and 10 deletions

View file

@ -726,7 +726,7 @@ public final class UnicodeMap<T> implements Cloneable, Freezable, StringTransfor
}
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.util.Lockable#isLocked()
* @see com.ibm.icu.dev.test.util.Freezable#isFrozen()
*/
public boolean isFrozen() {
// TODO Auto-generated method stub
@ -734,7 +734,7 @@ public final class UnicodeMap<T> implements Cloneable, Freezable, StringTransfor
}
/* (non-Javadoc)
* @see com.ibm.icu.dev.test.util.Lockable#lock()
* @see com.ibm.icu.dev.test.util.Freezable#lock()
*/
public UnicodeMap<T> freeze() {
locked = true;

View file

@ -135,8 +135,10 @@ public class UnicodeMapIterator<T> {
codepoint = codepointEnd = nextElement++;
return true;
}
if (range < endRange) {
loadRange(++range);
while (range < endRange) {
if (loadRange(++range) == null) {
continue;
}
codepoint = codepointEnd = nextElement++;
return true;
}
@ -177,7 +179,10 @@ public class UnicodeMapIterator<T> {
nextElement = endElement+1;
return true;
}
while (range < endRange && loadRange(++range) != null) {
while (range < endRange) {
if (loadRange(++range) == null) {
continue;
}
codepointEnd = endElement;
codepoint = nextElement;
nextElement = endElement+1;
@ -212,12 +217,12 @@ public class UnicodeMapIterator<T> {
*/
public UnicodeMapIterator<T> reset() {
endRange = map.getRangeCount() - 1;
range = 0;
// both next*() methods will test: if (nextElement <= endElement)
// we set them to fail this test, which will cause them to load the first range
nextElement = 0;
endElement = -1;
nextElement = 0;
if (endRange >= 0) {
loadRange(range);
}
range = -1;
stringIterator = null;
Set<String> strings = map.getNonRangeStrings();
if (strings != null) {