Sleuth Kit Java Bindings (JNI)  4.12.1
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 2013-2020 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", "#FFFFFF"), //NON-NLS
38  SILVER("Silver", "#C0C0C0"), //NON-NLS
39  GRAY("Gray", "#808080"), //NON-NLS
40  BLACK("Black", "#000000"), //NON-NLS
41  RED("Red", "#FF0000"), //NON-NLS
42  MAROON("Maron", "#800000"), //NON-NLS
43  YELLOW("Yellow", "#FFFF00"), //NON-NLS
44  OLIVE("Olive", "#808000"), //NON-NLS
45  LIME("Lime", "#00FF00"), //NON-NLS
46  GREEN("Green", "#008000"), //NON-NLS
47  AQUA("Aqua", "#00FFFF"), //NON-NLS
48  TEAL("Teal", "#008080"), //NON-NLS
49  BLUE("Blue", "#0000FF"), //NON-NLS
50  NAVY("Navy", "#000080"), //NON-NLS
51  FUCHSIA("Fuchsia", "#FF00FF"), //NON-NLS
52  PURPLE("Purple", "#800080"); //NON-NLS
53  private final static HashMap<String, HTML_COLOR> colorMap = new HashMap<String, HTML_COLOR>();
54  private final String name;
55  private final String hexString;
56 
57  static {
58  for (HTML_COLOR color : HTML_COLOR.values()) {
59  colorMap.put(color.getName(), color);
60  }
61  }
62 
63  HTML_COLOR(String name, String hexString) {
64  this.hexString = hexString;
65  this.name = name;
66  }
67 
68  String getName() {
69  return name;
70  }
71 
72  public String getRgbValue() {
73  return hexString;
74  }
75 
76  public static HTML_COLOR getColorByName(String colorName) {
77  if (colorMap.containsKey(colorName)) {
78  return colorMap.get(colorName);
79  } else {
80  return NONE;
81  }
82  }
83  }
84  private final long id;
85  private final String displayName;
86  private final String description;
87  private final HTML_COLOR color;
88  private final TskData.FileKnown knownStatus;
89  private final long tagSetId;
90  private final int rank;
91 
92  // Clients of the org.sleuthkit.datamodel package should not directly create these objects.
93  TagName(long id, String displayName, String description, HTML_COLOR color, TskData.FileKnown knownStatus, long tagSetId, int rank) {
94  this.id = id;
95  this.displayName = displayName;
96  this.description = description;
97  this.color = color;
98  this.knownStatus = knownStatus;
99  this.tagSetId = tagSetId;
100  this.rank = rank;
101  }
102 
103  public long getId() {
104  return id;
105  }
106 
107  public String getDisplayName() {
108  return displayName;
109  }
110 
111  public String getDescription() {
112  return description;
113  }
114 
115  public HTML_COLOR getColor() {
116  return color;
117  }
118 
120  return knownStatus;
121  }
122 
123  long getTagSetId() {
124  return tagSetId;
125  }
126 
127  public int getRank() {
128  return rank;
129  }
130 
138  @Override
139  public int compareTo(TagName other) {
140  return this.getDisplayName().compareTo(other.getDisplayName());
141  }
142 
143  @Override
144  public int hashCode() {
145  int hash = 5;
146  hash = 89 * hash + (int) (this.id ^ (this.id >>> 32));
147  hash = 89 * hash + (this.displayName != null ? this.displayName.hashCode() : 0);
148  hash = 89 * hash + (this.description != null ? this.description.hashCode() : 0);
149  hash = 89 * hash + (this.color != null ? this.color.hashCode() : 0);
150  hash = 89 * hash + (this.knownStatus != null ? this.knownStatus.hashCode() : 0);
151  hash = 89 * hash + (int) (this.id ^ (this.tagSetId >>> 32));
152  return hash;
153  }
154 
155  @Override
156  public boolean equals(Object obj) {
157  if (obj == null) {
158  return false;
159  }
160  if (getClass() != obj.getClass()) {
161  return false;
162  }
163  final TagName other = (TagName) obj;
164  return (this.id == other.getId()
165  && Objects.equals(this.displayName, other.getDisplayName())
166  && Objects.equals(this.description, other.getDescription())
167  && Objects.equals(this.color, other.getColor())
168  && Objects.equals(this.knownStatus, other.getKnownStatus())
169  && this.tagSetId == other.getTagSetId());
170  }
171 }
HTML_COLOR(String name, String hexString)
Definition: TagName.java:63
int compareTo(TagName other)
Definition: TagName.java:139
TskData.FileKnown getKnownStatus()
Definition: TagName.java:119
static HTML_COLOR getColorByName(String colorName)
Definition: TagName.java:76
boolean equals(Object obj)
Definition: TagName.java:156

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