Sleuth Kit Java Bindings (JNI)  4.11.0
Java bindings for using The Sleuth Kit
Host.java
Go to the documentation of this file.
1 /*
2  * Sleuth Kit Data Model
3  *
4  * Copyright 2021-2021 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.util.Objects;
22 
26 public final class Host {
27 
28  private final long id;
29  private final String name;
30  private final HostDbStatus status;
31 
32  Host(long id, String name) {
33  this(id, name, HostDbStatus.ACTIVE);
34  }
35 
36  Host(long id, String name, HostDbStatus status) {
37  this.id = id;
38  this.name = name;
39  this.status = status;
40  }
41 
47  public long getHostId() {
48  return id;
49  }
50 
56  public String getName() {
57  return name;
58  }
59 
65  HostDbStatus getStatus() {
66  return status;
67  }
68 
69  @Override
70  public int hashCode() {
71  int hash = 5;
72  hash = 67 * hash + (int) (this.id ^ (this.id >>> 32));
73  hash = 67 * hash + Objects.hashCode(this.name);
74  return hash;
75  }
76 
77  @Override
78  public boolean equals(Object obj) {
79  if (this == obj) {
80  return true;
81  }
82  if (obj == null) {
83  return false;
84  }
85  if (getClass() != obj.getClass()) {
86  return false;
87  }
88 
89  final Host other = (Host) obj;
90  if (this.id != other.id) {
91  return false;
92  }
93 
94  if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
95  return false;
96  }
97 
98  return true;
99  }
100 
104  enum HostDbStatus {
105  ACTIVE(0, "Active"),
106  MERGED(1, "Merged"),
107  DELETED(2, "Deleted");
108 
109  private final int id;
110  private final String name;
111 
112  HostDbStatus(int id, String name) {
113  this.id = id;
114  this.name = name;
115  }
116 
117  int getId() {
118  return id;
119  }
120 
121  String getName() {
122  return name;
123  }
124 
125  static HostDbStatus fromID(int typeId) {
126  for (HostDbStatus type : HostDbStatus.values()) {
127  if (type.ordinal() == typeId) {
128  return type;
129  }
130  }
131  return null;
132  }
133  }
134 
135 }
boolean equals(Object obj)
Definition: Host.java:78

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.