Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
TreeComparator.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 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.ui.detailview.tree;
20 
21 import java.util.Comparator;
22 import javafx.scene.control.TreeItem;
23 import org.openide.util.NbBundle;
26 
27 @NbBundle.Messages({"TreeComparator.Description.displayName=Description",
28  "TreeComparator.Count.displayName=Count",
29  "TreeComparator.Type.displayName=Type"})
30 enum TreeComparator implements Comparator<TreeItem<TimeLineEvent>> {
31 
32  Description(Bundle.TreeComparator_Description_displayName()) {
33  @Override
34  public int compare(TreeItem<TimeLineEvent> o1, TreeItem<TimeLineEvent> o2) {
35  return o1.getValue().getDescription().compareTo(o2.getValue().getDescription());
36  }
37  },
38  Count(Bundle.TreeComparator_Count_displayName()) {
39  @Override
40  public int compare(TreeItem<TimeLineEvent> o1, TreeItem<TimeLineEvent> o2) {
41  return Long.compare(o2.getValue().getSize(), o1.getValue().getSize());
42  }
43  },
44  Type(Bundle.TreeComparator_Type_displayName()) {
45  @Override
46  public int compare(TreeItem<TimeLineEvent> o1, TreeItem<TimeLineEvent> o2) {
47  return EventType.getComparator().compare(o1.getValue().getEventType(), o2.getValue().getEventType());
48  }
49  };
50 
51  private final String displayName;
52 
53  private TreeComparator(String displayName) {
54  this.displayName = displayName;
55  }
56 
57  public String getDisplayName() {
58  return displayName;
59  }
60 }

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