Gephi Toolkit Javadoc

org.gephi.datalab.impl
Class SearchReplaceControllerImpl

java.lang.Object
  extended by org.gephi.datalab.impl.SearchReplaceControllerImpl
All Implemented Interfaces:
SearchReplaceController

public class SearchReplaceControllerImpl
extends java.lang.Object
implements SearchReplaceController

Implementation of the SearchReplaceController interface declared in the Data Laboratory API.

Author:
Eduardo Ramos
See Also:
SearchReplaceController

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.gephi.datalab.api.SearchReplaceController
SearchReplaceController.SearchOptions, SearchReplaceController.SearchResult
 
Constructor Summary
SearchReplaceControllerImpl()
           
 
Method Summary
 boolean canReplace(SearchReplaceController.SearchResult result)
          Indicates if a SearchResult can be replaced or not.
 SearchReplaceController.SearchResult findNext(SearchReplaceController.SearchOptions searchOptions)
          Finds next (or first) ocurrence for the given search options.
 SearchReplaceController.SearchResult findNext(SearchReplaceController.SearchResult result)
          Finds next ocurrence for the given search options contained in a SearchResult.
 SearchReplaceController.SearchResult replace(SearchReplaceController.SearchResult result, java.lang.String replacement)
          Replaces a SearchResult with the given replacement String.
 int replaceAll(SearchReplaceController.SearchOptions searchOptions, java.lang.String replacement)
          Replaces all SearchResults that can be replaced with the given search options from the beginning to the end of the data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchReplaceControllerImpl

public SearchReplaceControllerImpl()
Method Detail

findNext

public SearchReplaceController.SearchResult findNext(SearchReplaceController.SearchOptions searchOptions)
Description copied from interface: SearchReplaceController

Finds next (or first) ocurrence for the given search options.

Returns a SearchResult instance 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 findNext is called

Specified by:
findNext in interface SearchReplaceController
Parameters:
searchOptions - Options of the search
Returns:
SearchResult with details of the match or null

findNext

public SearchReplaceController.SearchResult findNext(SearchReplaceController.SearchResult result)
Description copied from interface: SearchReplaceController

Finds next ocurrence for the given search options contained in a SearchResult.

Returns a SearchResult instance 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 findNext is called

Specified by:
findNext in interface SearchReplaceController
Parameters:
result - Last result of the search
Returns:
SearchResult with details of the match or null

canReplace

public boolean canReplace(SearchReplaceController.SearchResult result)
Description copied from interface: SearchReplaceController

Indicates if a SearchResult can be replaced or not.

Computed columns and id columns cannot be replaced.

Specified by:
canReplace in interface SearchReplaceController
Parameters:
result - SearchResult to check before replacing
Returns:
True if it can be replaced, false otherwise

replace

public SearchReplaceController.SearchResult replace(SearchReplaceController.SearchResult result,
                                                    java.lang.String replacement)
Description copied from interface: SearchReplaceController

Replaces a SearchResult with 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 SearchResult calling findNext.

If useRegexReplaceMode is enabled, IndexOutOfBoundsException can be thrown when the replacement is not correct for the regular expression.

Specified by:
replace in interface SearchReplaceController
Parameters:
result - SearchResult to replace
replacement - Replacement String
Returns:
Next SearchResult or null if not successful

replaceAll

public int replaceAll(SearchReplaceController.SearchOptions searchOptions,
                      java.lang.String replacement)
Description copied from interface: SearchReplaceController

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.

Specified by:
replaceAll in interface SearchReplaceController
Parameters:
searchOptions - Search options for the searches
replacement - Replacement String
Returns:
Count of made replacements

Gephi Toolkit Javadoc