public abstract class BasicSearchComparator
extends com.ibm.rational.common.test.editor.framework.kernel.search.SearchComparator
Constructor and Description |
---|
BasicSearchComparator(com.ibm.rational.common.test.editor.framework.kernel.search.SearchParameters parameters) |
Modifier and Type | Method and Description |
---|---|
boolean |
_old_doSearch(Object object,
com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs,
com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result)
Default implementation of
ISearchComparator.doSearch(Object, QuerySpecification, SearchResult) . |
protected void |
addElementMatch(Object element,
com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result)
Utility method creates an instance of
SearchMatch for a given element and calls
SearchComparator.incCounter(int) . |
protected void |
addMatches(List matches,
com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result)
Utility method creates and adds matches contained in the
matches argument to the result and increments
counter. |
void |
chainComparator(com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparator comparator) |
protected com.ibm.rational.common.test.editor.framework.kernel.search.SearchMatch |
createSearchMatch(Object element,
String fieldName,
String id,
IRegion r)
Returns search match for input data or
null if a match cannot be created (for example, due to preference settings). |
protected com.ibm.rational.common.test.editor.framework.extensions.TextSearcher |
createTextSearcher(String text)
Returns new instance of
TextSearcher |
boolean |
doSearch(Object object,
com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs,
com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result) |
protected abstract com.ibm.rational.common.test.editor.framework.kernel.search.IPreviewProvider |
getPreviewProvider() |
protected com.ibm.rational.common.test.editor.framework.extensions.TextSearcher |
getTextSearcher(String text)
Returns an existing instance of
TextSearcher or calls BasicSearchComparator.createTextSearcher(String) to get an instance
for the first time. |
protected List |
searchForSubstrings(Object element,
String text,
String search,
boolean caseSensitive,
String fieldName,
String id)
Utility method that performs search in a given field.
|
boolean |
shouldSearch(Object object,
com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs) |
getCounter, getParameters, getQuerySpecification, incCounter, isEmpty, resetCounter, setParameters, setQuerySpecification
public BasicSearchComparator(com.ibm.rational.common.test.editor.framework.kernel.search.SearchParameters parameters)
parameters
- public boolean _old_doSearch(Object object, com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs, com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result)
ISearchComparator.doSearch(Object, QuerySpecification, SearchResult)
.
Downstream classes are expected to overwrite this method to perform their specific search and call this method
to allow any possible contributors to execute the search as well.ISearchComparator.doSearch(java.lang.Object, com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification, com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult)
,
ISearchOptionsContributor}
public boolean doSearch(Object object, com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs, com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result)
public boolean shouldSearch(Object object, com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs)
shouldSearch
in interface com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparator
shouldSearch
in class com.ibm.rational.common.test.editor.framework.kernel.search.SearchComparator
protected List searchForSubstrings(Object element, String text, String search, boolean caseSensitive, String fieldName, String id)
element
- Object
Model Elementtext
- String
Field valuesearch
- String
text to findcaseSensitive
- boolean perform case-sensitive searchfieldName
- String
field nameid
- String
field IDSearchMatch
's.SearchComparator.getQuerySpecification()
to extract the regex
parameter
in order to support regular expression search.BasicSearchComparator.getTextSearcher(String)
,
BasicSearchComparator.createSearchMatch(Object, String, String, IRegion)
protected com.ibm.rational.common.test.editor.framework.kernel.search.SearchMatch createSearchMatch(Object element, String fieldName, String id, IRegion r)
null
if a match cannot be created (for example, due to preference settings).element
- CBActionElement
model elementfieldName
- String. Translated name of the attribute field. This is visible in GUI.id
- String. Field idr
- IRegion
. Region with offset and length of the matchSearchMatch
or derived class, or null
.protected com.ibm.rational.common.test.editor.framework.extensions.TextSearcher getTextSearcher(String text)
TextSearcher
or calls BasicSearchComparator.createTextSearcher(String)
to get an instance
for the first time. If the search already exists, calls TextSearcher.setSearchText(String)
text
- String
text to search for.TextSearcher
protected com.ibm.rational.common.test.editor.framework.extensions.TextSearcher createTextSearcher(String text)
TextSearcher
text
- String
text to search for.TextSearcher
BasicSearchComparator.createTextSearcher(String)
,
BasicSearchComparator.createSearchMatch(Object, String, String, IRegion)
protected abstract com.ibm.rational.common.test.editor.framework.kernel.search.IPreviewProvider getPreviewProvider()
protected void addMatches(List matches, com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result)
matches
argument to the result
and increments
counter.matches
- List
result
- SearchResult
SearchMatch
,
SearchComparator.incCounter(int)
protected void addElementMatch(Object element, com.ibm.rational.common.test.editor.framework.kernel.search.SearchResult result)
SearchMatch
for a given element
and calls
SearchComparator.incCounter(int)
.element
- Object model elementresult
- SearchResult
result.public void chainComparator(com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparator comparator)
© Copyright IBM Corp. 2013. All rights reserved.