public void createPhasedAllocationResult(TaskDeficit td, int currentBucket, Inventory inv, LogisticsInventoryPG thePG,
public void createPhasedAllocationResult(TaskDeficit td, Inventory inv, LogisticsInventoryPG thePG,
  public void createPhasedAllocationResult(TaskDeficit td, int currentBucket,                                           Inventory inv, LogisticsInventoryPG thePG,                                           boolean success) {    ArrayList phasedResults = new ArrayList();    double rollupQty = 0;    AspectValue avs[];    Task task = td.getTask();    long endOfLevel2 = inventoryPlugin.getEndOfLevelTwo();    long endOfTask = (long)PluginHelper.getPreferenceBestValue(task, AspectType.END_TIME);    // Do not process tasks whose end times are beyond level 2    if (endOfTask > endOfLevel2) {      return;    }    //initialize the rollup array depending on the verb --sigh...    if (task.getVerb().equals(Constants.Verb.WITHDRAW)) {      avs = new AspectValue[2];    } else {      avs = new AspectValue[3];    }    ArrayList phases = (ArrayList)td.getAllocationPhases();    if (phases.isEmpty()) {      //if we totally fail      createFailedAllocation(task, inv, thePG);      return;    }    int rollupEnd = ((AllocPhase) phases.get(phases.size() - 1)).endBucket;    int rollupStart = ((AllocPhase) phases.get(0)).startBucket;    avs[0] = AspectValue.newAspectValue(AspectType.END_TIME,                                        thePG.convertBucketToTime(rollupEnd));    avs[1] = AspectValue.newAspectValue(AspectType.START_TIME,                                        thePG.convertBucketToTime(rollupStart));    Iterator phasesIt = phases.iterator();    if (task.getVerb().equals(Constants.Verb.WITHDRAW)) {      //use end and qty      while (phasesIt.hasNext()) {        AllocPhase aPhase = (AllocPhase) phasesIt.next();        AspectValue thisPhase[] = new AspectValue[2];        rollupQty = rollupQty + aPhase.amount;        thisPhase[0] = AspectValue.newAspectValue(AspectType.END_TIME, thePG.convertBucketToTime(aPhase.endBucket));        thisPhase[1] = AspectValue.newAspectValue(AspectType.QUANTITY, aPhase.amount);        phasedResults.add(thisPhase);      }      avs[1] = AspectValue.newAspectValue(AspectType.QUANTITY, rollupQty);    } else {      // project withdraw use start, end and rate      while (phasesIt.hasNext()) {        AllocPhase aPhase = (AllocPhase) phasesIt.next();        AspectValue thisPhase[] = new AspectValue[3];        // take the max endBucket for the rollup end time        if (aPhase.endBucket > rollupEnd) { rollupEnd = aPhase.endBucket;}        // take the min startBucket for the rollup start time        if (aPhase.startBucket < rollupStart) { rollupStart = aPhase.startBucket;}        rollupQty = rollupQty + ((aPhase.endBucket - aPhase.startBucket) * aPhase.amount);        thisPhase[0] = AspectValue.newAspectValue(AspectType.END_TIME, thePG.convertBucketToTime(aPhase.endBucket));        thisPhase[1] = AspectValue.newAspectValue(AspectType.START_TIME, thePG.convertBucketToTime(aPhase.startBucket));        thisPhase[2] = getDemandRateAV(aPhase.amount, thePG.getBucketMillis());        // add this phase to our phased results list        phasedResults.add(thisPhase);      }      avs[2] = getDemandRateAV(rollupQty, thePG.convertBucketToTime(rollupEnd) -                                          thePG.convertBucketToTime( rollupStart));    }    AllocationResult estimatedResult = inventoryPlugin.getPlanningFactory().            newPhasedAllocationResult(0.9, success, avs, (new Vector(phasedResults)).elements());    compareResults(estimatedResult, task, inv, thePG);  }