if (rate != null) {
if (rate == null) {
  public Collection getDailyQuantities(Task task) {    if (task == null) {      return null;    }    long startTime = -1;    if (getPreferenceBest(task, AspectType.START_TIME) != null) {      startTime = getStartTime(task);    }    long endTime = getEndTime(task);    if (startTime == -1) {      startTime = endTime - 1;    }    double dailyRate = 0.0d;    if (!isProjection(task)) {      dailyRate = getQuantity(task);    } else {      Rate rate = null;      PrepositionalPhrase pp_rate = task.getPrepositionalPhrase(Constants.Preposition.DEMANDRATE);      if (pp_rate != null) {        Object indObj = pp_rate.getIndirectObject();        if (indObj instanceof Schedule) {          Schedule sched = (Schedule) indObj;          Collection rate_elems =             sched.getOverlappingScheduleElements(startTime, endTime);          int n = (rate_elems == null ? 0 : rate_elems.size());          if (n == 1) {            rate = (Rate) rate_elems.iterator().next();          } else if (n > 1) {            // return a schedule of daily rates            List ret = new ArrayList(n);            for (Iterator iter = rate_elems.iterator(); iter.hasNext(); ) {              ObjectScheduleElement ose = (ObjectScheduleElement) iter.next();              Rate r = (Rate) ose.getObject();              double d = getDailyQuantity(r);              ScheduleElement se =                 new QuantityScheduleElementImpl(                    ose.getStartTime(),                    ose.getEndTime(),                    d);              ret.add(se);            }            return ret;          }        }      }      if (rate != null) {        AspectValue best = getPreferenceBest(task, AlpineAspectType.DEMANDRATE);        if (best != null) {          rate = ((AspectRate) best).getRateValue();        }      }      if (rate != null) {        dailyRate = getDailyQuantity(rate);      }    }    ScheduleElement se = new QuantityScheduleElementImpl(startTime, endTime, dailyRate);    return Collections.singleton(se);  }