while (aValueIterator.hasNext()) {
// iterate over locators for current value adding each to result
Iterator aLocatorIterator = ((TreeSet) ((Map.Entry) aValueIterator.next()).getValue()).iterator();
for (; aLocatorIterator.hasNext(); ++aResultIndex) {
ValueLocator aLocator = (ValueLocator) aLocatorIterator.next();
aResult[aResultIndex] = new IndexMatch(new Key(aLocator.getKey()), aLocator.getPosition(), aLocator.getLength(), aLocator.getElementID(), aLocator.getAttributeID());
}
}
} else {
// allocate return array to include all locators except those attached to excluded value
aResult = new IndexMatch[itsValueLocatorCount - anExcludedLocatorSet.size()];
// iterate over the values adding locators for each to result
// must filter out the locator set for the excluded value while iterating values
while (aValueIterator.hasNext()) {
aLocatorSet = (TreeSet) ((Map.Entry) aValueIterator.next()).getValue();
// apply the exclusion filter for the matched value
if (aLocatorSet != anExcludedLocatorSet) {
// iterate over locators for current value adding each to result
Iterator aLocatorIterator = ((TreeSet) ((Map.Entry) aValueIterator.next()).getValue()).iterator();
for (; aLocatorIterator.hasNext(); ++aResultIndex) {
ValueLocator aLocator = (ValueLocator) aLocatorIterator.next();
aResult[aResultIndex] = new IndexMatch(new Key(aLocator.getKey()), aLocator.getPosition(), aLocator.getLength(), aLocator.getElementID(), aLocator.getAttributeID());
}
}
}
}