logger.error("Sizer.provide : ERROR - no current task...");
if (logger.isErrorEnabled()) { logger.error("Sizer.provide : ERROR - no current task..."); }
  Task provide(double requestedAmt, double earliest, double latest) {    Task ret = null;    // first, if we've gotten a request, we need to check    // to see if the _curTask has anything left in it...    if (_remainder == 0.0) {      if ((_curTask = getNextTask()) != null) {        // there is now one less task in _tasks b/c of getNextTask call        Mass taskMass = getTaskMass(_curTask, _quantityType);        _remainder = taskMass.getShortTons();        if (_expansionQueue != null) {          logger.error("Sizer.provide : ERROR - Expansion queue is not null - we will drop tasks :");          for (Iterator iter = _expansionQueue.iterator(); iter.hasNext();)            logger.error("\t" + ((Task) iter.next()).getUID());        }        _expansionQueue = new ArrayList();      } else {        logger.error("Sizer.provide : ERROR - no current task...");        return null; // should never happen      }    }    // return null if the current task is either completely before or after    // the arrival window of the milvan we're aggregating    Preference endDatePref = _curTask.getPreference(AspectType.END_TIME);    ScoringFunction sf = endDatePref.getScoringFunction();    AspectScorePoint aspStart = sf.getDefinedRange().getRangeStartPoint();    Date taskEarlyDate = new Date((long) aspStart.getValue());    if (taskEarlyDate.getTime() > latest) {      return null;    }    AspectScorePoint aspEnd = sf.getDefinedRange().getRangeEndPoint();    Date taskLateDate = new Date((long) aspEnd.getValue());    if (taskLateDate.getTime() < earliest) {      return null;    }    long bestArrival = (long) _curTask.getPreferredValue(AspectType.END_TIME);            if (earliest > 0 && // if we've ever made a milvan	((bestArrival - earliest) > MAX_GROUP_DAYS*ONE_DAY_MILLIS ||	 (latest - bestArrival)   > MAX_GROUP_DAYS*ONE_DAY_MILLIS)) {      if (logger.isInfoEnabled ()) {	logger.info("making a new milvan since task with best arrival of " +		    new Date(bestArrival) + " outside of (earliest : " +		    new Date((long)earliest) + "-> latest " +		    new Date((long)latest) + ") window");      }      /*      System.out.println ("making a new milvan since task with best arrival of " +		    new Date(bestArrival) + " outside of (earliest : " +		    new Date((long)earliest) + "-> latest " +		    new Date((long)latest) + ") window");      */      return null;    }    // precondition:  _curTask is bound to a Task and remainder >= 0.0    // remainder can be == 0.0 because some Plugin developers make such    // tasks instead of rescinding requests.    //System.out.println(" _remainder is " + _remainder + " requestedAmt " + requestedAmt);    // if (_remainder < (requestedAmt + 0.1))    if (_remainder <= requestedAmt) {      // we are going to use up the entire _curTask and need to      // take care of the expansion      ret = sizedTask(_curTask, _remainder);      _expansionQueue.add(0, ret);      makeExpansion(_curTask, _expansionQueue);      _expansionQueue = null; // it has been used - we shouldn't try to use it again      _remainder = 0.0;    } else {      ret = sizedTask(_curTask, requestedAmt);      _expansionQueue.add(0, ret);      _remainder = _remainder - requestedAmt;      if (_remainder == 0.0)        logger.error("Sizer.provide : ERROR - We will drop task " + ret.getUID());    }    return ret;  }