Commit 2a97bd7f authored by Loris Croce's avatar Loris Croce
Browse files

removed useless constructors patch

parent d23d5697
Pipeline #37847 passed with stages
in 3 minutes and 41 seconds
......@@ -29,15 +29,6 @@ public class Patch {
}
}
public Patch(GeoArea geoArea, Float surface, CulturalPractice practice, Product product) {
this.geoArea = geoArea;
this.surface = surface;
this.production = new Production(product, 0.f);
this.practice = practice;
this.yield = this.computeYield();
this.id = 42;
}
public Patch(GeoArea geoArea, Float surface, CulturalPractice practice, Product product, Integer id) {
this.geoArea = geoArea;
this.surface = surface;
......@@ -47,12 +38,6 @@ public class Patch {
this.id = id;
}
public Patch(GeoArea geoArea, Float surface, CulturalPractice practice, Product product, Farm farm) {
this(geoArea, surface, practice, product);
this.farm = farm;
farm.addPatch(this);
}
public Patch(GeoArea geoArea, Float surface, CulturalPractice practice, Product product, Farm farm, Integer id) {
this(geoArea, surface, practice, product, id);
this.farm = farm;
......
......@@ -167,7 +167,7 @@ public class PopulationDynamics extends Dynamics {
transitionProduct.setLabel(context.nextMapObjectWithDistributionInKeysBis(transitionMatrix
.get(patch.getProduction().getProduct().getLabel())));
patchesChanged.add(new Patch(patch.getGeoArea(), patch.getSurface(), transitionPractice,
transitionProduct));
transitionProduct, patch.getId()));
patchesToRemove.add(patch);
}
}
......@@ -245,7 +245,7 @@ public class PopulationDynamics extends Dynamics {
transitionProduct.setLabel(context.nextMapObjectWithDistributionInKeysBis(transitionMatrix
.get(patch.getProduction().getProduct().getLabel())));
patchesChanged.add(new Patch(patch.getGeoArea(), patch.getSurface(), transitionPractice,
transitionProduct));
transitionProduct, patch.getId()));
patchesToRemove.add(patch);
}
}
......
......@@ -27,9 +27,9 @@ public class FarmTest {
public void testProduce() {
// FARM INIT
Farm farm = new Farm(new GeoArea());
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O, new Product("Fourage", Unit.Kg)));
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O, new Product("Fourage", Unit.Kg)));
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O, new Product("Blé", Unit.Kg)));
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O, new Product("Fourage", Unit.Kg), 42));
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O, new Product("Fourage", Unit.Kg), 43));
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O, new Product("Blé", Unit.Kg), 44));
farm.getLivestock().getAnimals().add(new Product("Boeuf", Unit.A), 10.f);
// RATIO INIT
Map<Product, Float> required = new HashMap<>();
......@@ -52,11 +52,11 @@ public class FarmTest {
// FARM INIT
Farm farm = new Farm(new GeoArea());
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O,
new Product("Fourage", Unit.Kg)));
new Product("Fourage", Unit.Kg), 42));
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O,
new Product("Fourage", Unit.Kg)));
new Product("Fourage", Unit.Kg), 43));
farm.addPatch(new Patch(farm.getGeoArea(), 420.f, CulturalPractice.O,
new Product("Blé", Unit.Kg)));
new Product("Blé", Unit.Kg), 44));
farm.getLivestock().getAnimals().add(new Product("Boeuf", Unit.A), 10.f);
// RATIO INIT
Map<Product, Float> required = new HashMap<>();
......
......@@ -41,9 +41,9 @@ public class FarmerTest {
Farm farm = new Farm(geoArea);
List<Patch> patches = new ArrayList<>();
patches.add(new Patch(geoArea, 110.4f, CulturalPractice.I, new Product("Blé", Unit.Kg)));
patches.add(new Patch(geoArea, 9.5f, CulturalPractice.O, new Product("Lentille", Unit.Kg)));
patches.add(new Patch(geoArea, 25.3f, CulturalPractice.S, new Product("Chou", Unit.Kg)));
patches.add(new Patch(geoArea, 110.4f, CulturalPractice.I, new Product("Blé", Unit.Kg),42));
patches.add(new Patch(geoArea, 9.5f, CulturalPractice.O, new Product("Lentille", Unit.Kg), 43));
patches.add(new Patch(geoArea, 25.3f, CulturalPractice.S, new Product("Chou", Unit.Kg), 44));
for (Patch patch : patches) {
patch.setFarm(farm);
}
......
Markdown is supported
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