Autopsy  4.4
Graphical digital forensics platform for The Sleuth Kit and other tools.
IntersectionFilter.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014-15 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.List;
22 import java.util.stream.Collectors;
23 import javafx.collections.FXCollections;
24 import org.openide.util.NbBundle;
25 
29 public class IntersectionFilter<S extends Filter> extends CompoundFilter<S> {
30 
31  public IntersectionFilter(List<S> subFilters) {
32  super(subFilters);
33  }
34 
35  public IntersectionFilter() {
36  super(FXCollections.<S>observableArrayList());
37  }
38 
39  @Override
41  @SuppressWarnings("unchecked")
43  (List<S>) this.getSubFilters().stream()
44  .map(Filter::copyOf)
45  .collect(Collectors.toList()));
46  filter.setSelected(isSelected());
47  filter.setDisabled(isDisabled());
48  return filter;
49  }
50 
51  @Override
52  @NbBundle.Messages({"# {0} - sub filter displaynames",
53  "IntersectionFilter.displayName.text=Intersection{0}"})
54  public String getDisplayName() {
55  String collect = getSubFilters().stream()
57  .collect(Collectors.joining(",", "[", "]"));
58  return Bundle.IntersectionFilter_displayName_text(collect);
59  }
60 
61  @Override
62  public boolean equals(Object obj) {
63  if (obj == null) {
64  return false;
65  }
66  if (getClass() != obj.getClass()) {
67  return false;
68  }
69  @SuppressWarnings("unchecked")
70  final IntersectionFilter<S> other = (IntersectionFilter<S>) obj;
71 
72  if (isSelected() != other.isSelected()) {
73  return false;
74  }
75 
76  for (int i = 0; i < getSubFilters().size(); i++) {
77  if (getSubFilters().get(i).equals(other.getSubFilters().get(i)) == false) {
78  return false;
79  }
80  }
81  return true;
82  }
83 }
final ObservableList< SubFilterType > getSubFilters()

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