19 package org.sleuthkit.datamodel;
21 import com.google.common.collect.ImmutableSortedSet;
22 import java.util.Optional;
23 import java.util.SortedSet;
24 import org.apache.commons.lang3.ObjectUtils;
29 class TimelineEventTypeImpl
implements TimelineEventType {
31 private final long typeID;
32 private final String displayName;
33 private final TimelineEventType superType;
34 private final TimelineEventType.HierarchyLevel eventTypeZoomLevel;
43 TimelineEventTypeImpl(
long typeID, String displayName, TimelineEventType.HierarchyLevel eventTypeZoomLevel, TimelineEventType superType) {
44 this.superType = superType;
46 this.displayName = displayName;
47 this.eventTypeZoomLevel = eventTypeZoomLevel;
50 TimelineEventDescription parseDescription(String fullDescriptionRaw, String medDescriptionRaw, String shortDescriptionRaw) {
52 return new TimelineEventDescription(fullDescriptionRaw, medDescriptionRaw, shortDescriptionRaw);
56 public SortedSet<? extends TimelineEventType> getChildren() {
57 return ImmutableSortedSet.of();
61 public Optional<? extends TimelineEventType> getChild(String
string) {
62 return getChildren().stream()
63 .filter(type -> type.getDisplayName().equalsIgnoreCase(displayName))
68 public String getDisplayName() {
73 public TimelineEventType getParent() {
74 return ObjectUtils.defaultIfNull(superType, ROOT_EVENT_TYPE);
79 public TimelineEventType.HierarchyLevel getTypeHierarchyLevel() {
80 return eventTypeZoomLevel;
84 public long getTypeID() {
89 public int hashCode() {
91 hash = 17 * hash + (int) (this.typeID ^ (this.typeID >>> 32));
96 public boolean equals(Object obj) {
103 if (getClass() != obj.getClass()) {
106 final TimelineEventType other = (TimelineEventType) obj;
107 return this.getTypeID() == other.getTypeID();
111 public String toString() {
112 return "StandardEventType{" +
"id=" + getTypeID() +
", displayName=" + getDisplayName() +
'}';