|
|
|
@ -264,7 +264,7 @@ public class kelondroRowCollection {
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public synchronized final kelondroRow.Entry get(int index) {
|
|
|
|
|
public synchronized final kelondroRow.Entry get(int index, boolean clone) {
|
|
|
|
|
assert (index >= 0) : "get: access with index " + index + " is below zero";
|
|
|
|
|
assert (index < chunkcount) : "get: access with index " + index + " is above chunkcount " + chunkcount + "; sortBound = " + sortBound;
|
|
|
|
|
assert (index * rowdef.objectsize < chunkcache.length);
|
|
|
|
@ -272,7 +272,7 @@ public class kelondroRowCollection {
|
|
|
|
|
if (index >= chunkcount) return null;
|
|
|
|
|
if ((index + 1) * rowdef.objectsize > chunkcache.length) return null; // the whole chunk does not fit into the chunkcache
|
|
|
|
|
this.lastTimeRead = System.currentTimeMillis();
|
|
|
|
|
return rowdef.newEntry(chunkcache, index * rowdef.objectsize, true);
|
|
|
|
|
return rowdef.newEntry(chunkcache, index * rowdef.objectsize, clone);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public synchronized final void set(int index, kelondroRow.Entry a) {
|
|
|
|
@ -395,7 +395,7 @@ public class kelondroRowCollection {
|
|
|
|
|
public synchronized kelondroRow.Entry removeOne() {
|
|
|
|
|
// removes the last entry from the collection
|
|
|
|
|
if (chunkcount == 0) return null;
|
|
|
|
|
kelondroRow.Entry r = get(chunkcount - 1);
|
|
|
|
|
kelondroRow.Entry r = get(chunkcount - 1, true);
|
|
|
|
|
if (chunkcount == sortBound) sortBound--;
|
|
|
|
|
chunkcount--;
|
|
|
|
|
this.lastTimeWrote = System.currentTimeMillis();
|
|
|
|
@ -471,7 +471,7 @@ public class kelondroRowCollection {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public kelondroRow.Entry next() {
|
|
|
|
|
return get(p++);
|
|
|
|
|
return get(p++, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void remove() {
|
|
|
|
@ -747,13 +747,13 @@ public class kelondroRowCollection {
|
|
|
|
|
try {
|
|
|
|
|
while (i >= 0) {
|
|
|
|
|
if (compare(i, i + 1) == 0) {
|
|
|
|
|
collection.addUnique(get(i + 1));
|
|
|
|
|
collection.addUnique(get(i + 1, false));
|
|
|
|
|
removeRow(i + 1, false);
|
|
|
|
|
d++;
|
|
|
|
|
if (i + 1 < chunkcount - 1) u = false;
|
|
|
|
|
} else if (collection.size() > 0) {
|
|
|
|
|
// finish collection of double occurrences
|
|
|
|
|
collection.addUnique(get(i + 1));
|
|
|
|
|
collection.addUnique(get(i + 1, false));
|
|
|
|
|
removeRow(i + 1, false);
|
|
|
|
|
d++;
|
|
|
|
|
if (i + 1 < chunkcount - 1) u = false;
|
|
|
|
@ -778,7 +778,7 @@ public class kelondroRowCollection {
|
|
|
|
|
for (int i = 0; i < chunkcount - 1; i++) {
|
|
|
|
|
//System.out.println("*" + new String(get(i).getColBytes(0)));
|
|
|
|
|
if (compare(i, i + 1) > 0) {
|
|
|
|
|
System.out.println("?" + new String(get(i+1).getColBytes(0)));
|
|
|
|
|
System.out.println("?" + new String(get(i + 1, false).getColBytes(0)));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -915,7 +915,7 @@ public class kelondroRowCollection {
|
|
|
|
|
System.out.println("create c : " + (t1 - t0) + " nanoseconds, " + d(testsize, (t1 - t0)) + " entries/nanoseconds");
|
|
|
|
|
kelondroRowCollection d = new kelondroRowCollection(r, testsize);
|
|
|
|
|
for (int i = 0; i < testsize; i++) {
|
|
|
|
|
d.add(c.get(i).getColBytes(0));
|
|
|
|
|
d.add(c.get(i, false).getColBytes(0));
|
|
|
|
|
}
|
|
|
|
|
long t2 = System.nanoTime();
|
|
|
|
|
System.out.println("copy c -> d: " + (t2 - t1) + " nanoseconds, " + d(testsize, (t2 - t1)) + " entries/nanoseconds");
|
|
|
|
|