@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; }
/** * 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; } }