simplified code, removed one unused method in all implementing classes

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5972 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 47fce9020c
commit addecdb18c

@ -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 {

@ -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());

@ -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;

@ -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) {

@ -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: ");

@ -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;

@ -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;

@ -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);

@ -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));

@ -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));

@ -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);
}

Loading…
Cancel
Save