remove duplicate enums
This commit is contained in:
@@ -1,16 +1,12 @@
|
|||||||
package org.lucares.pdbui;
|
package org.lucares.pdbui;
|
||||||
|
|
||||||
import org.lucares.pdb.plot.api.AggregateHandler;
|
import org.lucares.pdb.plot.api.AggregateHandler;
|
||||||
import org.lucares.pdb.plot.api.AxisScale;
|
|
||||||
import org.lucares.pdb.plot.api.Limit;
|
|
||||||
import org.lucares.pdb.plot.api.MeanAggregate;
|
import org.lucares.pdb.plot.api.MeanAggregate;
|
||||||
import org.lucares.pdb.plot.api.NullAggregate;
|
import org.lucares.pdb.plot.api.NullAggregate;
|
||||||
import org.lucares.pdb.plot.api.PercentileAggregate;
|
import org.lucares.pdb.plot.api.PercentileAggregate;
|
||||||
import org.lucares.pdb.plot.api.PlotSettings;
|
import org.lucares.pdb.plot.api.PlotSettings;
|
||||||
import org.lucares.pdbui.domain.Aggregate;
|
import org.lucares.pdbui.domain.Aggregate;
|
||||||
import org.lucares.pdbui.domain.LimitBy;
|
|
||||||
import org.lucares.pdbui.domain.PlotRequest;
|
import org.lucares.pdbui.domain.PlotRequest;
|
||||||
import org.lucares.pdbui.domain.YAxis;
|
|
||||||
|
|
||||||
class PlotSettingsTransformer {
|
class PlotSettingsTransformer {
|
||||||
static PlotSettings toSettings(final PlotRequest request) {
|
static PlotSettings toSettings(final PlotRequest request) {
|
||||||
@@ -22,10 +18,10 @@ class PlotSettingsTransformer {
|
|||||||
result.setHeight(request.getHeight());
|
result.setHeight(request.getHeight());
|
||||||
result.setWidth(request.getWidth());
|
result.setWidth(request.getWidth());
|
||||||
result.setLimit(request.getLimit());
|
result.setLimit(request.getLimit());
|
||||||
result.setLimitBy(toLimit(request.getLimitBy()));
|
result.setLimitBy(request.getLimitBy());
|
||||||
result.setDateFrom(request.getDateFrom());
|
result.setDateFrom(request.getDateFrom());
|
||||||
result.setDateRange(request.getDateRange());
|
result.setDateRange(request.getDateRange());
|
||||||
result.setYAxisScale(toAxisScale(request.getAxisScale()));
|
result.setYAxisScale(request.getAxisScale());
|
||||||
result.setAggregate(toAggregateInternal(request.getAggregate()));
|
result.setAggregate(toAggregateInternal(request.getAggregate()));
|
||||||
result.setKeyOutside(request.isKeyOutside());
|
result.setKeyOutside(request.isKeyOutside());
|
||||||
|
|
||||||
@@ -44,34 +40,4 @@ class PlotSettingsTransformer {
|
|||||||
}
|
}
|
||||||
throw new IllegalStateException("unhandled enum: " + aggregate);
|
throw new IllegalStateException("unhandled enum: " + aggregate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AxisScale toAxisScale(final YAxis yAxis) {
|
|
||||||
switch (yAxis) {
|
|
||||||
case LINEAR:
|
|
||||||
return AxisScale.LINEAR;
|
|
||||||
case LOG10:
|
|
||||||
return AxisScale.LOG10;
|
|
||||||
case LOG2:
|
|
||||||
return AxisScale.LOG2;
|
|
||||||
default:
|
|
||||||
throw new IllegalStateException("unhandled enum: " + yAxis);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Limit toLimit(final LimitBy limitBy) {
|
|
||||||
switch (limitBy) {
|
|
||||||
case NO_LIMIT:
|
|
||||||
return Limit.NO_LIMIT;
|
|
||||||
case FEWEST_VALUES:
|
|
||||||
return Limit.FEWEST_VALUES;
|
|
||||||
case MOST_VALUES:
|
|
||||||
return Limit.MOST_VALUES;
|
|
||||||
case MAX_VALUE:
|
|
||||||
return Limit.MAX_VALUE;
|
|
||||||
case MIN_VALUE:
|
|
||||||
return Limit.MIN_VALUE;
|
|
||||||
default:
|
|
||||||
throw new IllegalStateException("unhandled enum: " + limitBy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package org.lucares.pdbui.domain;
|
|
||||||
|
|
||||||
public enum LimitBy {
|
|
||||||
NO_LIMIT, MOST_VALUES, FEWEST_VALUES, MAX_VALUE, MIN_VALUE
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,9 @@ package org.lucares.pdbui.domain;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lucares.pdb.plot.api.AxisScale;
|
||||||
|
import org.lucares.pdb.plot.api.Limit;
|
||||||
|
|
||||||
public class PlotRequest {
|
public class PlotRequest {
|
||||||
private String query;
|
private String query;
|
||||||
|
|
||||||
@@ -11,9 +14,9 @@ public class PlotRequest {
|
|||||||
|
|
||||||
private List<String> groupBy;
|
private List<String> groupBy;
|
||||||
|
|
||||||
private LimitBy limitBy = LimitBy.NO_LIMIT;
|
private Limit limitBy = Limit.NO_LIMIT;
|
||||||
|
|
||||||
private YAxis yAxis = YAxis.LINEAR;
|
private AxisScale yAxis = AxisScale.LINEAR;
|
||||||
|
|
||||||
private int limit = Integer.MAX_VALUE;
|
private int limit = Integer.MAX_VALUE;
|
||||||
|
|
||||||
@@ -62,11 +65,11 @@ public class PlotRequest {
|
|||||||
this.groupBy = groupBy;
|
this.groupBy = groupBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LimitBy getLimitBy() {
|
public Limit getLimitBy() {
|
||||||
return limitBy;
|
return limitBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLimitBy(final LimitBy limitBy) {
|
public void setLimitBy(final Limit limitBy) {
|
||||||
this.limitBy = limitBy;
|
this.limitBy = limitBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,11 +100,11 @@ public class PlotRequest {
|
|||||||
this.dateRange = dateRange;
|
this.dateRange = dateRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public YAxis getAxisScale() {
|
public AxisScale getAxisScale() {
|
||||||
return yAxis;
|
return yAxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAxisScale(final YAxis yAxis) {
|
public void setAxisScale(final AxisScale yAxis) {
|
||||||
this.yAxis = yAxis;
|
this.yAxis = yAxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package org.lucares.pdbui.domain;
|
|
||||||
|
|
||||||
public enum YAxis {
|
|
||||||
LINEAR, LOG10, LOG2
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user