public class JXEditorPane.DocumentSearchable extends Object implements Searchable
Searchable
implementation for Document
s.Modifier and Type | Field and Description |
---|---|
(package private) int |
lastFoundIndex |
(package private) MatchResult |
lastMatchResult |
(package private) String |
lastRegEx |
Constructor and Description |
---|
DocumentSearchable() |
Modifier and Type | Method and Description |
---|---|
private boolean |
foundExtendedMatch(Pattern pattern,
int start)
Search from same startIndex as the previous search.
|
private MatchResult |
getMatchResult(Matcher matcher,
boolean useFirst) |
protected boolean |
isEmpty(String searchString)
checks if the searchString should be interpreted as empty.
|
private boolean |
maybeExtendedMatch(int startIndex)
Checks if the startIndex is a candidate for trying a re-match.
|
int |
search(Pattern pattern)
Search for the pattern from the beginning of the document.
|
int |
search(Pattern pattern,
int startIndex)
Search for the pattern from the start index.
|
int |
search(Pattern pattern,
int startIndex,
boolean backwards)
Search for the pattern from the start index.
|
int |
search(String searchString)
Search
searchString from the beginning of a document. |
int |
search(String searchString,
int columnIndex)
Search
searchString from the given position in a document. |
int |
search(String searchString,
int columnIndex,
boolean backward)
Search
searchString in the given direction from the some position in a document. |
private int |
updateStateAfterFound(MatchResult currentResult,
int offset) |
private void |
updateStateAfterNotFound() |
int lastFoundIndex
MatchResult lastMatchResult
public DocumentSearchable()
public int search(String searchString)
Searchable
searchString
from the beginning of a document.search
in interface Searchable
searchString
- String
we should find in a document.String
or -1 if a match cannot be found.public int search(String searchString, int columnIndex)
Searchable
searchString
from the given position in a document.search
in interface Searchable
searchString
- String
we should find in a document.columnIndex
- Start position in a document or -1 if we want to search from the beginning.String
or -1 if a match cannot be found.public int search(String searchString, int columnIndex, boolean backward)
Searchable
searchString
in the given direction from the some position in a document.search
in interface Searchable
searchString
- String
we should find in a document.columnIndex
- Start position in a document or -1 if we want to search from the beginning.backward
- Indicates search direction, will search from the given position towards the
beginning of a document if this parameter is true
.String
or -1 if a match cannot be found.protected boolean isEmpty(String searchString)
searchString
- public int search(Pattern pattern)
Searchable
search
in interface Searchable
pattern
- Pattern for searchPattern
or -1 if a match cannot be found.public int search(Pattern pattern, int startIndex)
Searchable
search
in interface Searchable
pattern
- Pattern for searchstartIndex
- starting index of search. If -1 then start from the beginningpublic int search(Pattern pattern, int startIndex, boolean backwards)
Searchable
search
in interface Searchable
pattern
- Pattern for searchstartIndex
- starting index of search. If -1 then start from the beginningbackwards
- indicates the direction if true then search is backwardsprivate boolean foundExtendedMatch(Pattern pattern, int start)
pattern
- start
- private boolean maybeExtendedMatch(int startIndex)
startIndex
- private int updateStateAfterFound(MatchResult currentResult, int offset)
currentResult
- offset
- private MatchResult getMatchResult(Matcher matcher, boolean useFirst)
matcher
- useFirst
- whether or not to return after the first match is found.MatchResult
or nullprivate void updateStateAfterNotFound()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses