use enum for line type instead of string

This commit is contained in:
2018-01-21 11:01:30 +01:00
parent 8f15aba0d5
commit bb7701e7c4
4 changed files with 24 additions and 4 deletions

View File

@@ -12,10 +12,10 @@ public class FileBackedDataSeries implements DataSeries {
private String id;
private String linetype;
private GnuplotLineType linetype;
public FileBackedDataSeries(String id, String title, CsvSummary csvSummary, String linetype) {
public FileBackedDataSeries(String id, String title, CsvSummary csvSummary, GnuplotLineType linetype) {
this.id = id;
this.title = title;
this.csvSummary = csvSummary;

View File

@@ -0,0 +1,20 @@
package org.lucares.recommind.logs;
public enum GnuplotLineType {
LINE("line"),
Points("points");
private String gnuplotLineType;
GnuplotLineType(String gnuplotLineType) {
this.gnuplotLineType = gnuplotLineType;
}
@Override
public String toString() {
return gnuplotLineType;
}
}

View File

@@ -193,7 +193,7 @@ public class PercentilePlot implements ConcretePlotter {
values.size());
CsvSummary csvSummary = new CsvSummary(dataFile, values.size(), maxValue, null);
return new FileBackedDataSeries(id, title, csvSummary, "line");
return new FileBackedDataSeries(id, title, csvSummary, GnuplotLineType.LINE);
}
private void defineXAxis(GnuplotSettings gnuplotSettings) {

View File

@@ -88,7 +88,7 @@ public class ScatterPlot implements ConcretePlotter {
final int id = idCounter.getAndIncrement();
final String title = ConcretePlotter.title(groupResult.getGroupedBy(), csvSummary.getValues());
final DataSeries dataSerie = new FileBackedDataSeries("id"+id, title, csvSummary, "points");
final DataSeries dataSerie = new FileBackedDataSeries("id"+id, title, csvSummary, GnuplotLineType.Points);
if (dataSerie.getValues() > 0) {
dataSeries.add(dataSerie);
}