Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

simplified code, removed one unused method in all implementing classes

orbiteraddecdb18cdf
diff --git a/source/de/anomic/crawler/ResourceObserver.java b/source/de/anomic/crawler/ResourceObserver.java
index 72bff2426..569e1f4fd 100644
--- a/source/de/anomic/crawler/ResourceObserver.java
+++ b/source/de/anomic/crawler/ResourceObserver.java
@@ -31,7 +31,6 @@ import java.util.Map;
import de.anomic.kelondro.util.Log;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaSwitchboardConstants;
-import de.anomic.server.serverInstantBusyThread;
import de.anomic.tools.diskUsage;
public final class ResourceObserver {
diff --git a/source/de/anomic/kelondro/blob/Cache.java b/source/de/anomic/kelondro/blob/Cache.java
index 48f97242f..c19a9b687 100644
--- a/source/de/anomic/kelondro/blob/Cache.java
+++ b/source/de/anomic/kelondro/blob/Cache.java
@@ -268,11 +268,6 @@ public class Cache implements ObjectIndex {
return entry;
}
- public synchronized void put(final List<Entry> rows) throws IOException {
- final Iterator<Entry> i = rows.iterator();
- while (i.hasNext()) put(i.next());
- }
-
public synchronized void put(final Entry row) throws IOException {
assert (row != null);
assert (row.columns() == row().columns());
diff --git a/source/de/anomic/kelondro/index/ObjectIndex.java b/source/de/anomic/kelondro/index/ObjectIndex.java
index 6646f7218..7740e18d7 100644
--- a/source/de/anomic/kelondro/index/ObjectIndex.java
+++ b/source/de/anomic/kelondro/index/ObjectIndex.java
@@ -33,7 +33,6 @@ package de.anomic.kelondro.index;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.List;
import de.anomic.kelondro.order.CloneableIterator;
@@ -46,7 +45,6 @@ public interface ObjectIndex {
public Row.Entry get(byte[] key) throws IOException;
public Row.Entry replace(Row.Entry row) throws IOException;
public void put(Row.Entry row) throws IOException;
- public void put(List<Row.Entry> rows) throws IOException; // for R/W head path optimization
public void addUnique(Row.Entry row) throws IOException; // no double-check
public ArrayList<RowCollection> removeDoubles() throws IOException; // removes all elements that are double (to be used after all addUnique)
public Row.Entry remove(byte[] key) throws IOException;
diff --git a/source/de/anomic/kelondro/index/ObjectIndexCache.java b/source/de/anomic/kelondro/index/ObjectIndexCache.java
index 0f5686b38..e48465f73 100644
--- a/source/de/anomic/kelondro/index/ObjectIndexCache.java
+++ b/source/de/anomic/kelondro/index/ObjectIndexCache.java
@@ -118,12 +118,7 @@ public class ObjectIndexCache implements ObjectIndex {
index1.put(entry);
}
- public void put(final List<Entry> rows) {
- final Iterator<Entry> i = rows.iterator();
- while (i.hasNext()) put(i.next());
- }
-
- public synchronized void addUnique(final Row.Entry entry) {
+ public synchronized void addUnique(final Row.Entry entry) {
assert (entry != null);
if (entry == null) return;
if (index1 == null) {
diff --git a/source/de/anomic/kelondro/index/RowSet.java b/source/de/anomic/kelondro/index/RowSet.java
index 4c274ff23..7eba1e91b 100644
--- a/source/de/anomic/kelondro/index/RowSet.java
+++ b/source/de/anomic/kelondro/index/RowSet.java
@@ -27,7 +27,6 @@ package de.anomic.kelondro.index;
import java.io.DataInput;
import java.io.IOException;
import java.util.Iterator;
-import java.util.List;
import java.util.Random;
import de.anomic.kelondro.order.Base64Order;
@@ -97,18 +96,9 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.E
}
public synchronized Row.Entry get(final byte[] key) {
- return get(key, 0, key.length);
- }
-
- private Row.Entry get(final byte[] key, final int astart, final int alength) {
- final int index = find(key, astart, alength);
- final Row.Entry entry = (index >= 0) ? get(index, true) : null;
- return entry;
- }
-
- public synchronized void put(final List<Row.Entry> rows) {
- final Iterator<Row.Entry> i = rows.iterator();
- while (i.hasNext()) put(i.next());
+ final int index = find(key, 0, key.length);
+ if (index < 0) return null;
+ return get(index, true);
}
public synchronized void put(final Row.Entry entry) {
@@ -508,7 +498,7 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.E
for (int ii = 0; ii < test.length; ii++) d.add(test[ii].getBytes());
for (int ii = 0; ii < test.length; ii++) d.add(test[ii].getBytes());
d.sort();
- d.remove("fuenf".getBytes(), 0, 5);
+ d.remove("fuenf".getBytes());
final Iterator<Row.Entry> ii = d.iterator();
String s;
System.out.print("INPUT-ITERATOR: ");
diff --git a/source/de/anomic/kelondro/index/RowSetArray.java b/source/de/anomic/kelondro/index/RowSetArray.java
index 7c5197406..a0f40fcb1 100644
--- a/source/de/anomic/kelondro/index/RowSetArray.java
+++ b/source/de/anomic/kelondro/index/RowSetArray.java
@@ -130,10 +130,6 @@ public class RowSetArray implements ObjectIndex, Iterable<Row.Entry> {
accessArray(i).put(row);
}
- public void put(List<Entry> rows) {
- for (Entry row: rows) put(row);
- }
-
public Entry remove(byte[] key) {
int i = indexFor(key);
if (i < 0) return null;
diff --git a/source/de/anomic/kelondro/table/EcoTable.java b/source/de/anomic/kelondro/table/EcoTable.java
index b9629c0bd..c10f07f43 100644
--- a/source/de/anomic/kelondro/table/EcoTable.java
+++ b/source/de/anomic/kelondro/table/EcoTable.java
@@ -444,13 +444,6 @@ public class EcoTable implements ObjectIndex {
return replace(row);
}
- public synchronized void put(final List<Entry> rows) throws IOException {
- assert file.size() == index.size() + fail : "file.size() = " + file.size() + ", index.size() = " + index.size();
- final Iterator<Entry> i = rows.iterator();
- while (i.hasNext()) put(i.next());
- assert file.size() == index.size() + fail : "file.size() = " + file.size() + ", index.size() = " + index.size();
- }
-
private void removeInFile(final int i) throws IOException {
assert i >= 0;
diff --git a/source/de/anomic/kelondro/table/FlexTable.java b/source/de/anomic/kelondro/table/FlexTable.java
index cf480b3ad..35638a289 100644
--- a/source/de/anomic/kelondro/table/FlexTable.java
+++ b/source/de/anomic/kelondro/table/FlexTable.java
@@ -30,7 +30,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.TreeSet;
@@ -199,45 +198,6 @@ public class FlexTable extends FlexWidthArray implements ObjectIndex {
//}
}
- public synchronized void put(final List<Row.Entry> rows) throws IOException {
- // put a list of entries in a ordered way.
- // this should save R/W head positioning time
- final Iterator<Row.Entry> i = rows.iterator();
- Row.Entry row;
- int pos;
- byte[] key;
- final TreeMap<Integer, Row.Entry> old_rows_ordered = new TreeMap<Integer, Row.Entry>();
- final ArrayList<Row.Entry> new_rows_sequential = new ArrayList<Row.Entry>();
- assert this.size() == index.size() : "content.size() = " + this.size() + ", index.size() = " + index.size();
- while (i.hasNext()) {
- row = i.next();
- key = row.getColBytes(0);
- pos = index.get(key);
- if (pos < 0) {
- new_rows_sequential.add(row);
- } else {
- old_rows_ordered.put(Integer.valueOf(pos), row);
- }
- }
- // overwrite existing entries in index
- super.setMultiple(old_rows_ordered);
-
- // write new entries to index
-
- // add a list of entries in a ordered way.
- // this should save R/W head positioning time
- final TreeMap<Integer, byte[]> indexed_result = super.addMultiple(new_rows_sequential);
- // indexed_result is a Integer/byte[] relation
- // that is used here to store the index
- final Iterator<Map.Entry<Integer, byte[]>> j = indexed_result.entrySet().iterator();
- Map.Entry<Integer, byte[]> entry;
- while (j.hasNext()) {
- entry = j.next();
- index.put(entry.getValue(), entry.getKey().intValue());
- }
- assert this.size() == index.size() : "content.size() = " + this.size() + ", index.size() = " + index.size();
- }
-
public synchronized Row.Entry put(final Row.Entry row, final Date entryDate) throws IOException {
assert this.size() == index.size() : "content.size() = " + this.size() + ", index.size() = " + index.size();
return replace(row);
diff --git a/source/de/anomic/kelondro/table/SQLTable.java b/source/de/anomic/kelondro/table/SQLTable.java
index dd2f2deb0..454664a14 100644
--- a/source/de/anomic/kelondro/table/SQLTable.java
+++ b/source/de/anomic/kelondro/table/SQLTable.java
@@ -34,7 +34,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import de.anomic.kelondro.index.Row;
@@ -175,11 +174,6 @@ public class SQLTable implements ObjectIndex {
}
}
- public synchronized void put(final List<Row.Entry> rows) throws IOException {
- final Iterator<Row.Entry> i = rows.iterator();
- while (i.hasNext()) put(i.next());
- }
-
public Row.Entry replace(final Row.Entry row) throws IOException {
try {
final Row.Entry oldEntry = remove(row.getColBytes(0));
diff --git a/source/de/anomic/kelondro/table/SplitTable.java b/source/de/anomic/kelondro/table/SplitTable.java
index 8e60dcf53..78deac567 100644
--- a/source/de/anomic/kelondro/table/SplitTable.java
+++ b/source/de/anomic/kelondro/table/SplitTable.java
@@ -282,10 +282,6 @@ public class SplitTable implements ObjectIndex {
return table;
}
- public synchronized void put(final List<Row.Entry> rows) throws IOException {
- for (Row.Entry entry: rows) put(entry);
- }
-
public synchronized Row.Entry replace(final Row.Entry row) throws IOException {
assert row.objectsize() <= this.rowdef.objectsize;
ObjectIndex keeper = keeperOf(row.getColBytes(0));
diff --git a/source/de/anomic/kelondro/table/Tree.java b/source/de/anomic/kelondro/table/Tree.java
index af3d63ce9..e0260e2fa 100644
--- a/source/de/anomic/kelondro/table/Tree.java
+++ b/source/de/anomic/kelondro/table/Tree.java
@@ -47,7 +47,6 @@ import java.util.logging.Logger;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.RowCollection;
import de.anomic.kelondro.index.ObjectIndex;
-import de.anomic.kelondro.index.Row.Entry;
import de.anomic.kelondro.order.ByteOrder;
import de.anomic.kelondro.order.CloneableIterator;
import de.anomic.kelondro.order.NaturalOrder;
@@ -313,11 +312,6 @@ public class Tree extends CachedRecords implements ObjectIndex {
return (lc.equals(childn.handle()));
}
- public synchronized void put(final List<Entry> rows) throws IOException {
- final Iterator<Entry> i = rows.iterator();
- while (i.hasNext()) put(i.next());
- }
-
public void put(final Row.Entry newrow) throws IOException {
replace(newrow);
}