((NewTimeSpan)first).setTimeSpan(firstlap.getStartTime(), end); ((NewTimeSpan)second).setTimeSpan(start, firstlap.getStartTime());
if (! (isValidSpan(firstlap.getStartTime(), end) && isValidSpan(start, firstlap.getStartTime()))) { return Collections.EMPTY_LIST; } ((NewTimeSpan) first).setTimeSpan(firstlap.getStartTime(), end); ((NewTimeSpan) second).setTimeSpan(start, firstlap.getStartTime());
  private List getSplitTimes(Task task, HashMap providerSched) {    ArrayList splits = new ArrayList();    long start = TaskUtils.getStartTime(task);    long end = TaskUtils.getEndTime(task);    PlanElement pe = task.getPlanElement();    Organization provider = null;    if (pe != null && pe instanceof Allocation) {      provider = (Organization) ((Allocation)pe).getAsset();    }    Schedule sched = (Schedule)providerSched.get(provider);    Collection overlaps = sched.getOverlappingScheduleElements(start, end);    if (overlaps.isEmpty()) {      logger.error("InvPlugin got no overlapping elements for task start " +                   new Date(start) + " end " + new Date(end) +                   " provider is: " + provider);      return splits;    }    ScheduleElement firstlap = (ScheduleElement) overlaps.iterator().next();    TimeSpan first = new MutableTimeSpan();    TimeSpan second = new MutableTimeSpan();    if (start >= firstlap.getStartTime()) {      if (logger.isWarnEnabled()) {        logger.warn("GetSplitTimes... task is: " + new Date (start) + " ... " +                     new Date(end) + "  overlapping relationship is: " +                     new Date(firstlap.getStartTime()) + " ... " +                     new Date(firstlap.getEndTime()));      }      ((NewTimeSpan)first).setTimeSpan(start, firstlap.getEndTime());      ((NewTimeSpan)second).setTimeSpan(firstlap.getEndTime(), end);    } else {      if (logger.isWarnEnabled()) {        logger.warn("GetSplitTimes... task is: " + new Date (start) + " ... " +                     new Date(end) + "  overlapping relationship is: " +                     new Date(firstlap.getStartTime()) + " ... " +                     new Date(firstlap.getEndTime()));      }      ((NewTimeSpan)first).setTimeSpan(firstlap.getStartTime(), end);      ((NewTimeSpan)second).setTimeSpan(start, firstlap.getStartTime());    }    splits.add(first);    splits.add(second);    return splits;  }