TableConverter { public int[][] intMatrix() { return intMatrix(table.numericColumns()); } TableConverter(Relation table); double[][] doubleMatrix(); double[][] doubleMatrix(int... columnIndicies); double[][] doubleMatrix(String... columnNames); float[][] floatMatrix(); float[][] floatMatrix(int... columnIndicies); float[][] floatMatrix(String... columnNames); int[][] intMatrix(); int[][] intMatrix(int... columnIndicies); int[][] intMatrix(String... columnNames);  }
@Test public void asIntMatrix() { double[] array1 = {0, 1, 2}; double[] array2 = {0, 1, 2}; DoubleColumn c1 = DoubleColumn.create("1", array1); DoubleColumn c2 = DoubleColumn.create("2", array2); Table table = Table.create("test", c1, c2); int[][] expected = {{0, 0}, {1, 1}, {2, 2}}; int[][] results = table.as().intMatrix(); assertTrue(Arrays.deepEquals(expected, results)); }
@Test public void asIntMatrixColArgs() { double[] array1 = {0, 1, 1}; double[] array2 = {0, 1, 2}; double[] array3 = {0, 1, 3}; DoubleColumn c1 = DoubleColumn.create("1", array1); DoubleColumn c2 = DoubleColumn.create("2", array2); DoubleColumn c3 = DoubleColumn.create("3", array3); Table table = Table.create("test", c1, c2, c3); int[][] expected = {{0, 0}, {1, 1}, {1, 3}}; int[][] results = table.as().intMatrix("1", "3"); assertTrue(Arrays.deepEquals(expected, results)); }