Skip to content

Commit

Permalink
Fixes Issue #3108.
Browse files Browse the repository at this point in the history
The new signature of the createAgents() method in IPopulation and
GamaPopulation, introduced in a previous commit
(f001941), had not been propagated to
SimulationPopulation.
  • Loading branch information
AlexisDrogoul committed Jun 1, 2021
1 parent 4a74913 commit 440a254
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -32,6 +32,7 @@
import msi.gama.util.IList;
import msi.gaml.compilation.IAgentConstructor;
import msi.gaml.species.ISpecies;
import msi.gaml.statements.RemoteSequence;
import msi.gaml.variables.IVariable;

@SuppressWarnings ({ "rawtypes", "unchecked" })
Expand Down Expand Up @@ -83,7 +84,7 @@ public Iterable<SimulationAgent> iterable(final IScope scope) {
@Override
public IList<SimulationAgent> createAgents(final IScope scope, final int number,
final List<? extends Map<String, Object>> initialValues, final boolean isRestored,
final boolean toBeScheduled) throws GamaRuntimeException {
final boolean toBeScheduled, final RemoteSequence sequence) throws GamaRuntimeException {
final IList<SimulationAgent> result = GamaListFactory.create(SimulationAgent.class);

for (int i = 0; i < number; i++) {
Expand All @@ -97,7 +98,7 @@ public IList<SimulationAgent> createAgents(final IScope scope, final int number,
add(currentSimulation);
currentSimulation.setOutputs(((ExperimentPlan) host.getSpecies()).getOriginalSimulationOutputs());
if (scope.interrupted()) return null;
initSimulation(scope, currentSimulation, initialValues, i, isRestored, toBeScheduled);
initSimulation(scope, currentSimulation, initialValues, i, isRestored, toBeScheduled, sequence);
if (toBeScheduled) { runner.add(currentSimulation); }
result.add(currentSimulation);
}
Expand All @@ -108,7 +109,7 @@ public IList<SimulationAgent> createAgents(final IScope scope, final int number,

private void initSimulation(final IScope scope, final SimulationAgent sim,
final List<? extends Map<String, Object>> initialValues, final int index, final boolean isRestored,
final boolean toBeScheduled) {
final boolean toBeScheduled, final RemoteSequence sequence) {
scope.getGui().getStatus(scope).waitStatus("Instantiating agents");
if (toBeScheduled) { sim.prepareGuiForSimulation(scope); }

Expand All @@ -126,6 +127,7 @@ private void initSimulation(final IScope scope, final SimulationAgent sim,
sim.initOutputs();
} else {
sim.schedule(scope);
if (sequence != null && !sequence.isEmpty()) { scope.execute(sequence, sim, null); }
}
}
}
Expand Down

0 comments on commit 440a254

Please sign in to comment.