@Test public void write1() throws IOException { Point2DDataset dataset = Point2DDatasets.lineData(new ArrayDouble(0,2,4,1,3,5), new ArrayDouble(0,0.1,0.2,0.3,0.4,0.5)); String csv = CommaSeparatedValueIO.write(dataset); assertThat(csv, equalTo("x,y\n0,0\n2,0.1\n4,0.2\n1,0.3\n3,0.4\n5,0.5")); }
public static void write(Point2DDataset dataset, Writer writer) throws IOException { writer.write("x,y"); for (int i = 0; i < dataset.getCount(); i++) { writer.append("\n"); writer.append(format.format(dataset.getXValues().getDouble(i))); writer.append(','); writer.append(format.format(dataset.getYValues().getDouble(i))); } }
CommaSeparatedValueIO { public static void write(Point2DDataset dataset, Writer writer) throws IOException { writer.write("x,y"); for (int i = 0; i < dataset.getCount(); i++) { writer.append("\n"); writer.append(format.format(dataset.getXValues().getDouble(i))); writer.append(','); writer.append(format.format(dataset.getYValues().getDouble(i))); } } }
CommaSeparatedValueIO { public static void write(Point2DDataset dataset, Writer writer) throws IOException { writer.write("x,y"); for (int i = 0; i < dataset.getCount(); i++) { writer.append("\n"); writer.append(format.format(dataset.getXValues().getDouble(i))); writer.append(','); writer.append(format.format(dataset.getYValues().getDouble(i))); } }  }
CommaSeparatedValueIO { public static void write(Point2DDataset dataset, Writer writer) throws IOException { writer.write("x,y"); for (int i = 0; i < dataset.getCount(); i++) { writer.append("\n"); writer.append(format.format(dataset.getXValues().getDouble(i))); writer.append(','); writer.append(format.format(dataset.getYValues().getDouble(i))); } }  static void write(Point2DDataset dataset, Writer writer); static String write(Point2DDataset dataset); static Point2DDataset read(Reader reader); static Point2DDataset read(String string); }
CommaSeparatedValueIO { public static void write(Point2DDataset dataset, Writer writer) throws IOException { writer.write("x,y"); for (int i = 0; i < dataset.getCount(); i++) { writer.append("\n"); writer.append(format.format(dataset.getXValues().getDouble(i))); writer.append(','); writer.append(format.format(dataset.getYValues().getDouble(i))); } }  static void write(Point2DDataset dataset, Writer writer); static String write(Point2DDataset dataset); static Point2DDataset read(Reader reader); static Point2DDataset read(String string);  }