Permalink
Browse files

Queries work!

  • Loading branch information...
tzaeschke committed Apr 9, 2018
1 parent 9d3bc00 commit 27c11d32bef8ea094ca930d7c13cc29ca497f5ca
View
@@ -6,6 +6,8 @@
- The node iterators should now the global min/maxRange to efficiently check kdKeys without
popping out of the local iterators and then popping in again if it is a mismatch.
- NodeIteratorFull: remove applying valTemplate from readingNt keys (for-loop in readValue).
- NodeIteratorListReuse: niAllIterator: why check window here? Either check 'distance; or do noch check at all...!!!
- Insert the following line into MaxKTreeI.getKdKey() and run TestRangeQuery.testNeighbour4_5of4
System.out.println("READING: " + Arrays.toString(kdKey) + " / " + Arrays.toString(key) + " obj=" + System.identityHashCode(this));
@@ -4,6 +4,7 @@
import ch.ethz.globis.phtree.PhTreeHelperHD;
import ch.ethz.globis.phtree.util.BitsLong;
import ch.ethz.globis.phtree.v11hd2.BitsHD;
/**
* High-dimensional unsigned bitstrings (actually, simply unsigned bitstrings).
@@ -149,13 +150,20 @@ public static void readArrayHD(long[] ba, int offsetBit, int entryLen, long[] ou
if (entryLen == 0) {
return;
}
int subEntryLen = mod65x(entryLen);
for (int i = 0; i < out.length; i++) {
out[i] = BitsLong.readArray(ba, offsetBit, subEntryLen);
int iStart = out.length - BitsHD.div64(entryLen-1) - 1;
int subEntryLen = mod65x(entryLen);
//first read a partionl chunk
long mask = subEntryLen == 64 ? 0 : (-1L) << subEntryLen;
out[iStart] = (out[iStart] & mask) | (BitsLong.readArray(ba, offsetBit, subEntryLen) & ~mask);
//TODO make/use read64()/write64 functions?
offsetBit += subEntryLen;
for (int i = iStart+1; i < out.length; i++) {
out[i] = BitsLong.readArray(ba, offsetBit, 64);
//TODO make/use read64()/write64 functions?
offsetBit += subEntryLen;
subEntryLen = 64;
offsetBit += 64;
}
}
@@ -33,7 +33,7 @@
/** Bias towards using AHC. AHC is used if (sizeLHC*AHC_LHC_BIAS) greater than (sizeAHC) */
public static final double AHC_LHC_BIAS = 2.0;
public static final int NT_THRESHOLD = 150;
private Object[] values;
private int entryCnt = 0;
@@ -616,6 +616,10 @@ Object getEntryPIN(int posInNode, long[] hcPos, long[] subNodePrefix, long[] out
*/
private void writeEntry(int pin, long[] hcPos, long[] newKey, Object value) {
if (isNT()) {
if (value instanceof Node) {
int newSubInfixLen = postLen - ((Node)value).getPostLen() - 1;
((Node)value).setInfixLen(newSubInfixLen);
}
ntPut(hcPos, newKey, value);
return;
}
@@ -1,6 +1,7 @@
package ch.ethz.globis.phtree.v11hd2;
import java.util.Arrays;
import java.util.Objects;
import ch.ethz.globis.phtree.PhTreeHelperHD;
import ch.ethz.globis.phtree.util.BitsLong;
@@ -373,5 +374,14 @@ public static final boolean hasConflictingBits(long[] v1, long[] v2, int rangeMi
}
return false;
}
public static String toString(Object o) {
if (o instanceof long[]) {
return Arrays.toString((long[]) o);
} else if (o instanceof double[]) {
return Arrays.toString((double[]) o);
}
return Objects.toString(o);
}
}
Oops, something went wrong.

0 comments on commit 27c11d3

Please sign in to comment.