private DateTime providedOrDefaultFromValue ( DateTime from , DateTime to , AggregateCounterResolution resolution ) { if ( from != null ) { return from ; } switch ( resolution ) { case minute : return to . minusMinutes ( 59 ) ; case hour : return to . minusHours ( 23 ) ; case day : return to . minusDays ( 6 ) ; case month : return to . minusMonths ( 11 ) ; case year : return to . minusYears ( 4 ) ; default : throw new IllegalStateException ( "Shouldn't happen. Unhandled resolution: " + resolution ) ; } }
Return a default value for the interval start if none has been provided .