19 package org.sleuthkit.autopsy.timeline.utils;
21 import java.util.ArrayList;
22 import java.util.List;
23 import org.joda.time.DateTime;
24 import org.joda.time.DateTimeZone;
25 import org.joda.time.Days;
26 import org.joda.time.Hours;
27 import org.joda.time.Interval;
28 import org.joda.time.Minutes;
29 import org.joda.time.Months;
30 import org.joda.time.Years;
31 import org.joda.time.format.DateTimeFormatter;
88 final DateTime startWithZone = timeRange.getStart().withZone(timeZone);
89 final DateTime endWithZone = timeRange.getEnd().withZone(timeZone);
92 if (Years.yearsIn(timeRange).isGreaterThan(Years.THREE)) {
94 }
else if (Months.monthsIn(timeRange).isGreaterThan(Months.THREE)) {
96 }
else if (Days.daysIn(timeRange).isGreaterThan(Days.THREE)) {
98 }
else if (Hours.hoursIn(timeRange).isGreaterThan(Hours.THREE)) {
100 }
else if (Minutes.minutesIn(timeRange).isGreaterThan(Minutes.THREE)) {
105 lower = timeUnit.
propertyOf(startWithZone).roundFloorCopy().getMillis();
106 upper = timeUnit.
propertyOf(endWithZone).roundCeilingCopy().getMillis();
135 @SuppressWarnings(
"ReturnOfCollectionOrArrayField")
138 ArrayList<Interval> intervals =
new ArrayList<>();
140 final Interval range =
new Interval(
new DateTime(lowerBound, tz),
new DateTime(upperBound, tz));
142 DateTime start = range.getStart();
143 while (range.contains(start)) {
146 final Interval interval =
new Interval(start, end);
147 intervals.add(interval);
DateTimeFormatter getTickFormatter()
DateTimeFormatter getTickFormatter()
RangeDivision(Interval timeRange, TimeUnits periodSize, long lowerBound, long upperBound)
synchronized List< Interval > getIntervals(DateTimeZone tz)
Interval getOriginalTimeRange()
final TimeUnits periodSize
TimeUnits getPeriodSize()
static RangeDivision getRangeDivision(Interval timeRange, DateTimeZone timeZone)
DateTime.Property propertyOf(DateTime dateTime)