Autopsy  4.10.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
CombinedEvent.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2016 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.timeline.datamodel;
20 
21 import java.util.HashMap;
22 import java.util.Map;
23 import java.util.Objects;
24 import java.util.Set;
25 import org.python.google.common.collect.ImmutableSet;
27 
33 public class CombinedEvent {
34 
35  private final long fileID;
36  private final long epochMillis;
37  private final String description;
38 
42  private final Map<EventType, Long> eventTypeMap = new HashMap<>();
43 
53  public CombinedEvent(long epochMillis, String description, long fileID, Map<EventType, Long> eventMap) {
54  this.epochMillis = epochMillis;
55  this.description = description;
56  eventTypeMap.putAll(eventMap);
57  this.fileID = fileID;
58  }
59 
65  public long getStartMillis() {
66  return epochMillis;
67  }
68 
74  public String getDescription() {
75  return description;
76  }
77 
83  public long getFileID() {
84  return fileID;
85  }
86 
92  public Set<EventType> getEventTypes() {
93  return eventTypeMap.keySet();
94  }
95 
101  public ImmutableSet<Long> getEventIDs() {
102  return ImmutableSet.copyOf(eventTypeMap.values());
103  }
104 
112  public Long getRepresentativeEventID() {
113  return eventTypeMap.values().stream().findFirst().get();
114  }
115 
116  @Override
117  public int hashCode() {
118  int hash = 3;
119  hash = 53 * hash + (int) (this.fileID ^ (this.fileID >>> 32));
120  hash = 53 * hash + (int) (this.epochMillis ^ (this.epochMillis >>> 32));
121  hash = 53 * hash + Objects.hashCode(this.description);
122  hash = 53 * hash + Objects.hashCode(this.eventTypeMap);
123  return hash;
124  }
125 
126  @Override
127  public boolean equals(Object obj) {
128  if (this == obj) {
129  return true;
130  }
131  if (obj == null) {
132  return false;
133  }
134  if (getClass() != obj.getClass()) {
135  return false;
136  }
137  final CombinedEvent other = (CombinedEvent) obj;
138  if (this.fileID != other.fileID) {
139  return false;
140  }
141  if (this.epochMillis != other.epochMillis) {
142  return false;
143  }
144  if (!Objects.equals(this.description, other.description)) {
145  return false;
146  }
147  if (!Objects.equals(this.eventTypeMap, other.eventTypeMap)) {
148  return false;
149  }
150  return true;
151  }
152 }
CombinedEvent(long epochMillis, String description, long fileID, Map< EventType, Long > eventMap)

Copyright © 2012-2018 Basis Technology. Generated on: Fri Mar 22 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.