Package org.omegat.core.search
Class Searcher
- java.lang.Object
-
- org.omegat.core.search.Searcher
-
public class Searcher extends java.lang.Object
This class implements search functionality. It is non-reentrant: each searcher instance must be used by a single thread.
-
-
Constructor Summary
Constructors Constructor Description Searcher(IProject project, SearchExpression searchExpression)
Create new searcher instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SearchExpression
getExpression()
java.util.List<SearchMatch>
getFoundMatches()
java.util.List<SearchResultEntry>
getSearchResults()
Returns list of search resultsvoid
search()
Search for this.expression and return a list of results.boolean
searchString(java.lang.String origText)
Looks for an occurrence of the search string(s) in the supplied text string.boolean
searchString(java.lang.String origText, boolean collapseResults)
Looks for an occurrence of the search string(s) in the supplied text string.void
searchText(java.lang.String seg, java.lang.String translation, java.lang.String filename)
void
setThread(LongProcessThread thread)
Set thread for checking interruption.
-
-
-
Constructor Detail
-
Searcher
public Searcher(IProject project, SearchExpression searchExpression)
Create new searcher instance.- Parameters:
project
- Current project
-
-
Method Detail
-
setThread
public void setThread(LongProcessThread thread)
Set thread for checking interruption.
-
getExpression
public SearchExpression getExpression()
-
getSearchResults
public java.util.List<SearchResultEntry> getSearchResults()
Returns list of search results
-
search
public void search() throws java.lang.Exception
Search for this.expression and return a list of results.- Throws:
java.lang.Exception
- when searching files goes wrong
-
searchString
public boolean searchString(java.lang.String origText)
Looks for an occurrence of the search string(s) in the supplied text string.- Parameters:
origText
- The text string to search in- Returns:
- True if the text string contains all search strings
-
searchString
public boolean searchString(java.lang.String origText, boolean collapseResults)
Looks for an occurrence of the search string(s) in the supplied text string. IF matches are found, they are added to this.foundMatches.- Parameters:
origText
- The text string to search incollapseResults
- True if the adjacent results should be collapsed. This can happen on search, but not on replace.- Returns:
- True if the text string contains all search strings
-
getFoundMatches
public java.util.List<SearchMatch> getFoundMatches()
-
searchText
public void searchText(java.lang.String seg, java.lang.String translation, java.lang.String filename)
-
-