@Override public Object executeOn(final IScope scope) throws GamaRuntimeException { // We let inits, reflexes run super.executeOn(scope); WeightedTaskStatement active = chooseTask(scope); if (active != null) { return active.executeOn(scope); } return null; }
protected WeightedTaskStatement chooseTask(final IScope scope) throws GamaRuntimeException { Double max = Double.MIN_VALUE; WeightedTaskStatement active = null; for (WeightedTaskStatement c : tasks) { Double weight = c.computeWeight(scope); if (weight > max) { active = c; max = weight; } } return active; }