Autopsy  4.12.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ZoomState.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2013-18 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.zooming;
20 
21 import java.util.Objects;
22 import org.joda.time.Interval;
24 import org.sleuthkit.datamodel.TimelineEvent;
25 import org.sleuthkit.datamodel.TimelineEventType;
26 
31 final public class ZoomState {
32 
33  private final Interval timeRange;
34 
35  private final TimelineEventType.TypeLevel typeZoomLevel;
36 
37  private final RootFilterState filter;
38 
39  private final TimelineEvent.DescriptionLevel descrLOD;
40 
41  public Interval getTimeRange() {
42  return timeRange;
43  }
44 
45  public TimelineEventType.TypeLevel getTypeZoomLevel() {
46  return typeZoomLevel;
47  }
48 
50  return filter;
51  }
52 
53  public TimelineEvent.DescriptionLevel getDescriptionLOD() {
54  return descrLOD;
55  }
56 
57  public ZoomState(Interval timeRange, TimelineEventType.TypeLevel zoomLevel, RootFilterState filter, TimelineEvent.DescriptionLevel descrLOD) {
58  this.timeRange = timeRange;
59  this.typeZoomLevel = zoomLevel;
60  this.filter = filter;
61  this.descrLOD = descrLOD;
62  }
63 
64  public ZoomState withTimeAndType(Interval timeRange, TimelineEventType.TypeLevel zoomLevel) {
65  return new ZoomState(timeRange, zoomLevel, filter, descrLOD);
66  }
67 
68  public ZoomState withTypeZoomLevel(TimelineEventType.TypeLevel zoomLevel) {
69  return new ZoomState(timeRange, zoomLevel, filter, descrLOD);
70  }
71 
72  public ZoomState withTimeRange(Interval timeRange) {
73  return new ZoomState(timeRange, typeZoomLevel, filter, descrLOD);
74  }
75 
76  public ZoomState withDescrLOD(TimelineEvent.DescriptionLevel descrLOD) {
77  return new ZoomState(timeRange, typeZoomLevel, filter, descrLOD);
78  }
79 
81  return new ZoomState(timeRange, typeZoomLevel, filter, descrLOD);
82  }
83 
84  public boolean hasFilterState(RootFilterState filterSet) {
85  return this.filter.equals(filterSet);
86  }
87 
88  public boolean hasTypeZoomLevel(TimelineEventType.TypeLevel typeZoom) {
89  return this.typeZoomLevel.equals(typeZoom);
90  }
91 
92  public boolean hasTimeRange(Interval timeRange) {
93  return this.timeRange != null && this.timeRange.equals(timeRange);
94  }
95 
96  public boolean hasDescrLOD(TimelineEvent.DescriptionLevel newLOD) {
97  return this.descrLOD.equals(newLOD);
98  }
99 
100  @Override
101  public int hashCode() {
102  int hash = 3;
103  hash = 97 * hash + Objects.hashCode(this.timeRange.getStartMillis());
104  hash = 97 * hash + Objects.hashCode(this.timeRange.getEndMillis());
105  hash = 97 * hash + Objects.hashCode(this.typeZoomLevel);
106  hash = 97 * hash + Objects.hashCode(this.filter);
107  hash = 97 * hash + Objects.hashCode(this.descrLOD);
108 
109  return hash;
110  }
111 
112  @Override
113  public boolean equals(Object obj) {
114  if (obj == null) {
115  return false;
116  }
117  if (getClass() != obj.getClass()) {
118  return false;
119  }
120  final ZoomState other = (ZoomState) obj;
121  if (!Objects.equals(this.timeRange, other.timeRange)) {
122  return false;
123  }
124  if (this.typeZoomLevel != other.typeZoomLevel) {
125  return false;
126  }
127  if (this.filter.equals(other.filter) == false) {
128  return false;
129  }
130  return this.descrLOD == other.descrLOD;
131  }
132 
133  @Override
134  public String toString() {
135  return "ZoomState{" + "timeRange=" + timeRange + ", typeZoomLevel=" + typeZoomLevel + ", filter=" + filter.getActiveFilter().toString() + ", descrLOD=" + descrLOD + '}'; //NON-NLS
136  }
137 }
final TimelineEvent.DescriptionLevel descrLOD
Definition: ZoomState.java:39
boolean hasFilterState(RootFilterState filterSet)
Definition: ZoomState.java:84
ZoomState withFilterState(RootFilterState filter)
Definition: ZoomState.java:80
boolean hasTypeZoomLevel(TimelineEventType.TypeLevel typeZoom)
Definition: ZoomState.java:88
final TimelineEventType.TypeLevel typeZoomLevel
Definition: ZoomState.java:35
TimelineEventType.TypeLevel getTypeZoomLevel()
Definition: ZoomState.java:45
boolean hasDescrLOD(TimelineEvent.DescriptionLevel newLOD)
Definition: ZoomState.java:96
ZoomState withTimeAndType(Interval timeRange, TimelineEventType.TypeLevel zoomLevel)
Definition: ZoomState.java:64
TimelineEvent.DescriptionLevel getDescriptionLOD()
Definition: ZoomState.java:53
boolean hasTimeRange(Interval timeRange)
Definition: ZoomState.java:92
ZoomState withDescrLOD(TimelineEvent.DescriptionLevel descrLOD)
Definition: ZoomState.java:76
ZoomState(Interval timeRange, TimelineEventType.TypeLevel zoomLevel, RootFilterState filter, TimelineEvent.DescriptionLevel descrLOD)
Definition: ZoomState.java:57
ZoomState withTypeZoomLevel(TimelineEventType.TypeLevel zoomLevel)
Definition: ZoomState.java:68
ZoomState withTimeRange(Interval timeRange)
Definition: ZoomState.java:72

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