19 package org.sleuthkit.autopsy.keywordsearch;
21 import org.openide.util.NbBundle;
35 private String searchTerm;
36 private boolean isLiteral;
37 private boolean isWholeWord;
38 private BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType;
49 Keyword(String searchTerm,
boolean isLiteral) {
50 this.searchTerm = searchTerm;
51 this.isLiteral = isLiteral;
52 this.isWholeWord =
true;
67 Keyword(String searchTerm,
boolean isLiteral,
boolean isWholeWord) {
68 this.searchTerm = searchTerm;
69 this.isLiteral = isLiteral;
70 this.isWholeWord = isWholeWord;
87 Keyword(String searchTerm,
boolean isLiteral, BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
88 this(searchTerm, isLiteral);
89 this.artifactAtrributeType = artifactAtrributeType;
98 String getSearchTerm() {
108 boolean searchTermIsLiteral() {
119 boolean searchTermIsWholeWord() {
123 String getSearchTermType() {
126 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.exactButton.text");
128 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.substringButton.text");
131 return NbBundle.getMessage(NewKeywordPanel.class,
"NewKeywordPanel.regexButton.text");
144 void setArtifactAttributeType(BlackboardAttribute.ATTRIBUTE_TYPE artifactAtrributeType) {
145 this.artifactAtrributeType = artifactAtrributeType;
157 BlackboardAttribute.ATTRIBUTE_TYPE getArtifactAttributeType() {
158 return this.artifactAtrributeType;
162 public String toString() {
163 return String.format(
"Keyword{searchTerm='%s', isLiteral=%s, isWholeWord=%s}", searchTerm, isLiteral, isWholeWord);
167 public boolean equals(Object obj) {
171 if (getClass() != obj.getClass()) {
174 Keyword other = (Keyword) obj;
175 return (this.searchTerm.equals(other.getSearchTerm())
176 && this.isLiteral == other.searchTermIsLiteral()
177 && this.isWholeWord == other.searchTermIsWholeWord());
181 public int hashCode() {
183 hash = 17 * hash + this.searchTerm.hashCode();
184 hash = 17 * hash + (this.isLiteral ? 1 : 0);
185 hash = 17 * hash + (this.isWholeWord ? 1 : 0);