Interface SearchReplaceController
-
public interface SearchReplaceControllerIndependent controller for search/replace feature.
Operates with
SearchOptionsandSearchResultobjects.- Author:
- Eduardo Ramos
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSearchReplaceController.SearchOptionsClass that wraps the different possible options of search and provides various useful constructors.static classSearchReplaceController.SearchResultClass that wraps the result of a search contaning the search options used for this result and the node or edge, row, column and start-end index of the value where ocurrence was found.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanReplace(SearchReplaceController.SearchResult result)Indicates if aSearchResultcan be replaced or not.SearchReplaceController.SearchResultfindNext(SearchReplaceController.SearchOptions searchOptions)Finds next (or first) ocurrence for the given search options.SearchReplaceController.SearchResultfindNext(SearchReplaceController.SearchResult result)Finds next ocurrence for the given search options contained in a SearchResult.SearchReplaceController.SearchResultreplace(SearchReplaceController.SearchResult result, String replacement)Replaces aSearchResultwith the given replacement String.intreplaceAll(SearchReplaceController.SearchOptions searchOptions, String replacement)Replaces all SearchResults that can be replaced with the given search options from the beginning to the end of the data.
-
-
-
Method Detail
-
findNext
SearchReplaceController.SearchResult findNext(SearchReplaceController.SearchOptions searchOptions)
Finds next (or first) ocurrence for the given search options.
Returns a
SearchResultinstance with the details or null if the search was not successful.Modifies the given search options in order to match the next result the next time
findNextis called- Parameters:
searchOptions- Options of the search- Returns:
- SearchResult with details of the match or null
-
findNext
SearchReplaceController.SearchResult findNext(SearchReplaceController.SearchResult result)
Finds next ocurrence for the given search options contained in a SearchResult.
Returns a
SearchResultinstance with the details or null if the search was not successful.Modifies the given search options in order to match the next result the next time
findNextis called- Parameters:
result- Last result of the search- Returns:
- SearchResult with details of the match or null
-
canReplace
boolean canReplace(SearchReplaceController.SearchResult result)
Indicates if a
SearchResultcan be replaced or not.Computed columns and id columns cannot be replaced.
- Parameters:
result- SearchResult to check before replacing- Returns:
- True if it can be replaced, false otherwise
-
replace
SearchReplaceController.SearchResult replace(SearchReplaceController.SearchResult result, String replacement)
Replaces a
SearchResultwith the given replacement String.Also tries to find next search result and returns it.
If the data has changed and the replacement can't be done it will just return next
SearchResultcallingfindNext.If useRegexReplaceMode is enabled, IndexOutOfBoundsException can be thrown when the replacement is not correct for the regular expression.
- Parameters:
result- SearchResult to replacereplacement- Replacement String- Returns:
- Next SearchResult or null if not successful
-
replaceAll
int replaceAll(SearchReplaceController.SearchOptions searchOptions, String replacement)
Replaces all SearchResults that can be replaced with the given search options from the beginning to the end of the data.
If useRegexReplaceMode is enabled, IndexOutOfBoundsException can be thrown when the replacement is not correct for the regular expression.
- Parameters:
searchOptions- Search options for the searchesreplacement- Replacement String- Returns:
- Count of made replacements
-
-