if (start_time <= end_time) { while (start_time <= end_time) { task_end = TimeUtils.addNDays(start_time, 1);  withdrawTask = createProjectSupplyWithdrawTask(parent_task, start_time, start_time, quantity); expand_tasks.addElement(withdrawTask); start_time = task_end; } } else { withdrawTask = createProjectSupplyWithdrawTask(parent_task, start_time, start_time, quantity); expand_tasks.addElement(withdrawTask);
while (start_time < end_time) { long next_day = TimeUtils.pushToEndOfDay(start_time) + 1; long task_end = Math.min(next_day, end_time); long duration = task_end - start_time; double this_quantity = (quantity  * duration) / TimeUtils.MSEC_PER_DAY; long task_time = next_day - 1; withdrawTask = createProjectSupplyWithdrawTask(parent_task, task_time, task_time, this_quantity); expand_tasks.addElement(withdrawTask); start_time = task_time + 1;
    private void expandProjectionTask(Task parent_task) {	double quantity = 0;	 if (parent_task.getVerb().equals(Constants.Verb.PROJECTSUPPLY)) {	     Rate r = TaskUtils.getRate(parent_task);	     if (r instanceof FlowRate) {		 quantity = ((FlowRate)r).getGallonsPerDay();	     } else if (r instanceof CountRate) {		 quantity = ((CountRate)r).getEachesPerDay();	     }	 }	 if (quantity <= 0) {	     printError("expandProjectionTask(), Quantity cannot be obtained from task: "+			TaskUtils.taskDesc(parent_task));	     return;	 }	long start_time = TimeUtils.pushToEndOfDay(calendar_, TaskUtils.getStartTime(parent_task));	long orig_end_time = TimeUtils.pushToEndOfDay(calendar_, TaskUtils.getEndTime(parent_task));	// End Time is up to but not including  	long end_time = TimeUtils.addNDays(orig_end_time, -1);	long task_end;	Vector expand_tasks = new Vector();	NewTask withdrawTask = null;	if (start_time <= end_time) {	    while (start_time <= end_time) {		task_end = TimeUtils.addNDays(start_time, 1);//  		withdrawTask = createProjectSupplyWithdrawTask(parent_task, start_time, task_end, quantity);  		withdrawTask = createProjectSupplyWithdrawTask(parent_task, start_time, start_time, quantity);		expand_tasks.addElement(withdrawTask);		start_time = task_end;	    }	}	else { // Projection tasks spans a single day	    withdrawTask = createProjectSupplyWithdrawTask(parent_task, start_time, start_time, quantity);	    expand_tasks.addElement(withdrawTask);	}        publishExpansion(parent_task, expand_tasks);    }