KDTree { public String toString(int indent) { int nextIndent = indent + 1; String tabs = new String(new char[nextIndent]).replace("\0", "\t"); if (loChild != null && hiChild != null) { return String.format("<KDNode: spitDim=%d splitVal=%.3f \n%sLO: %s\n%sHI: %s", this.splitDimension, this.splitValue, tabs, this.loChild.toString(nextIndent), tabs, this.hiChild.toString(nextIndent)); } else if (hiChild!= null) { return String.format("<KDNode: splitDim=%d splitVal=%.3f \n%sHI: %s", this.splitDimension, this.splitValue, tabs, this.hiChild.toString(nextIndent)); } else if (loChild != null) { return String.format("<KDNode: splitDim=%d splitVal=%.3f \n%sLO: %s", this.splitDimension, this.splitValue, tabs, this.loChild.toString(nextIndent)); } else { String all = "<KDNode>:\n"; for (Datum datum: this.items) { all += String.format("%s - %s\n", tabs, datum.metrics()); } return all; } } 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 testToString() throws Exception { setUpVerySimpleCsv(); KDTree node = new KDTree(data, 2); String str = node.toString(); assertThat(str.length(), greaterThan(Integer.valueOf(data.size()))); }