コード例 #1
0
 @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;
 }
コード例 #2
0
 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;
 }