Commit f4f8b041 authored by patrick.lambert's avatar patrick.lambert
Browse files

with an observer triggered by movement processes

parent 2bce4f91
<hashtable>
<entry>
<java-class>fr.cemagref.simaqualife.kernel.AquaticWorld</java-class>
<!--
<java-class>fr.cemagref.simaqualife.kernel.AquaticWorld</java-class>-->
<java-class>environment.RIOBasinNetworkWithContinent</java-class>
<fr.cemagref.observation.kernel.ObservablesHandler>
<observers>
<environment.RIOBasinNetworkObserverWithContinent>
......
......@@ -5,7 +5,6 @@ import java.util.List;
import java.util.Map;
import environment.OffshoreBasin.OffshoreBasinFunction;
import fr.cemagref.observation.kernel.ObservablesHandler;
import fr.cemagref.simaqualife.kernel.AquaNismsGroup;
import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientParameters;
import fr.cemagref.simaqualife.pilot.Pilot;
......@@ -32,22 +31,12 @@ public abstract class RIOBasinNetwork extends BasinNetwork {
protected transient Time time;
protected static transient ObservablesHandler cobservable;
public ObservablesHandler getCobservable() {
return cobservable;
}
@Override
@InitTransientParameters
public void initTransientParameters(Pilot pilot) {
time = new Time();
if (cobservable == null) {
cobservable = pilot.addObservable(this.getClass());
}
}
......
......@@ -24,6 +24,7 @@ import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.OffshoreBasin.OffshoreBasinFunction;
import fr.cemagref.observation.kernel.ObservablesHandler;
import fr.cemagref.simaqualife.kernel.util.TransientParameters.InitTransientParameters;
import fr.cemagref.simaqualife.pilot.Pilot;
import miscellaneous.QueueMemoryMap;
......@@ -55,6 +56,13 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
private transient Map<String, Path2D.Double> mapContinent;
protected transient ObservablesHandler cobservable;
public ObservablesHandler getCobservable() {
return cobservable;
}
class Record implements Comparable<Record> {
private int order;
......@@ -215,6 +223,10 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
super.initTransientParameters(pilot);
if (cobservable == null) {
cobservable = pilot.addObservable(this.getClass());
}
FileReader reader;
Scanner scanner;
......
......@@ -13,6 +13,7 @@ import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.InshoreBasin;
import environment.RIOBasinNetwork;
import environment.RIOBasinNetworkWithContinent;
import environment.RiverBasin;
import environment.Time;
import environment.Time.Season;
......@@ -247,14 +248,16 @@ public class DisperseAndMigrateToRiverWithMultiNomDistriAndDeathBasin extends Di
}
}
}
System.out.println(this.getClass().getSimpleName());
System.out.println(" total abundance in river basins: " + group.getFishEffective());
System.out.println("female spawners: " + group.getFemaleSpawnerEffective() + " \tmale spawners: "
System.out.println(" female spawners: " + group.getFemaleSpawnerEffective() + " \tmale spawners: "
+ group.getMaleSpawnerEffective());
// --------------------------------------------------------------------------------------------------
// update the observers
// ------------------------------------------------------------------------------------------------------
group.getEnvironment().getCobservable().fireChanges(group.getEnvironment(), pilot.getCurrentTime());
((RIOBasinNetworkWithContinent) group.getEnvironment()).getCobservable().fireChanges((group.getEnvironment()),
pilot.getCurrentTime());
}
}
}
......@@ -10,6 +10,7 @@ import com.thoughtworks.xstream.io.xml.DomDriver;
import environment.Basin;
import environment.OffshoreBasin;
import environment.RIOBasinNetworkWithContinent;
import environment.RiverBasin;
import environment.Time.Season;
import fr.cemagref.simaqualife.kernel.processes.AquaNismsGroupProcess;
......@@ -65,7 +66,9 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
// --------------------------------------------------------------------------------------------------
// update the observers
// ------------------------------------------------------------------------------------------------------
group.getEnvironment().getCobservable().fireChanges(group.getEnvironment(), pilot.getCurrentTime());
((RIOBasinNetworkWithContinent) group.getEnvironment()).getCobservable().fireChanges((group.getEnvironment()),
pilot.getCurrentTime());
} else if (group.getEnvironment().getTime().getSeason(group.getPilot()) == migrationSeasonToReachSummeringOffshore) {
for (OffshoreBasin winteringOffshoreBasin : group.getEnvironment().getWinteringOffshoreBasins()) {
......@@ -93,7 +96,8 @@ public class MigrateBetweenOffshores extends AquaNismsGroupProcess<DiadromousFis
// --------------------------------------------------------------------------------------------------
// update the observers
// ------------------------------------------------------------------------------------------------------
group.getEnvironment().getCobservable().fireChanges(group.getEnvironment(), pilot.getCurrentTime());
((RIOBasinNetworkWithContinent) group.getEnvironment()).getCobservable().fireChanges((group.getEnvironment()),
pilot.getCurrentTime());
}
}
}
\ No newline at end of file
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