private long[] returnAnyValue(long[] ret, long[] key, Node node) { //First, get correct prefix. long mask = (-1L) << (node.getPostLen()+1); for (int i = 0; i < dims; i++) { ret[i] = key[i] & mask; } NodeIteratorFullNoGC<T> ni = new NodeIteratorFullNoGC<>(dims, ret); //This allows writing the result directly into 'ret' PhEntry<T> result = new PhEntry<>(ret, null); ni.init(node, null); while (ni.increment(result)) { if (result.hasNodeInternal()) { //traverse sub node ni.init((Node) result.getNodeInternal(), null); } else { //Never return closest key if we look for nMin>1 keys! if (nMin > 1 && Arrays.equals(key, result.getKey())) { //Never return a perfect match if we look for nMin>1 keys! //otherwise the distance is too small. //This check should be cheap and will not be executed more than once anyway. continue; } return ret; } } throw new IllegalStateException(); }
private long[] returnAnyValue(long[] ret, long[] key, Node node) { //First, get correct prefix. long mask = (-1L) << (node.getPostLen()+1); for (int i = 0; i < dims; i++) { ret[i] = key[i] & mask; } NodeIteratorFullNoGC<T> ni = new NodeIteratorFullNoGC<>(dims, ret); //This allows writing the result directly into 'ret' PhEntry<T> result = new PhEntry<>(ret, null); ni.init(node, null); while (ni.increment(result)) { if (result.hasNodeInternal()) { //traverse sub node ni.init((Node) result.getNodeInternal(), null); } else { //Never return closest key if we look for nMin>1 keys! if (nMin > 1 && Arrays.equals(key, result.getKey())) { //Never return a perfect match if we look for nMin>1 keys! //otherwise the distance is too small. //This check should be cheap and will not be executed more than once anyway. continue; } return ret; } } throw new IllegalStateException(); }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorFullNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorFullNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorFullNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorFullNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal(), result.getKey()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
private void findNextElement() { PhEntry<T> result = resultFree; while (!stack.isEmpty()) { NodeIteratorNoGC<T> p = stack.peek(); while (p.increment(result)) { if (result.hasNodeInternal()) { p = stack.prepareAndPush((Node) result.getNodeInternal(), result.getKey()); continue; } else { resultFree = resultToReturn; resultToReturn = result; return; } } // no matching (more) elements found stack.pop(); } //finished isFinished = true; }
ni.init(node, null); while (ni.increment(result)) { if (result.hasNodeInternal()) {
ni.init(node, null); while (ni.increment(result)) { if (result.hasNodeInternal()) {