19 package org.sleuthkit.autopsy.keywordsearch;
21 import org.openide.util.NbBundle;
35 private String searchTerm;
36 private boolean isLiteral;
37 private boolean isWholeWord;
39 private final String listName;
45 private final String originalTerm;
59 Keyword(String searchTerm,
boolean isLiteral,
boolean isWholeWord) {
60 this.searchTerm = searchTerm;
61 this.isLiteral = isLiteral;
62 this.isWholeWord = isWholeWord;
64 this.originalTerm = searchTerm;
95 Keyword(String searchTerm,
boolean isLiteral,
boolean isWholeWord, String listName, String originalTerm) {
96 this.searchTerm = searchTerm;
97 this.isLiteral = isLiteral;
98 this.isWholeWord = isWholeWord;
99 this.listName = listName;
100 this.originalTerm = originalTerm;
117 Keyword(String searchTerm,
boolean isLiteral, BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
118 this(searchTerm, isLiteral,
true);
119 this.artifactAtrributeType = artifactAtrributeType;
128 String getSearchTerm() {
138 boolean searchTermIsLiteral() {
149 boolean searchTermIsWholeWord() {
153 String getSearchTermType() {
156 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.exactButton.text");
158 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.substringButton.text");
161 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.regexButton.text");
174 void setArtifactAttributeType(BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
175 this.artifactAtrributeType = artifactAtrributeType;
188 return this.artifactAtrributeType;
192 public String toString() {
193 return String.format(
"Keyword{searchTerm='%s', isLiteral=%s, isWholeWord=%s}", searchTerm, isLiteral, isWholeWord);
197 public boolean equals(Object obj) {
201 if (getClass() != obj.getClass()) {
204 Keyword other = (Keyword) obj;
205 return (this.searchTerm.equals(other.getSearchTerm())
206 && this.isLiteral == other.searchTermIsLiteral()
207 && this.isWholeWord == other.searchTermIsWholeWord()
208 && this.listName.equals(other.getListName())
209 && this.originalTerm.equals(other.getOriginalTerm()));
213 public int hashCode() {
215 hash = 17 * hash + this.searchTerm.hashCode();
216 hash = 17 * hash + (this.isLiteral ? 1 : 0);
217 hash = 17 * hash + (this.isWholeWord ? 1 : 0);
224 String getListName() {
231 String getOriginalTerm() {
ATTRIBUTE_TYPE(int typeID, String typeName, String displayName, TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE valueType)