From 620aa4fcab35340a954a295425f5e46278364c6c Mon Sep 17 00:00:00 2001 From: jmillman Date: Thu, 26 May 2016 13:06:24 -0400 Subject: [PATCH] fix bugs from merge --- .../timeline/datamodel/CombinedEvent.java | 39 +++++++++++++++++++ .../timeline/ui/AbstractTimelineChart.java | 2 +- .../timeline/ui/listvew/ListTimeline.java | 6 +-- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/timeline/datamodel/CombinedEvent.java b/Core/src/org/sleuthkit/autopsy/timeline/datamodel/CombinedEvent.java index 3fa3265f17..cac19af810 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/datamodel/CombinedEvent.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/datamodel/CombinedEvent.java @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.timeline.datamodel; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.Set; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; @@ -108,4 +109,42 @@ public class CombinedEvent { public Long getRepresentitiveEventID() { return eventTypeMap.values().stream().findFirst().get(); } + + @Override + public int hashCode() { + int hash = 3; + hash = 53 * hash + (int) (this.fileID ^ (this.fileID >>> 32)); + hash = 53 * hash + (int) (this.epochMillis ^ (this.epochMillis >>> 32)); + hash = 53 * hash + Objects.hashCode(this.description); + hash = 53 * hash + Objects.hashCode(this.eventTypeMap); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CombinedEvent other = (CombinedEvent) obj; + if (this.fileID != other.fileID) { + return false; + } + if (this.epochMillis != other.epochMillis) { + return false; + } + if (!Objects.equals(this.description, other.description)) { + return false; + } + if (!Objects.equals(this.eventTypeMap, other.eventTypeMap)) { + return false; + } + return true; + } + } diff --git a/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractTimelineChart.java b/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractTimelineChart.java index 571cd3438c..38f05a9bfc 100644 --- a/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractTimelineChart.java +++ b/Core/src/org/sleuthkit/autopsy/timeline/ui/AbstractTimelineChart.java @@ -75,7 +75,7 @@ public abstract class AbstractTimelineChart selectedEvents) { - CombinedEvent firstSelected = selectedEvents.stream().min(Comparator.comparing(CombinedEvent::getStartMillis)).orElseGet(null); + CombinedEvent firstSelected = selectedEvents.stream().min(Comparator.comparing(CombinedEvent::getStartMillis)).orElse(null); table.getSelectionModel().clearSelection(); table.scrollTo(firstSelected); selectedEvents.forEach(table.getSelectionModel()::select);