19 package org.sleuthkit.autopsy.timeline.utils;
21 import java.util.Collection;
22 import org.joda.time.DateTime;
23 import org.joda.time.DateTimeZone;
24 import org.joda.time.Interval;
25 import org.joda.time.ReadablePeriod;
34 Interval trange = null;
35 for (DateTime t : times) {
37 trange =
new Interval(t.getMillis(), t.getMillis() + 1000, DateTimeZone.UTC);
45 static public Interval
span(Interval range,
final Interval range2) {
46 return new Interval(Math.min(range.getStartMillis(), range2.getStartMillis()), Math.max(range.getEndMillis(), range2.getEndMillis()), DateTimeZone.UTC);
49 static public Interval
extendInterval(Interval range,
final Long eventTime) {
50 return new Interval(Math.min(range.getStartMillis(), eventTime), Math.max(range.getEndMillis(), eventTime + 1), DateTimeZone.UTC);
53 public static DateTime
middleOf(Interval interval) {
54 return new DateTime((interval.getStartMillis() + interval.getEndMillis()) / 2);
62 DateTime start = aroundInstant.minus(period);
63 DateTime end = aroundInstant.plus(period);
64 Interval range =
new Interval(start, end);
66 long halfRange = range.toDurationMillis() / 4;
67 final Interval newInterval =
new Interval(middleOf.minus(halfRange), middleOf.plus(halfRange));
static Interval span(Interval range, final Interval range2)
static Interval getAdjustedInterval(Interval oldInterval, TimeUnits requestedUnit)
static Interval getIntervalAround(DateTime aroundInstant, ReadablePeriod period)
static Interval getSpanningInterval(Collection< DateTime > times)
static Interval extendInterval(Interval range, final Long eventTime)
static DateTime middleOf(Interval interval)