Task t = _sz.provide(_ac.getQuantity() - amount); if (t == null ) { finished = true; break; } else {   double provided  = t.getPreferredValue(AspectType.QUANTITY); amount += provided; agglist.add(t); }
Task t = _sz.provide(_ac.getQuantity() - amount); if (t == null ) { finished = true; break; }    double provided  = t.getPreferredValue(AspectType.QUANTITY);  if (!_ac.validTask(t)) { System.err.println("Filler.execute: AggregationClosure rejected " + " task - " + t); continue; }  amount += provided; agglist.add(t);
  public void execute () {    boolean finished = false;    while (!finished) {      // initialize the aggregation      ArrayList agglist = new ArrayList();      double amount = 0.0;      while (_ac.getQuantity() - amount > 0.0) {	Task t = _sz.provide(_ac.getQuantity() - amount);	if (t == null ) {	  finished = true;	  break;	} else {	  // if we reach here, t is a Task that provides	  // some amount towards our overall amount	  double provided  = t.getPreferredValue(AspectType.QUANTITY);	  amount += provided;	  agglist.add(t);	}      }      if (!agglist.isEmpty()) {	// now we do the aggregation	NewMPTask mpt = _ac.newTask();                //BOZO	mpt.setPreferences(new Vector(_pa.aggregatePreferences(agglist.iterator(),                                                               _gp.getGPFactory())).                           elements());        TRANSPORT_TONS += mpt.getPreferredValue(AspectType.QUANTITY);	Plan plan = ((Task)agglist.get(0)).getPlan();	_gp.createAggregation(agglist.iterator(), mpt, plan, _ard);      }    }    System.out.println("Packer - current aggregated requested transport: " +                       TRANSPORT_TONS + " tons.");  }