@SuppressWarnings("unchecked") private boolean readValue(long pos, long[] kdKey, Object value, PhEntry<T> result) { if (value instanceof Node) { Node sub = (Node) value; if (checker != null && !checker.isValid(sub.postLenStored()+1, kdKey)) { return false; } System.arraycopy(kdKey, 0, valTemplate, 0, kdKey.length); result.setNodeInternal(sub); } else { if (checker != null && !checker.isValid(kdKey)) { return false; } System.arraycopy(kdKey, 0, result.getKey(), 0, kdKey.length); //ensure that 'node' is set to null result.setValueInternal((T) value); } return true; }
/** * * @return False if the value does not match the range, otherwise true. */ @SuppressWarnings("unchecked") private boolean readValue(int posInNode, long hcPos, PhEntry<T> result) { long[] key = result.getKey(); Object v = node.getEntryPIN(posInNode, hcPos, valTemplate, key); if (v == null) { return false; } if (v instanceof Node) { result.setNodeInternal(v); } else { if (checker != null && !checker.isValid(key)) { return false; } //ensure that 'node' is set to null result.setValueInternal((T) v ); } next = hcPos; return true; }
/** * * @return False if the value does not match the range, otherwise true. */ @SuppressWarnings("unchecked") private boolean readValue(int posInNode, long hcPos, PhEntry<T> result) { long[] key = result.getKey(); Object v = node.getEntryPIN(posInNode, hcPos, valTemplate, key); if (v == null) { return false; } if (v instanceof Node) { result.setNodeInternal(v); } else { if (checker != null && !checker.isValid(key)) { return false; } //ensure that 'node' is set to null result.setValueInternal((T) v ); } next = hcPos; return true; }
/** * Get post-fix. * @param hcPos * @param in The entry to check. * @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. */ @SuppressWarnings("unchecked") <T> boolean checkAndGetEntryNt(long hcPos, Object value, PhEntry<T> result, long[] valTemplate, long[] rangeMin, long[] rangeMax) { if (value instanceof Node) { Node sub = (Node) value; if (!checkAndApplyInfixNt(sub.getInfixLen(), result.getKey(), valTemplate, rangeMin, rangeMax)) { return false; } result.setNodeInternal(sub); } else { long[] inKey = result.getKey(); for (int i = 0; i < inKey.length; i++) { long k = inKey[i]; if (k < rangeMin[i] || k > rangeMax[i]) { return false; } } result.setValueInternal((T) value); } return true; }
return false; result.setNodeInternal(sub); } else { long[] inKey = result.getKey();
@SuppressWarnings("unchecked") private boolean readValue(long pos, long[] kdKey, Object value, PhEntry<T> result) { PhTreeHelper.applyHcPos(pos, postLen, valTemplate); if (value instanceof Node) { Node sub = (Node) value; node.getInfixOfSubNt(kdKey, valTemplate); if (checker != null && !checker.isValid(sub.getPostLen()+1, valTemplate)) { return false; } result.setNodeInternal(sub); } else { long[] resultKey = result.getKey(); final long mask = (~0L)<<postLen; for (int i = 0; i < resultKey.length; i++) { resultKey[i] = (valTemplate[i] & mask) | kdKey[i]; } if (checker != null && !checker.isValid(resultKey)) { return false; } //ensure that 'node' is set to null result.setValueInternal((T) value); } return true; }
@SuppressWarnings("unchecked") private boolean readValue(BSTEntry entry, PhEntry<T> result) { long[] kdKey = entry.getKdKey(); Object value = entry.getValue(); if (value instanceof Node) { Node sub = (Node) value; if (checker != null && !checker.isValid(sub.postLenStored()+1, kdKey)) { return false; } result.setKeyInternal(kdKey); result.setNodeInternal(sub); } else { if (checker != null && !checker.isValid(kdKey)) { return false; } result.setKeyInternal(kdKey); //ensure that 'node' is set to null result.setValueInternal((T) value); } return true; }
@SuppressWarnings("unchecked") private boolean readValue(BSTEntry entry, PhEntry<T> result) { long[] kdKey = entry.getKdKey(); Object value = entry.getValue(); if (value instanceof Node) { Node sub = (Node) value; if (checker != null && !checker.isValid(sub.postLenStored()+1, kdKey)) { return false; } result.setKeyInternal(kdKey); result.setNodeInternal(sub); } else { if (checker != null && !checker.isValid(kdKey)) { return false; } result.setKeyInternal(kdKey); //ensure that 'node' is set to null result.setValueInternal((T) value); } return true; }
/** * * @return False if the value does not match the range, otherwise true. */ @SuppressWarnings("unchecked") private boolean readValue(int pin, long pos, PhEntry<T> result) { Object o = node.checkAndGetEntryPIN(pin, pos, valTemplate, result.getKey(), rangeMin, rangeMax); if (o == null) { return false; } if (o instanceof Node) { Node sub = (Node) o; //skip this for postLen>=63 if (checker != null && sub.getPostLen() < (PhTree11.DEPTH_64-1) && !checker.isValid(sub.getPostLen()+1, valTemplate)) { return false; } result.setNodeInternal(sub); return true; } if (checker != null && !checker.isValid(result.getKey())) { return false; } result.setValueInternal((T) o); return true; }
/** * * @return False if the value does not match the range, otherwise true. */ @SuppressWarnings("unchecked") private boolean readValue(int pin, long pos, PhEntry<T> result) { Object o = node.checkAndGetEntryPIN(pin, pos, valTemplate, result.getKey(), rangeMin, rangeMax); if (o == null) { return false; } if (o instanceof Node) { Node sub = (Node) o; //skip this for postLen>=63 if (checker != null && sub.getPostLen() < (PhTree13.DEPTH_64-1) && !checker.isValid(sub.getPostLen()+1, valTemplate)) { return false; } result.setNodeInternal(sub); return true; } if (checker != null && !checker.isValid(result.getKey())) { return false; } result.setValueInternal((T) o); return true; }
/** * Get post-fix. * @param hcPos * @param in The entry to check. * @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. */ @SuppressWarnings("unchecked") <T> boolean checkAndGetEntry(BSTEntry candidate, PhEntry<T> result, long[] rangeMin, long[] rangeMax) { Object value = candidate.getValue(); if (value instanceof Node) { Node sub = (Node) value; if (!checkInfix(sub.getInfixLen(), candidate.getKdKey(), rangeMin, rangeMax)) { return false; } result.setKeyInternal(candidate.getKdKey()); result.setNodeInternal(sub); return true; } else if (BitsLong.checkRange(candidate.getKdKey(), rangeMin, rangeMax)) { result.setKeyInternal(candidate.getKdKey()); result.setValueInternal((T) value); return true; } else { return false; } }
/** * Get post-fix. * @param hcPos * @param in The entry to check. * @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. */ @SuppressWarnings("unchecked") <T> boolean checkAndGetEntry(BSTEntry candidate, PhEntry<T> result, long[] rangeMin, long[] rangeMax) { Object value = candidate.getValue(); if (value instanceof Node) { Node sub = (Node) value; if (!checkInfix(sub.getInfixLen(), candidate.getKdKey(), rangeMin, rangeMax)) { return false; } result.setKeyInternal(candidate.getKdKey()); result.setNodeInternal(sub); return true; } else if (BitsLong.checkRange(candidate.getKdKey(), rangeMin, rangeMax)) { result.setKeyInternal(candidate.getKdKey()); result.setValueInternal((T) value); return true; } else { return false; } }