19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.text.Normalizer;
22 import org.openide.util.NbBundle;
36 private String searchTerm;
37 private boolean isLiteral;
38 private boolean isWholeWord;
39 private BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType;
40 private final String listName;
46 private final String originalTerm;
60 Keyword(String searchTerm,
boolean isLiteral,
boolean isWholeWord) {
61 this(searchTerm, isLiteral, isWholeWord,
"", searchTerm);
92 Keyword(String searchTerm,
boolean isLiteral,
boolean isWholeWord, String listName, String originalTerm) {
93 this.searchTerm = Normalizer.normalize(searchTerm, Normalizer.Form.NFKC);
94 this.isLiteral = isLiteral;
95 this.isWholeWord = isWholeWord;
96 this.listName = listName;
97 this.originalTerm = originalTerm;
115 Keyword(String searchTerm,
boolean isLiteral, BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
116 this(searchTerm, isLiteral,
true);
117 this.artifactAtrributeType = artifactAtrributeType;
126 String getSearchTerm() {
136 boolean searchTermIsLiteral() {
147 boolean searchTermIsWholeWord() {
151 String getSearchTermType() {
154 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.exactButton.text");
156 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.substringButton.text");
159 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.regexButton.text");
172 void setArtifactAttributeType(BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
173 this.artifactAtrributeType = artifactAtrributeType;
185 BlackboardAttribute.ATTRIBUTE_TYPE getArtifactAttributeType() {
186 return this.artifactAtrributeType;
190 public String toString() {
191 return String.format(
"Keyword{searchTerm='%s', isLiteral=%s, isWholeWord=%s}", searchTerm, isLiteral, isWholeWord);
195 public boolean equals(Object obj) {
199 if (getClass() != obj.getClass()) {
202 Keyword other = (Keyword) obj;
203 return (this.searchTerm.equals(other.getSearchTerm())
204 && this.isLiteral == other.searchTermIsLiteral()
205 && this.isWholeWord == other.searchTermIsWholeWord()
206 && this.listName.equals(other.getListName())
207 && this.originalTerm.equals(other.getOriginalTerm()));
211 public int hashCode() {
213 hash = 17 * hash + this.searchTerm.hashCode();
214 hash = 17 * hash + (this.isLiteral ? 1 : 0);
215 hash = 17 * hash + (this.isWholeWord ? 1 : 0);
222 String getListName() {
229 String getOriginalTerm() {