Commit 074ce266 authored by Poulet Camille's avatar Poulet Camille
Browse files

Change season to migrate in offshore basin

parent d123799b
......@@ -5,6 +5,8 @@ import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.Basin;
import environment.InshoreBasin;
import environment.OffshoreBasin;
import environment.OffshoreBasin.OffshoreBasinFunction;
import environment.RiverBasin;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
......@@ -17,7 +19,8 @@ import org.openide.util.lookup.ServiceProvider;
@ServiceProvider(service = AquaNismsGroupProcess.class)
public class MigrateToOffshore extends AquaNismsGroupProcess<DiadromousFish, DiadromousFishGroup> {
private Season migrationSeasonToReachSummeringOffshore = Season.SPRING;
private Season migrationSeasonToReachOffshore = Season.AUTOMN;
private OffshoreBasinFunction offshoreDestination = OffshoreBasinFunction.WINTERING;
public static void main(String[] args) {
......@@ -31,7 +34,7 @@ public class MigrateToOffshore extends AquaNismsGroupProcess<DiadromousFish, Dia
Basin destination = null;
if (group.getEnvironment().getTime().getSeason(group.getPilot()) == migrationSeasonToReachSummeringOffshore){
if (group.getEnvironment().getTime().getSeason(group.getPilot()) == migrationSeasonToReachOffshore){
for (InshoreBasin inshoreBasin : group.getEnvironment().getInshoreBasins()){
......@@ -42,8 +45,10 @@ public class MigrateToOffshore extends AquaNismsGroupProcess<DiadromousFish, Dia
while (fishIterator.hasNext()) {
DiadromousFish fish = fishIterator.next();
destination = ((RiverBasin) fish.getMemorisedBasin()).getConnectedSummeringOffshoreBasin();
if (offshoreDestination == OffshoreBasinFunction.WINTERING)
destination = ((RiverBasin) fish.getMemorisedBasin()).getConnectedWinteringOffshoreBasin();
else if (offshoreDestination == OffshoreBasinFunction.SUMMERING)
destination = ((RiverBasin) fish.getMemorisedBasin()).getConnectedSummeringOffshoreBasin();
// add fish with its new position to destination basin
fish.setPosition(destination);
......
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