Sleuth Kit Java Bindings (JNI)  4.8.0
Java bindings for using The Sleuth Kit
TagName.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2011-2018 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.datamodel;
20 
21 import java.io.Serializable;
22 import java.util.HashMap;
23 import java.util.Objects;
24 
30 public class TagName implements Comparable<TagName>, Serializable {
31 
32  private static final long serialVersionUID = 1L;
33 
34  public enum HTML_COLOR {
35 
36  NONE("None"), //NON-NLS
37  WHITE("White"), //NON-NLS
38  SILVER("Silver"), //NON-NLS
39  GRAY("Gray"), //NON-NLS
40  BLACK("Black"), //NON-NLS
41  RED("Red"), //NON-NLS
42  MAROON("Maron"), //NON-NLS
43  YELLOW("Yellow"), //NON-NLS
44  OLIVE("Olive"), //NON-NLS
45  LIME("Lime"), //NON-NLS
46  GREEN("Green"), //NON-NLS
47  AQUA("Aqua"), //NON-NLS
48  TEAL("Teal"), //NON-NLS
49  BLUE("Blue"), //NON-NLS
50  NAVY("Navy"), //NON-NLS
51  FUCHSIA("Fuchsia"), //NON-NLS
52  PURPLE("Purple"); //NON-NLS
53  private final static HashMap<String, HTML_COLOR> colorMap = new HashMap<String, HTML_COLOR>();
54  private final String name;
55 
56  static {
57  for (HTML_COLOR color : HTML_COLOR.values()) {
58  colorMap.put(color.name(), color);
59  }
60  }
61 
62  private HTML_COLOR(String name) {
63  this.name = name;
64  }
65 
66  String getName() {
67  return name;
68  }
69 
70  public static HTML_COLOR getColorByName(String colorName) {
71  if (colorMap.containsKey(colorName)) {
72  return colorMap.get(colorName);
73  } else {
74  return NONE;
75  }
76  }
77  }
78  private final long id;
79  private final String displayName;
80  private final String description;
81  private final HTML_COLOR color;
82  private final TskData.FileKnown knownStatus;
83 
84  // Clients of the org.sleuthkit.datamodel package should not directly create these objects.
85  TagName(long id, String displayName, String description, HTML_COLOR color, TskData.FileKnown knownStatus) {
86  this.id = id;
87  this.displayName = displayName;
88  this.description = description;
89  this.color = color;
90  this.knownStatus = knownStatus;
91  }
92 
93  public long getId() {
94  return id;
95  }
96 
97  public String getDisplayName() {
98  return displayName;
99  }
100 
101  public String getDescription() {
102  return description;
103  }
104 
105  public HTML_COLOR getColor() {
106  return color;
107  }
108 
110  return knownStatus;
111  }
112 
120  @Override
121  public int compareTo(TagName other) {
122  return this.getDisplayName().compareTo(other.getDisplayName());
123  }
124 
125  @Override
126  public int hashCode() {
127  int hash = 5;
128  hash = 89 * hash + (int) (this.id ^ (this.id >>> 32));
129  hash = 89 * hash + (this.displayName != null ? this.displayName.hashCode() : 0);
130  hash = 89 * hash + (this.description != null ? this.description.hashCode() : 0);
131  hash = 89 * hash + (this.color != null ? this.color.hashCode() : 0);
132  hash = 89 * hash + (this.knownStatus != null ? this.knownStatus.hashCode() : 0);
133  return hash;
134  }
135 
136  @Override
137  public boolean equals(Object obj) {
138  if (obj == null) {
139  return false;
140  }
141  if (getClass() != obj.getClass()) {
142  return false;
143  }
144  final TagName other = (TagName) obj;
145  return (this.id == other.id
146  && Objects.equals(this.displayName, other.displayName)
147  && Objects.equals(this.description, other.description)
148  && Objects.equals(this.color, other.color)
149  && Objects.equals(this.knownStatus, other.knownStatus));
150  }
151 }
int compareTo(TagName other)
Definition: TagName.java:121
TskData.FileKnown getKnownStatus()
Definition: TagName.java:109
static HTML_COLOR getColorByName(String colorName)
Definition: TagName.java:70
boolean equals(Object obj)
Definition: TagName.java:137

Copyright © 2011-2020 Brian Carrier. (carrier -at- sleuthkit -dot- org)
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.