private void addIntervals(IntervalManager intervalManager) {
   for (IntervalBase interval : intervalPersister.readIntervals()) {
     interval.setClosed();
     intervals.add(interval);
   }
   intervals.addAll(intervalManager.getOpenIntervals());
 }
 /** Constructor. */
 public IntervalStatistics(
     IntervalManager intervalManager, StatisticsTimePeriod selectedInterval) {
   this.intervalPersister = intervalManager.getIntervalsStatisticsPersister();
   this.selectedInterval = selectedInterval;
   addIntervals(intervalManager);
   filterIntervals();
   calculateStatistics();
 }