Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
Keyword.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2016 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.keywordsearch;
20 
21 import org.sleuthkit.datamodel.BlackboardAttribute;
22 
32 class Keyword {
33 
34  private String searchTerm;
35  private boolean isLiteral;
36  private boolean isWholeWord;
37  private BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType;
38 
48  Keyword(String searchTerm, boolean isLiteral) {
49  this.searchTerm = searchTerm;
50  this.isLiteral = isLiteral;
51  this.isWholeWord = true;
52  }
53 
66  Keyword(String searchTerm, boolean isLiteral, boolean isWholeWord) {
67  this.searchTerm = searchTerm;
68  this.isLiteral = isLiteral;
69  this.isWholeWord = isWholeWord;
70  }
71 
86  Keyword(String searchTerm, boolean isLiteral, BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
87  this(searchTerm, isLiteral);
88  this.artifactAtrributeType = artifactAtrributeType;
89  }
90 
97  String getSearchTerm() {
98  return searchTerm;
99  }
100 
107  boolean searchTermIsLiteral() {
108  return isLiteral;
109  }
110 
118  boolean searchTermIsWholeWord() {
119  return isWholeWord;
120  }
121 
131  void setArtifactAttributeType(BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
132  this.artifactAtrributeType = artifactAtrributeType;
133  }
134 
144  BlackboardAttribute.ATTRIBUTE_TYPE getArtifactAttributeType() {
145  return this.artifactAtrributeType;
146  }
147 
148  @Override
149  public String toString() {
150  return String.format("Keyword{searchTerm='%s', isLiteral=%s, isWholeWord=%s}", searchTerm, isLiteral, isWholeWord);
151  }
152 
153  @Override
154  public boolean equals(Object obj) {
155  if (obj == null) {
156  return false;
157  }
158  if (getClass() != obj.getClass()) {
159  return false;
160  }
161  Keyword other = (Keyword) obj;
162  return (this.searchTerm.equals(other.searchTerm)
163  && this.isLiteral == other.isLiteral
164  && this.isWholeWord == other.isWholeWord);
165  }
166 
167  @Override
168  public int hashCode() {
169  int hash = 7;
170  hash = 17 * hash + this.searchTerm.hashCode();
171  hash = 17 * hash + (this.isLiteral ? 1 : 0);
172  hash = 17 * hash + (this.isWholeWord ? 1 : 0);
173  return hash;
174  }
175 
176 }

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