public void set(T val, double dist) { super.setValue(val); this.dist = dist; }
public void set(PhEntry<T> e, double dist) { super.setValue(e.getValue()); System.arraycopy(e.getKey(), 0, getKey(), 0, getKey().length); this.dist = dist; }
/** * * @return False if the value does not match the range, otherwise true. */ private boolean readValue(long pos, int offsPostKey, PhEntry<T> result) { long[] key = result.getKey(); System.arraycopy(valTemplate, 0, key, 0, DIM); PhTreeHelper.applyHcPos(pos, postLen, key); result.setValue( node.getPostPOB(offsPostKey, pos, key) ); if (checker != null && !checker.isValid(key)) { return false; } //Don't set to 'null' here, that interferes with parallel iteration over post/sub //nextSubNode = null; isNextPost1free = !isNextPost1free; return true; }
private boolean readValue(long pos, NodeEntry<T> e, PhEntry<T> result) { //extract postfix final long mask = postLen < 63 ? (~0L)<<postLen+1 : 0; long[] eKey = e.getKey(); PhTreeHelper.applyHcPos(pos, postLen, eKey); for (int i = 0; i < eKey.length; i++) { eKey[i] |= (valTemplate[i] & mask); } if (checker != null && !checker.isValid(eKey)) { return false; } System.arraycopy(eKey, 0, result.getKey(), 0, DIM); result.setValue(e.getValue()); nextSubNode = null; isNextPost1free = !isNextPost1free; return true; }
private boolean readValue(long pos, NodeEntry<T> e, PhEntry<T> result) { //extract postfix final long mask = postLen < 63 ? (~0L)<<postLen+1 : 0; long[] eKey = e.getKey(); PhTreeHelper.applyHcPos(pos, postLen, eKey); for (int i = 0; i < eKey.length; i++) { eKey[i] |= (valTemplate[i] & mask); if (eKey[i] < rangeMin[i] || eKey[i] > rangeMax[i]) { return false; } } if (checker != null && !checker.isValid(eKey)) { return false; } System.arraycopy(eKey, 0, result.getKey(), 0, DIM); result.setValue(e.getValue()); nextSubNode = null; isNextPost1free = !isNextPost1free; return true; }
/** * Get post-fix. * @param offsPostKey * @param key * @param range After the method call, this contains the postfix if the postfix matches the * range. Otherwise it contains only part of the postfix. * @return NodeEntry if the postfix matches the range, otherwise null. */ boolean getPostPOB(int offsPostKey, long hcPos, PhEntry<T> e, long[] rangeMin, long[] rangeMax) { if (DEBUG && ind != null) { throw new IllegalStateException(); } long[] ia = ba; int offs = offsPostKey; long[] key = e.getKey(); final long mask = (~0L)<<postLen; for (int i = 0; i < key.length; i++) { key[i] &= mask; key[i] |= Bits.readArray(ia, offs, postLen); if (key[i] < rangeMin[i] || key[i] > rangeMax[i]) { return false; } offs += postLen; } int valPos = offs2ValPos(offsPostKey, hcPos, key.length); e.setValue(values[valPos]); return true; }