code: public ContiguousIntervalUsageInArrear build(final boolean closedInterval) {
          Preconditions.checkState(!isBuilt.get(), "!isBuilt");
          Preconditions.checkState((!closedInterval && billingEvents.size() >= 1) ||
                                   (closedInterval && billingEvents.size() >= 2),
                                   "closedInterval=%s, billingEvents.size()=%s", closedInterval, String.valueOf(billingEvents.size()));
  
          final LocalDate startDate = internalTenantContext.toLocalDate(billingEvents.get(0).getEffectiveDate());
          if (targetDate.isBefore(startDate)) {
              return this;
          }
          final LocalDate endDate = closedInterval ? internalTenantContext.toLocalDate(billingEvents.get(billingEvents.size() - 1).getEffectiveDate()) : targetDate;
  
          if (startDate.compareTo(rawUsageStartDate) >= 0) {
              transitionTimes.add(startDate);
          }
  
          for (int i = 0; i < billingEvents.size(); i++) {
              final BillingEvent billingEvent = billingEvents.get(i);
              final LocalDate transitionStartDate = internalTenantContext.toLocalDate(billingEvent.getEffectiveDate());
              if (i == billingEvents.size() - 1) {
                  addTransitionTimesForBillingEvent(transitionStartDate, endDate, billingEvent.getBillCycleDayLocal());
              } else {
                  final BillingEvent nextBillingEvent = billingEvents.get(i + 1);
                  final LocalDate nextEndDate = internalTenantContext.toLocalDate(nextBillingEvent.getEffectiveDate());
                  addTransitionTimesForBillingEvent(transitionStartDate, nextEndDate, billingEvent.getBillCycleDayLocal());
              }
          }
  
          if (closedInterval &&
              transitionTimes.size() > 0 &&
              endDate.isAfter(transitionTimes.get(transitionTimes.size() - 1))) {
              transitionTimes.add(endDate);
          }
          isBuilt.set(true);
          return this;
      }
docs: Builds the transitionTimes associated to that usage section. Those are determined based on billing events for when to start and when to stop,
  the per usage billingPeriod and finally the targetDate.
  <p/>
  Those transition dates define the well defined billing granularity periods that should be billed for that specific usage section.
  
  @param closedInterval whether there was a last billing event referencing the usage section or whether this is ongoing and
  then targetDate will define the endDate.