Autopsy  4.5.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
HashHitsFilter.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2015-16 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.filters;
20 
21 import java.util.function.Predicate;
22 import javafx.beans.binding.Bindings;
23 import javafx.beans.value.ObservableBooleanValue;
24 import org.openide.util.NbBundle;
25 
29 public class HashHitsFilter extends UnionFilter<HashSetFilter> {
30 
31  @Override
32  @NbBundle.Messages("hashHitsFilter.displayName.text=Hash Sets")
33  public String getDisplayName() {
34  return Bundle.hashHitsFilter_displayName_text();
35  }
36 
37  public HashHitsFilter() {
38  setSelected(false);
39  }
40 
41  @Override
43  HashHitsFilter filterCopy = new HashHitsFilter();
44  //add a copy of each subfilter
45  this.getSubFilters().forEach(hashSetFilter -> filterCopy.addSubFilter(hashSetFilter.copyOf()));
46  //these need to happen after the listeners fired by adding the subfilters
47  filterCopy.setSelected(isSelected());
48  filterCopy.setDisabled(isDisabled());
49 
50  return filterCopy;
51  }
52 
53 
54  @Override
55  public int hashCode() {
56  return 7;
57  }
58 
59  @Override
60  public boolean equals(Object obj) {
61  if (obj == null) {
62  return false;
63  }
64  if (getClass() != obj.getClass()) {
65  return false;
66  }
67  final HashHitsFilter other = (HashHitsFilter) obj;
68 
69  if (isActive() != other.isActive()) {
70  return false;
71  }
72 
73  return areSubFiltersEqual(this, other);
74  }
75 
76  @Override
77  public ObservableBooleanValue disabledProperty() {
78  return Bindings.or(super.disabledProperty(), Bindings.isEmpty(getSubFilters()));
79  }
80 
81  @Override
82  Predicate<HashSetFilter> getDuplicatePredicate(HashSetFilter subfilter) {
83  return hashSetFilter -> subfilter.getHashSetID() == hashSetFilter.getHashSetID();
84  }
85 }

Copyright © 2012-2016 Basis Technology. Generated on: Tue Feb 20 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.