code: private List<TimephasedWork> splitWork(CostRateTable table, ProjectCalendar calendar, TimephasedWork work, int rateIndex)
     {
        List<TimephasedWork> result = new LinkedList<TimephasedWork>();
        work.setTotalAmount(Duration.getInstance(0, work.getAmountPerDay().getUnits()));
  
        while (true)
        {
           CostRateTableEntry rate = table.get(rateIndex);
           Date splitDate = rate.getEndDate();
           if (splitDate.getTime() >= work.getFinish().getTime())
           {
              result.add(work);
              break;
           }
  
           Date currentPeriodEnd = calendar.getPreviousWorkFinish(splitDate);
  
           TimephasedWork currentPeriod = new TimephasedWork(work);
           currentPeriod.setFinish(currentPeriodEnd);
           result.add(currentPeriod);
  
           Date nextPeriodStart = calendar.getNextWorkStart(splitDate);
           work.setStart(nextPeriodStart);
  
           ++rateIndex;
        }
  
        return result;
     }
docs: Splits timephased work segments in line with cost rates. Note that this is
  an approximation - where a rate changes during a working day, the second
  rate is used for the whole day.
  
  @param table cost rate table
  @param calendar calendar used by this assignment
  @param work timephased work segment
  @param rateIndex rate applicable at the start of the timephased work segment
  @return list of segments which replace the one supplied by the caller