KDTree { public boolean isInsideBoundaries(Datum queryDatum) { RealVector vector = queryDatum.metrics(); for (int i=0; i<k; i++) { if (vector.getEntry(i) < this.boundaries[i][0] || vector.getEntry(i) > this.boundaries[i][1]) { return false; } } return true; } KDTree(List<Datum> data, int leafCapacity); RealVector[] getMinMaxDistanceVectors(Datum queryDatum); double[] estimateL2DistanceSquared(Datum queryDatum); boolean isInsideBoundaries(Datum queryDatum); List<Datum> getItems(); RealVector getMean(); double[][] getBoundaries(); KDTree getLoChild(); KDTree getHiChild(); boolean isLeaf(); int getnBelow(); int getSplitDimension(); String toString(int indent); String toString();  }
@Test public void testIsInsideBoundaries() throws Exception { this.setUpVerySimpleCsv(); KDTree node; node = new KDTree(data, 2); for (Datum datum : data) { assertTrue(node.isInsideBoundaries(datum)); } }
@Test public void testIsOutsideBoundaries() throws Exception { this.setUpVerySimpleCsv(); KDTree node = new KDTree(data, 2); double[] metrics = {-1, -1, -1}; Datum newdatum = new Datum(data.get(0), new ArrayRealVector(metrics)); assertFalse(node.isInsideBoundaries(newdatum)); }