Commit 32d22cac authored by Loris Croce's avatar Loris Croce
Browse files

clean constructors geoarea

parent 2cc28d85
Pipeline #37890 passed with stages
in 3 minutes and 41 seconds
package fr.inrae.agriterix.simulator; package fr.inrae.agriterix.simulator;
import org.apache.commons.lang3.RandomStringUtils;
import java.util.*; import java.util.*;
public class Flow { public class Flow {
...@@ -47,7 +49,7 @@ public class Flow { ...@@ -47,7 +49,7 @@ public class Flow {
private Stocks quantities; private Stocks quantities;
private List<Product> outputs; private List<Product> outputs;
private Ratio ratio; private Ratio ratio;
private String id; private String label;
public Flow(List<Input> inputs, Stocks quantities, List<Product> outputType, Ratio ratio) { public Flow(List<Input> inputs, Stocks quantities, List<Product> outputType, Ratio ratio) {
this.inputs = inputs; this.inputs = inputs;
...@@ -55,16 +57,16 @@ public class Flow { ...@@ -55,16 +57,16 @@ public class Flow {
this.outputs = outputType; this.outputs = outputType;
this.ratio = ratio; this.ratio = ratio;
// workaround // workaround
this.id = "id"; this.label = RandomStringUtils.randomAlphanumeric(10);
} }
public Flow(List<Input> inputs, Stocks quantities, List<Product> outputType, Ratio ratio, public Flow(List<Input> inputs, Stocks quantities, List<Product> outputType, Ratio ratio,
String id) { String label) {
this.inputs = inputs; this.inputs = inputs;
this.quantities = quantities; this.quantities = quantities;
this.outputs = outputType; this.outputs = outputType;
this.ratio = ratio; this.ratio = ratio;
this.id = id; this.label = label;
} }
public int inputsSize() { public int inputsSize() {
...@@ -118,16 +120,16 @@ public class Flow { ...@@ -118,16 +120,16 @@ public class Flow {
+ "}\n"; + "}\n";
} }
public String getId() { public String getLabel() {
return id; return label;
} }
public List<Product> getOutputs() { public List<Product> getOutputs() {
return outputs; return outputs;
} }
public void setId(String id) { public void setLabel(String label) {
this.id = id; this.label = label;
} }
public Stocks produce() { public Stocks produce() {
......
...@@ -13,7 +13,7 @@ public class GeoArea { ...@@ -13,7 +13,7 @@ public class GeoArea {
public GeoArea(List<Flow> flows, List<Patch> patches) { public GeoArea(List<Flow> flows, List<Patch> patches) {
this.patches = patches; this.patches = patches;
this.flows = flows; this.flows = flows;
this.label = "geoArea"; this.label = RandomStringUtils.randomAlphanumeric(10);
} }
public GeoArea(List<Flow> flows, List<Patch> patches, String label) { public GeoArea(List<Flow> flows, List<Patch> patches, String label) {
...@@ -34,12 +34,6 @@ public class GeoArea { ...@@ -34,12 +34,6 @@ public class GeoArea {
this.label = label; this.label = label;
} }
public GeoArea(Float surface) {
this.patches = new ArrayList<>();
this.flows = new ArrayList<>();
this.label = RandomStringUtils.randomAlphanumeric(10);
}
public GeoArea(String label) { public GeoArea(String label) {
this.patches = new ArrayList<>(); this.patches = new ArrayList<>();
this.flows = new ArrayList<>(); this.flows = new ArrayList<>();
......
...@@ -44,7 +44,7 @@ public class DynamicsLogger { ...@@ -44,7 +44,7 @@ public class DynamicsLogger {
} }
public void logEvolutions(int timestep, Flow flow, String category, Product product, Float value) { public void logEvolutions(int timestep, Flow flow, String category, Product product, Float value) {
logger.info(timestep + separator + category + separator + flow.getId() + separator + product logger.info(timestep + separator + category + separator + flow.getLabel() + separator + product
+ separator + value); + separator + value);
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment