public class SearchResult extends java.lang.Object implements java.lang.Comparable<SearchResult>
SearchEngine| Constructor and Description |
|---|
SearchResult()
Constructor; indicates no match is found.
|
SearchResult(DocumentRange range,
int count,
int markedCount)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SearchResult other)
Compares this search result to another.
|
boolean |
equals(java.lang.Object other)
Returns whether this search result represents the same logical result
as another.
|
int |
getCount()
Returns the number of matches found or replaced.
|
int |
getMarkedCount()
Returns the number of instances marked.
|
DocumentRange |
getMatchRange()
If a find or replace operation is successful, this will be the range
of text representing the found text (for "find" operations) or the
replacement text inserted (for "replace" operations; for "replace all"
operations this will be the last replacement region).
|
int |
hashCode()
Overridden simply as a best practice, since
equals(Object) is
overridden. |
void |
setCount(int count)
Sets the number of matches found or replaced.
|
void |
setMarkedCount(int markedCount)
Sets the number of marked occurrences found.
|
void |
setMatchRange(DocumentRange range)
Sets the selected range for this search operation.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
boolean |
wasFound()
Returns whether anything was found in this search operation.
|
public SearchResult()
public SearchResult(DocumentRange range, int count, int markedCount)
range - The selected range of text after the find or replace
operation. This can be null if the selection was
not changed.count - The number of matches found or replaced. For regular
"find" and "replace" operations, this will be zero or
1; for "replace all" operations, this will be the
number of replacements.markedCount - The number of matches marked. If "mark all" is
disabled, this should be zero.public int compareTo(SearchResult other)
compareTo in interface java.lang.Comparable<SearchResult>other - Another search result to compare to.other.public boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - Another object (presumably another
SearchResult).public int getCount()
1. For "replace
all" operations, this will be the number of replacements. For "mark
all" operations, this will be zero.setCount(int)public int getMarkedCount()
0.setMarkedCount(int)public DocumentRange getMatchRange()
null, since they do not update the editor's selection.setMatchRange(DocumentRange)public int hashCode()
equals(Object) is
overridden.hashCode in class java.lang.Objectpublic void setCount(int count)
1. For
"replace all" operations, this should be the number of replacements.
For "mark all" operations, this should be zero.count - The count.getCount()public void setMarkedCount(int markedCount)
markedCount - The number of marked occurrences found.getMarkedCount()public void setMatchRange(DocumentRange range)
range - The new selected range.getMatchRange()public java.lang.String toString()
toString in class java.lang.Objectpublic boolean wasFound()
getCount()>0.getCount()