Autopsy  4.0
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-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.keywordsearch;
20 
21 import org.openide.util.NbBundle;
22 import org.sleuthkit.datamodel.BlackboardAttribute;
23 
27 class Keyword {
28 
29  private String keywordString; // keyword to search for
30  private boolean isLiteral; // false if reg exp
31  private boolean isWholeword; // false if match a substring
32  private BlackboardAttribute.ATTRIBUTE_TYPE keywordType = null;
33 
39  Keyword(String query, boolean isLiteral) {
40  this.keywordString = query;
41  this.isLiteral = isLiteral;
42  this.isWholeword = true;
43  }
44 
52  Keyword(String query, boolean isLiteral, boolean isWholeword) {
53  this.keywordString = query;
54  this.isLiteral = isLiteral;
55  this.isWholeword = isWholeword;
56  }
57 
64  Keyword(String query, boolean isLiteral, BlackboardAttribute.ATTRIBUTE_TYPE keywordType) {
65  this(query, isLiteral);
66  this.keywordType = keywordType;
67  }
68 
69  void setType(BlackboardAttribute.ATTRIBUTE_TYPE keywordType) {
70  this.keywordType = keywordType;
71  }
72 
73  BlackboardAttribute.ATTRIBUTE_TYPE getType() {
74  return this.keywordType;
75  }
76 
81  String getQuery() {
82  return keywordString;
83  }
84 
85  boolean isLiteral() {
86  return isLiteral;
87  }
88 
89  boolean isWholeword() {
90  return isWholeword;
91  }
92 
93  @Override
94  public String toString() {
95  return NbBundle.getMessage(this.getClass(), "Keyword.toString.text", keywordString, isLiteral, keywordType);
96  }
97 
98  @Override
99  public boolean equals(Object obj) {
100  if (obj == null) {
101  return false;
102  }
103  if (getClass() != obj.getClass()) {
104  return false;
105  }
106  final Keyword other = (Keyword) obj;
107  if ((this.keywordString == null) ? (other.keywordString != null) : !this.keywordString.equals(other.keywordString)) {
108  return false;
109  }
110  if (this.isLiteral != other.isLiteral) {
111  return false;
112  }
113  return true;
114  }
115 
116  @Override
117  public int hashCode() {
118  int hash = 7;
119  hash = 17 * hash + (this.keywordString != null ? this.keywordString.hashCode() : 0);
120  hash = 17 * hash + (this.isLiteral ? 1 : 0);
121  return hash;
122  }
123 }

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