19package org.sleuthkit.autopsy.timeline.ui.detailview.datamodel;
21import static java.util.Collections.emptySet;
22import static java.util.Collections.singleton;
23import java.util.Comparator;
24import java.util.HashSet;
25import java.util.Objects;
26import java.util.Optional;
28import java.util.SortedSet;
29import org.joda.time.Interval;
30import org.sleuthkit.autopsy.timeline.utils.IntervalUtils;
31import org.sleuthkit.datamodel.TimelineEventType;
32import org.sleuthkit.datamodel.TimelineEvent;
33import org.sleuthkit.datamodel.TimelineLevelOfDetail;
47 final private Interval
span;
52 final private TimelineEventType
type;
62 private final TimelineLevelOfDetail
lod;
93 throw new IllegalArgumentException(
"event clusters are not compatible: they have different types");
97 throw new IllegalArgumentException(
"event clusters are not compatible: they have different descriptions");
103 if(!idsUnion.isEmpty()) {
110 if(!hashHitsUnion.isEmpty()) {
117 if(!taggedUnion.isEmpty()) {
124 cluster1.
getEventType(), idsUnion, hashHitsUnion, taggedUnion,
132 this.span = spanningInterval;
150 this.span =
new Interval(event.getEventTimeInMs(), event.getEventTimeInMs());
153 this.eventIDs =
new HashSet<>();
154 this.eventIDs.add(event.getEventID());
155 this.hashHits =
event.eventSourceHasHashHits()?
new HashSet<>(
eventIDs) : emptySet();
156 this.tagged =
event.eventSourceIsTagged()?
new HashSet<>(
eventIDs) : emptySet();
158 this.description =
event.getDescription(
lod);
170 return Optional.ofNullable(
parent);
191 return span.getStartMillis();
196 return span.getEndMillis();
245 return DetailsViewModel.copyAsSortedSet(singleton(
this), Comparator.comparing(cluster ->
true));
250 return "EventCluster{" +
"description=" +
description +
", eventIDs=" +
eventIDs.size() +
'}';
256 hash = 23 * hash + Objects.hashCode(this.type);
257 hash = 23 * hash + Objects.hashCode(this.description);
258 hash = 23 * hash + Objects.hashCode(this.lod);
259 hash = 23 * hash + Objects.hashCode(this.eventIDs);
271 if (getClass() != obj.getClass()) {
275 if (!Objects.equals(
this.description, other.
description)) {
278 if (!Objects.equals(
this.type, other.
type)) {
281 if (this.lod != other.
lod) {
284 return Objects.equals(this.eventIDs, other.
eventIDs);
Optional< EventStripe > getParentStripe()
EventCluster(Interval spanningInterval, TimelineEventType type, Set< Long > eventIDs, Set< Long > hashHits, Set< Long > tagged, String description, TimelineLevelOfDetail lod, EventStripe parent)
EventCluster withParent(EventStripe parent)
TimelineLevelOfDetail getDescriptionLevel()
final Set< Long > hashHits
Optional< EventStripe > getParent()
boolean equals(Object obj)
final TimelineLevelOfDetail lod
EventCluster(Interval spanningInterval, TimelineEventType type, Set< Long > eventIDs, Set< Long > hashHits, Set< Long > tagged, String description, TimelineLevelOfDetail lod)
SortedSet< EventCluster > getClusters()
Set< Long > getEventIDsWithTags()
Set< Long > getEventIDsWithHashHits()
final TimelineEventType type
final Set< Long > eventIDs
static EventCluster merge(EventCluster cluster1, EventCluster cluster2)
EventCluster(TimelineEvent event, TimelineEventType type, TimelineLevelOfDetail lod)
TimelineEventType getEventType()
Set< Long > getEventIDs()
static Interval span(Interval range, final Interval range2)