code: private <T extends TimephasedItem<?>> int getStartIndex(DateRange range, List<T> assignments, int startIndex)
     {
        int result = -1;
        if (assignments != null)
        {
           long rangeStart = range.getStart().getTime();
           long rangeEnd = range.getEnd().getTime();
  
           for (int loop = startIndex; loop < assignments.size(); loop++)
           {
              T assignment = assignments.get(loop);
              int compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeStart);
  
              //
              // The start of the target range falls after the assignment end -
              // move on to test the next assignment.
              //
              if (compareResult > 0)
              {
                 continue;
              }
  
              //
              // The start of the target range  falls within the assignment -
              // return the index of this assignment to the caller.
              //
              if (compareResult == 0)
              {
                 result = loop;
                 break;
              }
  
              //
              // At this point, we know that the start of the target range is before
              // the assignment start. We need to determine if the end of the
              // target range overlaps the assignment.
              //
              compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeEnd);
              if (compareResult >= 0)
              {
                 result = loop;
                 break;
              }
           }
        }
        return result;
     }
docs: Used to locate the first timephased resource assignment block which
  intersects with the target date range.
  
  @param <T> payload type
  @param range target date range
  @param assignments timephased resource assignments
  @param startIndex index at which to start the search
  @return index of timephased resource assignment which intersects with the target date range