DecisionTreeData extends FeatureMatrixWithLabelsOnHeapData implements AutoCloseable { public void sort(int col) { sort(col, 0, getFeatures().length - 1); } DecisionTreeData(double[][] features, double[] labels, boolean buildIdx); DecisionTreeData filter(TreeFilter filter); void sort(int col); double[] getCopiedOriginalLabels(); void setCopiedOriginalLabels(double[] copiedOriginalLabels); @Override void close(); TreeDataIndex createIndexByFilter(int depth, TreeFilter filter);  }
@Test public void testSort() { double[][] features = new double[][]{{4, 1}, {3, 3}, {2, 0}, {1, 4}, {0, 2}}; double[] labels = new double[]{0, 1, 2, 3, 4}; DecisionTreeData data = new DecisionTreeData(features, labels, useIdx); data.sort(0); assertArrayEquals(new double[][]{{0, 2}, {1, 4}, {2, 0}, {3, 3}, {4, 1}}, features); assertArrayEquals(new double[]{4, 3, 2, 1, 0}, labels, 1e-10); data.sort(1); assertArrayEquals(new double[][]{{2, 0}, {4, 1}, {0, 2}, {3, 3}, {1, 4}}, features); assertArrayEquals(new double[]{2, 0, 4, 1, 3}, labels, 1e-10); }