Source:
ScanResults(long startTimeInMs, long logSegmentForecastOffsetMs, int bucketCount, long bucketSpanInMs) { containerForecastStartTimeMs = startTimeInMs; long containerBucketTimeMs = containerForecastStartTimeMs + bucketSpanInMs; for (int i = 1; i < bucketCount; i++) { containerBuckets.put(containerBucketTimeMs, new HashMap<>()); containerBucketTimeMs += bucketSpanInMs; } containerLastBucketTimeMs = containerBuckets.isEmpty() ? containerForecastStartTimeMs : containerBuckets.lastKey(); containerForecastEndTimeMs = containerLastBucketTimeMs + bucketSpanInMs; logSegmentForecastStartTimeMsForExpired = startTimeInMs; long bucketTimeMs = logSegmentForecastStartTimeMsForExpired + bucketSpanInMs; for (int i = 1; i < bucketCount; i++) { logSegmentBucketsDeltaForExpired.put(bucketTimeMs, new TreeMap<>(LogSegmentNameHelper.COMPARATOR)); bucketTimeMs += bucketSpanInMs; } logSegmentLastBucketTimeMsForExpired = logSegmentBucketsDeltaForExpired.isEmpty() ? logSegmentForecastStartTimeMsForExpired : logSegmentBucketsDeltaForExpired.lastKey(); logSegmentForecastEndTimeMsForExpired = logSegmentLastBucketTimeMsForExpired + bucketSpanInMs; logSegmentForecastStartTimeMsForDeleted = startTimeInMs - logSegmentForecastOffsetMs; bucketTimeMs = logSegmentForecastStartTimeMsForDeleted + bucketSpanInMs; for (int i = 1; i < bucketCount; i++) { logSegmentBucketsDeltaForDeleted.put(bucketTimeMs, new TreeMap<>(LogSegmentNameHelper.COMPARATOR)); bucketTimeMs += bucketSpanInMs; } logSegmentLastBucketTimeMsForDeleted = logSegmentBucketsDeltaForDeleted.isEmpty() ? logSegmentForecastStartTimeMsForDeleted : logSegmentBucketsDeltaForDeleted.lastKey(); logSegmentForecastEndTimeMsForDeleted = logSegmentLastBucketTimeMsForDeleted + bucketSpanInMs; }

Target:
ScanResults(long startTimeInMs, long logSegmentForecastOffsetMs, int bucketCount, long bucketSpanInMs) { containerForecastStartTimeMs = startTimeInMs; long containerBucketTimeMs = containerForecastStartTimeMs + bucketSpanInMs; for (int i = 1; i < bucketCount; i++) { containerDeltaBuckets.put(containerBucketTimeMs, new HashMap<>()); containerBucketTimeMs += bucketSpanInMs; } containerLastBucketTimeMs = containerDeltaBuckets.isEmpty() ? containerForecastStartTimeMs : containerDeltaBuckets.lastKey(); containerForecastEndTimeMs = containerLastBucketTimeMs + bucketSpanInMs; logSegmentForecastStartTimeMsForExpired = startTimeInMs; long bucketTimeMs = logSegmentForecastStartTimeMsForExpired + bucketSpanInMs; for (int i = 1; i < bucketCount; i++) { logSegmentDeltaBucketsForExpired.put(bucketTimeMs, new TreeMap<>(LogSegmentNameHelper.COMPARATOR)); bucketTimeMs += bucketSpanInMs; } logSegmentLastBucketTimeMsForExpired = logSegmentDeltaBucketsForExpired.isEmpty() ? logSegmentForecastStartTimeMsForExpired : logSegmentDeltaBucketsForExpired.lastKey(); logSegmentForecastEndTimeMsForExpired = logSegmentLastBucketTimeMsForExpired + bucketSpanInMs; logSegmentForecastStartTimeMsForDeleted = startTimeInMs - logSegmentForecastOffsetMs; bucketTimeMs = logSegmentForecastStartTimeMsForDeleted + bucketSpanInMs; for (int i = 1; i < bucketCount; i++) { logSegmentDeltaBucketsForDeleted.put(bucketTimeMs, new TreeMap<>(LogSegmentNameHelper.COMPARATOR)); bucketTimeMs += bucketSpanInMs; } logSegmentLastBucketTimeMsForDeleted = logSegmentDeltaBucketsForDeleted.isEmpty() ? logSegmentForecastStartTimeMsForDeleted : logSegmentDeltaBucketsForDeleted.lastKey(); logSegmentForecastEndTimeMsForDeleted = logSegmentLastBucketTimeMsForDeleted + bucketSpanInMs; }