@Test public void testRange() { System.out.println("range"); List<Neighbor<String, String>> n1 = new ArrayList<>(); List<Neighbor<String, String>> n2 = new ArrayList<>(); for (int i = 1000; i < 1100; i++) { bktree.range(words[i], 1, n1); naive.range(words[i], 1, n2); assertEquals(n1.size(), n2.size()); String[] s1 = new String[n1.size()]; String[] s2 = new String[n2.size()]; for (int j = 0; j < s1.length; j++) { s1[j] = n1.get(j).value; s2[j] = n2.get(j).value; } Arrays.sort(s1); Arrays.sort(s2); for (int j = 0; j < s1.length; j++) { assertEquals(s1[j], s2[j]); } n1.clear(); n2.clear(); } }
@Override public void range(E q, double radius, List<Neighbor<E, E>> neighbors) { if (radius <= 0 || radius != (int) radius) { throw new IllegalArgumentException("The parameter radius has to be an integer: " + radius); } search(root, q, (int) radius, neighbors); }
BKTree implements RNNSearch<E, E>, Serializable { @Override public void range(E q, double radius, List<Neighbor<E, E>> neighbors) { if (radius <= 0 || radius != (int) radius) { throw new IllegalArgumentException("The parameter radius has to be an integer: " + radius); } search(root, q, (int) radius, neighbors); } }
BKTree implements RNNSearch<E, E>, Serializable { @Override public void range(E q, double radius, List<Neighbor<E, E>> neighbors) { if (radius <= 0 || radius != (int) radius) { throw new IllegalArgumentException("The parameter radius has to be an integer: " + radius); } search(root, q, (int) radius, neighbors); } BKTree(Metric<E> distance); }
BKTree implements RNNSearch<E, E>, Serializable { @Override public void range(E q, double radius, List<Neighbor<E, E>> neighbors) { if (radius <= 0 || radius != (int) radius) { throw new IllegalArgumentException("The parameter radius has to be an integer: " + radius); } search(root, q, (int) radius, neighbors); } BKTree(Metric<E> distance); void add(E[] data); void add(Collection<E> data); @Override String toString(); void add(E datum); @Override void range(E q, double radius, List<Neighbor<E, E>> neighbors); void range(E q, int radius, List<Neighbor<E, E>> neighbors); }
BKTree implements RNNSearch<E, E>, Serializable { @Override public void range(E q, double radius, List<Neighbor<E, E>> neighbors) { if (radius <= 0 || radius != (int) radius) { throw new IllegalArgumentException("The parameter radius has to be an integer: " + radius); } search(root, q, (int) radius, neighbors); } BKTree(Metric<E> distance); void add(E[] data); void add(Collection<E> data); @Override String toString(); void add(E datum); @Override void range(E q, double radius, List<Neighbor<E, E>> neighbors); void range(E q, int radius, List<Neighbor<E, E>> neighbors);  }