19 package org.sleuthkit.autopsy.timeline.ui.detailview.datamodel;
21 import static java.util.Collections.emptySet;
22 import static java.util.Collections.singleton;
23 import java.util.Comparator;
24 import java.util.HashSet;
25 import java.util.Objects;
26 import java.util.Optional;
28 import java.util.SortedSet;
29 import org.joda.time.Interval;
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,
128 private EventCluster(Interval spanningInterval, TimelineEventType type, Set<Long> eventIDs,
129 Set<Long> hashHits, Set<Long> tagged, String description, TimelineLevelOfDetail lod,
132 this.span = spanningInterval;
143 public EventCluster(Interval spanningInterval, TimelineEventType type, Set<Long> eventIDs,
144 Set<Long> hashHits, Set<Long> tagged, String description, TimelineLevelOfDetail lod) {
149 public EventCluster(TimelineEvent event, TimelineEventType type, TimelineLevelOfDetail lod) {
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();
240 return new EventCluster(span, type, eventIDs, hashHits, tagged, description, lod, parent);
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) {
EventCluster(Interval spanningInterval, TimelineEventType type, Set< Long > eventIDs, Set< Long > hashHits, Set< Long > tagged, String description, TimelineLevelOfDetail lod, EventStripe parent)
final TimelineEventType type
static Interval span(Interval range, final Interval range2)
boolean equals(Object obj)
Set< Long > getEventIDsWithTags()
final Set< Long > hashHits
final Set< Long > eventIDs
EventCluster(TimelineEvent event, TimelineEventType type, TimelineLevelOfDetail lod)
SortedSet< EventCluster > getClusters()
EventCluster withParent(EventStripe parent)
final TimelineLevelOfDetail lod
static EventCluster merge(EventCluster cluster1, EventCluster cluster2)
TimelineLevelOfDetail getDescriptionLevel()
Optional< EventStripe > getParent()
EventCluster(Interval spanningInterval, TimelineEventType type, Set< Long > eventIDs, Set< Long > hashHits, Set< Long > tagged, String description, TimelineLevelOfDetail lod)
Set< Long > getEventIDsWithHashHits()
Set< Long > getEventIDs()
Optional< EventStripe > getParentStripe()
TimelineEventType getEventType()