@Test public void testWriteCsvFile() throws Exception { File referenceFile = new File(GraphModelToCsvExporterTest.class.getResource("export.csv").toURI()); File testFile = new File(referenceFile.getParent() + "/testExport.csv"); System.out.println("writeCsvFile: " + testFile.getAbsolutePath()); GraphModelToCsvExporter instance = new GraphModelToCsvExporter(createTestModel(), testFile, ";", '.', new DateTimeRenderer(), -1); instance.writeCsvFile(); boolean success = FilesTestTools.compareFiles(testFile, referenceFile); testFile.delete(); Assert.assertTrue(success); }
public void writeCsvFile() throws IOException { ConcurrentSkipListSet<Long> xValues = new ConcurrentSkipListSet<Long>(); Iterator<Entry<String, AbstractGraphRow>> it = model.entrySet().iterator(); ArrayList<String> rawsName = new ArrayList<String>(); while (it.hasNext()) { Entry<String, AbstractGraphRow> row = it.next(); rawsName.add(row.getKey()); Iterator<Entry<Long, AbstractGraphPanelChartElement>> itRow = row.getValue().iterator(); while (itRow.hasNext()) { Entry<Long, AbstractGraphPanelChartElement> element = itRow.next(); if (element.getValue().isPointRepresentative(hideNonRepValLimit)) { xValues.add(element.getKey()); } } } BufferedWriter writer = new BufferedWriter(new FileWriter(destFile)); writer.write(xAxisLabel); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); writer.write(rawsName.get(i)); } writer.newLine(); writer.flush(); Iterator<Long> itXValues = xValues.iterator(); while (itXValues.hasNext()) { long xValue = itXValues.next(); writer.write(xValueFormatter(xValue)); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); AbstractGraphRow row = model.get(rawsName.get(i)); AbstractGraphPanelChartElement value = row.getElement(xValue); if (value != null) { writer.write("" + value.getValue()); } } writer.newLine(); writer.flush(); } writer.close(); }
GraphModelToCsvExporter { public void writeCsvFile() throws IOException { ConcurrentSkipListSet<Long> xValues = new ConcurrentSkipListSet<Long>(); Iterator<Entry<String, AbstractGraphRow>> it = model.entrySet().iterator(); ArrayList<String> rawsName = new ArrayList<String>(); while (it.hasNext()) { Entry<String, AbstractGraphRow> row = it.next(); rawsName.add(row.getKey()); Iterator<Entry<Long, AbstractGraphPanelChartElement>> itRow = row.getValue().iterator(); while (itRow.hasNext()) { Entry<Long, AbstractGraphPanelChartElement> element = itRow.next(); if (element.getValue().isPointRepresentative(hideNonRepValLimit)) { xValues.add(element.getKey()); } } } BufferedWriter writer = new BufferedWriter(new FileWriter(destFile)); writer.write(xAxisLabel); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); writer.write(rawsName.get(i)); } writer.newLine(); writer.flush(); Iterator<Long> itXValues = xValues.iterator(); while (itXValues.hasNext()) { long xValue = itXValues.next(); writer.write(xValueFormatter(xValue)); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); AbstractGraphRow row = model.get(rawsName.get(i)); AbstractGraphPanelChartElement value = row.getElement(xValue); if (value != null) { writer.write("" + value.getValue()); } } writer.newLine(); writer.flush(); } writer.close(); } }
GraphModelToCsvExporter { public void writeCsvFile() throws IOException { ConcurrentSkipListSet<Long> xValues = new ConcurrentSkipListSet<Long>(); Iterator<Entry<String, AbstractGraphRow>> it = model.entrySet().iterator(); ArrayList<String> rawsName = new ArrayList<String>(); while (it.hasNext()) { Entry<String, AbstractGraphRow> row = it.next(); rawsName.add(row.getKey()); Iterator<Entry<Long, AbstractGraphPanelChartElement>> itRow = row.getValue().iterator(); while (itRow.hasNext()) { Entry<Long, AbstractGraphPanelChartElement> element = itRow.next(); if (element.getValue().isPointRepresentative(hideNonRepValLimit)) { xValues.add(element.getKey()); } } } BufferedWriter writer = new BufferedWriter(new FileWriter(destFile)); writer.write(xAxisLabel); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); writer.write(rawsName.get(i)); } writer.newLine(); writer.flush(); Iterator<Long> itXValues = xValues.iterator(); while (itXValues.hasNext()) { long xValue = itXValues.next(); writer.write(xValueFormatter(xValue)); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); AbstractGraphRow row = model.get(rawsName.get(i)); AbstractGraphPanelChartElement value = row.getElement(xValue); if (value != null) { writer.write("" + value.getValue()); } } writer.newLine(); writer.flush(); } writer.close(); } GraphModelToCsvExporter(
            AbstractMap<String, AbstractGraphRow> rows,
            File destFile,
            String csvSeparator,
            String xAxisLabel,
            NumberRenderer xAxisRenderer,
            int hideNonRepValLimit);  GraphModelToCsvExporter(
            AbstractMap<String, AbstractGraphRow> rows,
            File destFile,
            String csvSeparator,
            char decimalSeparator,
            NumberRenderer renderer,
            int hideNonRepValLimit); }
GraphModelToCsvExporter { public void writeCsvFile() throws IOException { ConcurrentSkipListSet<Long> xValues = new ConcurrentSkipListSet<Long>(); Iterator<Entry<String, AbstractGraphRow>> it = model.entrySet().iterator(); ArrayList<String> rawsName = new ArrayList<String>(); while (it.hasNext()) { Entry<String, AbstractGraphRow> row = it.next(); rawsName.add(row.getKey()); Iterator<Entry<Long, AbstractGraphPanelChartElement>> itRow = row.getValue().iterator(); while (itRow.hasNext()) { Entry<Long, AbstractGraphPanelChartElement> element = itRow.next(); if (element.getValue().isPointRepresentative(hideNonRepValLimit)) { xValues.add(element.getKey()); } } } BufferedWriter writer = new BufferedWriter(new FileWriter(destFile)); writer.write(xAxisLabel); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); writer.write(rawsName.get(i)); } writer.newLine(); writer.flush(); Iterator<Long> itXValues = xValues.iterator(); while (itXValues.hasNext()) { long xValue = itXValues.next(); writer.write(xValueFormatter(xValue)); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); AbstractGraphRow row = model.get(rawsName.get(i)); AbstractGraphPanelChartElement value = row.getElement(xValue); if (value != null) { writer.write("" + value.getValue()); } } writer.newLine(); writer.flush(); } writer.close(); } GraphModelToCsvExporter(
            AbstractMap<String, AbstractGraphRow> rows,
            File destFile,
            String csvSeparator,
            String xAxisLabel,
            NumberRenderer xAxisRenderer,
            int hideNonRepValLimit);  GraphModelToCsvExporter(
            AbstractMap<String, AbstractGraphRow> rows,
            File destFile,
            String csvSeparator,
            char decimalSeparator,
            NumberRenderer renderer,
            int hideNonRepValLimit); void writeCsvFile(); }
GraphModelToCsvExporter { public void writeCsvFile() throws IOException { ConcurrentSkipListSet<Long> xValues = new ConcurrentSkipListSet<Long>(); Iterator<Entry<String, AbstractGraphRow>> it = model.entrySet().iterator(); ArrayList<String> rawsName = new ArrayList<String>(); while (it.hasNext()) { Entry<String, AbstractGraphRow> row = it.next(); rawsName.add(row.getKey()); Iterator<Entry<Long, AbstractGraphPanelChartElement>> itRow = row.getValue().iterator(); while (itRow.hasNext()) { Entry<Long, AbstractGraphPanelChartElement> element = itRow.next(); if (element.getValue().isPointRepresentative(hideNonRepValLimit)) { xValues.add(element.getKey()); } } } BufferedWriter writer = new BufferedWriter(new FileWriter(destFile)); writer.write(xAxisLabel); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); writer.write(rawsName.get(i)); } writer.newLine(); writer.flush(); Iterator<Long> itXValues = xValues.iterator(); while (itXValues.hasNext()) { long xValue = itXValues.next(); writer.write(xValueFormatter(xValue)); for (int i = 0; i < rawsName.size(); i++) { writer.write(csvSeparator); AbstractGraphRow row = model.get(rawsName.get(i)); AbstractGraphPanelChartElement value = row.getElement(xValue); if (value != null) { writer.write("" + value.getValue()); } } writer.newLine(); writer.flush(); } writer.close(); } GraphModelToCsvExporter(
            AbstractMap<String, AbstractGraphRow> rows,
            File destFile,
            String csvSeparator,
            String xAxisLabel,
            NumberRenderer xAxisRenderer,
            int hideNonRepValLimit);  GraphModelToCsvExporter(
            AbstractMap<String, AbstractGraphRow> rows,
            File destFile,
            String csvSeparator,
            char decimalSeparator,
            NumberRenderer renderer,
            int hideNonRepValLimit); void writeCsvFile();  }