Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed new ordering for backup iterator TreeSet
orbiter4239db0d1c36
diff --git a/source/de/anomic/kelondro/kelondroAbstractOrder.java b/source/de/anomic/kelondro/kelondroAbstractOrder.javaindex e738da591..5c6da4020 100644--- a/source/de/anomic/kelondro/kelondroAbstractOrder.java+++ b/source/de/anomic/kelondro/kelondroAbstractOrder.java@@ -47,15 +47,11 @@ package de.anomic.kelondro;import de.anomic.kelondro.kelondroRecords.Node;-public abstract class kelondroAbstractOrder implements kelondroOrder, Cloneable {+public abstract class kelondroAbstractOrder implements kelondroOrder {protected byte[] zero = null;- public Object clone() {- Object theClone = this.clone();- ((kelondroOrder) theClone).rotate(this.zero);- return theClone;- }+ public abstract Object clone();public long partition(byte[] key, int forks) {final long d = (Long.MAX_VALUE / forks) + ((Long.MAX_VALUE % forks) + 1) / forks;diff --git a/source/de/anomic/kelondro/kelondroBase64Order.java b/source/de/anomic/kelondro/kelondroBase64Order.javaindex ae549b44d..fe3c80ba7 100644--- a/source/de/anomic/kelondro/kelondroBase64Order.java+++ b/source/de/anomic/kelondro/kelondroBase64Order.java@@ -83,6 +83,12 @@ public class kelondroBase64Order extends kelondroAbstractOrder implements kelondahpla = (rfc1113compliant) ? ahpla_standard : ahpla_enhanced;}+ public Object clone() {+ kelondroBase64Order o = new kelondroBase64Order(this.asc, this.rfc1113compliant);+ o.rotate(this.zero);+ return o;+ }+public static kelondroOrder bySignature(String signature) {if (signature.equals("Bd")) return new kelondroBase64Order(false, false);if (signature.equals("bd")) return new kelondroBase64Order(false, true);diff --git a/source/de/anomic/kelondro/kelondroNaturalOrder.java b/source/de/anomic/kelondro/kelondroNaturalOrder.javaindex 097a54b20..5d92b80e5 100644--- a/source/de/anomic/kelondro/kelondroNaturalOrder.java+++ b/source/de/anomic/kelondro/kelondroNaturalOrder.java@@ -47,7 +47,7 @@ package de.anomic.kelondro;import java.util.Comparator;-public class kelondroNaturalOrder extends kelondroAbstractOrder implements kelondroOrder, Comparator {+public class kelondroNaturalOrder extends kelondroAbstractOrder implements kelondroOrder, Comparator, Cloneable {boolean asc;@@ -55,6 +55,13 @@ public class kelondroNaturalOrder extends kelondroAbstractOrder implements kelonpublic kelondroNaturalOrder(boolean ascending) {this.asc = ascending;+ this.zero = null;+ }++ public Object clone() {+ kelondroNaturalOrder o = new kelondroNaturalOrder(this.asc);+ o.rotate(this.zero);+ return o;}public static kelondroOrder bySignature(String signature) {diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex 7ea5b24a3..8a615616b 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -384,9 +384,9 @@ public final class plasmaWordIndex {public static final int RL_WORDFILES = 3;public synchronized TreeSet wordHashes(String startHash, int resourceLevel, boolean rot, int count) {- //kelondroOrder hashOrder = (kelondroOrder) indexOrder.clone();- //if (rot) hashOrder.rotate(startHash.getBytes()); else hashOrder.rotate(null);- TreeSet hashes = new TreeSet(/*hashOrder*/);+ kelondroOrder hashOrder = (kelondroOrder) indexOrder.clone();+ if (rot) hashOrder.rotate(startHash.getBytes()); else hashOrder.rotate(null);+ TreeSet hashes = new TreeSet(hashOrder);Iterator i = wordHashes(startHash, resourceLevel, rot);String hash;while ((hashes.size() < count) && (i.hasNext())) {diff --git a/source/de/anomic/plasma/plasmaWordIndexCache.java b/source/de/anomic/plasma/plasmaWordIndexCache.javaindex 84e6eb3de..a3d75a09d 100644--- a/source/de/anomic/plasma/plasmaWordIndexCache.java+++ b/source/de/anomic/plasma/plasmaWordIndexCache.java@@ -61,8 +61,8 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {// environment constantsprivate static final String indexArrayFileName = "indexDump1.array";public static final int wCacheReferenceLimit = 50;- public static final long wCacheMaxAge = 1000 * 60 * 60 * 2; // milliseconds; 2 hours- public static final long kCacheMaxAge = 1000 * 60 * 2; // milliseconds; 2 minutes+ public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes+ public static final long kCacheMaxAge = 1000 * 60 * 2; // milliseconds; 2 minutes// class variablesprivate final File databaseRoot;@@ -393,35 +393,6 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {}return count;}-- /*- public int tryRemoveURLs(String urlHash) {- // this tries to delete an index from the cache that has this- // urlHash assigned. This can only work if the entry is really fresh- // Such entries must be searched in the latest entries- int delCount = 0;- synchronized (wCache) {- Iterator i = hashDate.scores(false);- String wordHash;- long t;- plasmaWordIndexEntryContainer c;- while (i.hasNext()) {- wordHash = (String) i.next();- // check time- t = longEmit(hashDate.getScore(wordHash));- if (System.currentTimeMillis() - t > wCacheMinAge) return delCount;- // get container- c = (plasmaWordIndexEntryContainer) wCache.get(wordHash);- if (c.remove(urlHash) != null) {- wCache.put(wordHash, c);- hashScore.decScore(wordHash);- delCount++;- }- }- }- return delCount;- }- */public int tryRemoveURLs(String urlHash) {// this tries to delete an index from the cache that has this