Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
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
hermens4b83875abd8d
diff --git a/source/de/anomic/kelondro/text/ReferenceContainerCache.java b/source/de/anomic/kelondro/text/ReferenceContainerCache.javaindex 44d06f3b3..a5072f9ba 100644--- a/source/de/anomic/kelondro/text/ReferenceContainerCache.java+++ b/source/de/anomic/kelondro/text/ReferenceContainerCache.java@@ -280,6 +280,11 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exteif (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> exteif (!rot) {return null;}+ if (this.cachecopy.length == 0) return null;p = 0;ReferenceContainer<ReferenceType> c = this.cachecopy[this.p++];this.latestTermHash = c.getTermHash();