thePG.convertBucketToTime(currentBucket -1),
thePG.convertBucketToTime(currentBucket),
  private void calculateLevelSixProjections(Collection touchedInventories,                                             int daysOnHand, long endOfLevelSix, 					    RefillComparator myComparator) {    ArrayList refillProjections = new ArrayList();    ArrayList oldProjections = new ArrayList();    Iterator tiIter = touchedInventories.iterator();    while (tiIter.hasNext()) {      // clear out the old and new projections for the last Inventory      refillProjections.clear();      oldProjections.clear();      Inventory anInventory = (Inventory) tiIter.next();      LogisticsInventoryPG thePG = (LogisticsInventoryPG)anInventory.        searchForPropertyGroup(LogisticsInventoryPG.class);      // clear all of the projections      oldProjections.addAll(thePG.clearRefillProjectionTasks());            //start time is the start time of the inventorybg      long startDay = thePG.getStartTime();      int startBucket = thePG.convertTimeToBucket(startDay);      int currentBucket = startBucket;      int customerDemandBucket = thePG.convertTimeToBucket(getTimeUtils().                                                           addNDays(startDay, daysOnHand));      double projDemand = 0;      double nextProjDemand = 0;      int endOfLevelSixBucket = thePG.convertTimeToBucket(endOfLevelSix);      thePG.setEndOfLevelSixBucket(endOfLevelSixBucket);            //get the initial demand for the customer for startBucket + daysOnHand      //Is there a better way to do this to avoid the duplication?      projDemand = thePG.getProjectedDemand(customerDemandBucket);            //move forward a bucket      currentBucket = currentBucket + 1;      customerDemandBucket = customerDemandBucket + 1;            //Begin looping through currentBucket forward until you hit the end of      // the level six boundary      //possible boundary issue... is it '<' or '<=' ??      while (currentBucket < endOfLevelSixBucket) {        nextProjDemand = thePG.getProjectedDemand(customerDemandBucket);        if (projDemand != nextProjDemand) {          //if there's a change in the demand, create a refill projection 	  //BUT only if demand is non-zero 	  if (projDemand > 0.0) {	    Task refill = createProjectionRefill(thePG.convertBucketToTime(startBucket), 						 thePG.convertBucketToTime(currentBucket -1),						 projDemand, anInventory, thePG);	    refillProjections.add(refill);	  }          //then reset the start bucket and the new demand           startBucket = currentBucket;          projDemand = nextProjDemand;        }        //in either case bump current and customer forward a bucket.        currentBucket = currentBucket + 1;        customerDemandBucket = customerDemandBucket + 1;      }      // when we get to the end of the level six window create the last      // projection task (if there is one)      if (startBucket != currentBucket) {        Task lastRefill = createProjectionRefill(thePG.convertBucketToTime(startBucket),                                                 thePG.convertBucketToTime(currentBucket - 1),                                                 projDemand, anInventory, thePG);        refillProjections.add(lastRefill);      }      // send the new projections and the old projections to the Comparator      // the comparator will rescind the old and publish the new projections      myComparator.compareRefillProjections(refillProjections, oldProjections,                                             anInventory);    }  }