node.left = computeChild(left,leftIndexes); node.right = computeChild(right,rightIndexes);
node.left = computeChild(left,leftIndexes); node.right = computeChild(right,rightIndexes);
@Test public void computeChild() { KdTreeConstructor<double[]> alg = new KdTreeConstructor<>(distance); List<double[]> points = new ArrayList<>(); GrowQueue_I32 data = new GrowQueue_I32(); // empty lists should be null KdTree.Node n = new KdTree.Node(); n.point = new double[2]; n.index = 1; KdTree.Node found = alg.computeChild(points,data); assertNull(found); // add a point points.add( new double[2] ); data.add(2); found = alg.computeChild(points,data); assertTrue(found.isLeaf()); assertSame(found.point, points.get(0)); assertEquals(found.index, data.get(0)); // for all the other cases it will create a branch. testing that will require a bit more work... }