Small fixes for the heapCacheIterator in ReferenceContainerCache:

- Start the iteration at startWordHash
- When used with rotation, let the iteration stop when the cache is empty


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6293 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
hermens 15 years ago
parent fd668f531b
commit 4b83875abd

@ -280,6 +280,11 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
if (startWordHash != null && startWordHash.length == 0) startWordHash = null;
this.cachecopy = sortedClone();
this.p = 0;
if (startWordHash != null) {
while ( (this.p < this.cachecopy.length) &&
(termOrder.compare(this.cachecopy[this.p].getTermHash(), startWordHash) < 0)
) this.p++;
}
this.latestTermHash = null;
// The collection's iterator will return the values in the order that their corresponding keys appear in the tree.
}
@ -289,7 +294,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
}
public boolean hasNext() {
if (rot) return true;
if (rot) return this.cachecopy.length > 0;
return this.p < this.cachecopy.length;
}
@ -303,6 +308,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte
if (!rot) {
return null;
}
if (this.cachecopy.length == 0) return null;
p = 0;
ReferenceContainer<ReferenceType> c = this.cachecopy[this.p++];
this.latestTermHash = c.getTermHash();

Loading…
Cancel
Save