Autopsy  3.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-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 
20 package org.sleuthkit.autopsy.keywordsearch;
21 
22 import org.openide.util.NbBundle;
24 
28 class Keyword {
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 
51  Keyword(String query, boolean isLiteral, boolean isWholeword) {
52  this.keywordString = query;
53  this.isLiteral = isLiteral;
54  this.isWholeword = isWholeword;
55  }
56 
63  Keyword(String query, boolean isLiteral, BlackboardAttribute.ATTRIBUTE_TYPE keywordType) {
64  this(query, isLiteral);
65  this.keywordType = keywordType;
66  }
67 
68  void setType(BlackboardAttribute.ATTRIBUTE_TYPE keywordType) {
69  this.keywordType = keywordType;
70  }
71 
72  BlackboardAttribute.ATTRIBUTE_TYPE getType() {
73  return this.keywordType;
74  }
75 
80  String getQuery() {
81  return keywordString;
82  }
83 
84  boolean isLiteral() {
85  return isLiteral;
86  }
87 
88  boolean isWholeword() {
89  return isWholeword;
90  }
91 
92  @Override
93  public String toString() {
94  return NbBundle.getMessage(this.getClass(), "Keyword.toString.text", keywordString, isLiteral, keywordType);
95  }
96 
97  @Override
98  public boolean equals(Object obj) {
99  if (obj == null) {
100  return false;
101  }
102  if (getClass() != obj.getClass()) {
103  return false;
104  }
105  final Keyword other = (Keyword) obj;
106  if ((this.keywordString == null) ? (other.keywordString != null) : !this.keywordString.equals(other.keywordString)) {
107  return false;
108  }
109  if (this.isLiteral != other.isLiteral) {
110  return false;
111  }
112  return true;
113  }
114 
115  @Override
116  public int hashCode() {
117  int hash = 7;
118  hash = 17 * hash + (this.keywordString != null ? this.keywordString.hashCode() : 0);
119  hash = 17 * hash + (this.isLiteral ? 1 : 0);
120  return hash;
121  }
122 }
ATTRIBUTE_TYPE(int typeID, String label, String displayName)

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