IBM Rational Performance Tester SDK

com.ibm.rational.common.test.editor.framework.search
Class BasicSearchComparator

java.lang.Object
  extended by com.ibm.rational.common.test.editor.framework.kernel.search.SearchComparator
      extended by com.ibm.rational.common.test.editor.framework.search.BasicSearchComparator
All Implemented Interfaces:
com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparator, com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparatorExtension

public abstract class BasicSearchComparator
extends com.ibm.rational.common.test.editor.framework.kernel.search.SearchComparator

Recommended class to be used with Test Search.


Constructor Summary
BasicSearchComparator(com.ibm.rational.common.test.editor.framework.kernel.search.SearchParameters parameters)
           
 
Method Summary
 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)
           
 
Methods inherited from class com.ibm.rational.common.test.editor.framework.kernel.search.SearchComparator
getCounter, getParameters, getQuerySpecification, incCounter, isEmpty, resetCounter, setParameters, setQuerySpecification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparator
initParameters
 

Constructor Detail

BasicSearchComparator

public BasicSearchComparator(com.ibm.rational.common.test.editor.framework.kernel.search.SearchParameters parameters)
Parameters:
parameters -
Method Detail

_old_doSearch

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)
Default implementation of 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.

See Also:
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}

doSearch

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)

shouldSearch

public boolean shouldSearch(Object object,
                            com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs)
Specified by:
shouldSearch in interface com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparator
Overrides:
shouldSearch in class com.ibm.rational.common.test.editor.framework.kernel.search.SearchComparator

searchForSubstrings

protected List searchForSubstrings(Object element,
                                   String text,
                                   String search,
                                   boolean caseSensitive,
                                   String fieldName,
                                   String id)
Utility method that performs search in a given field.

Parameters:
element - Object Model Element
text - String Field value
search - String text to find
caseSensitive - boolean perform case-sensitive search
fieldName - String field name
id - String field ID
Returns:
List list of SearchMatch's.
Since:
New behavior since 8.2 -- the method calls SearchComparator.getQuerySpecification() to extract the regex parameter in order to support regular expression search.
See Also:
BasicSearchComparator.getTextSearcher(String), BasicSearchComparator.createSearchMatch(Object, String, String, IRegion)

createSearchMatch

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).

Parameters:
element - CBActionElement model element
fieldName - String. Translated name of the attribute field. This is visible in GUI.
id - String. Field id
r - IRegion. Region with offset and length of the match
Returns:
SearchMatch or derived class, or null.

getTextSearcher

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. If the search already exists, calls TextSearcher.setSearchText(String)

Parameters:
text - String text to search for.
Returns:
TextSearcher

createTextSearcher

protected com.ibm.rational.common.test.editor.framework.extensions.TextSearcher createTextSearcher(String text)
Returns new instance of TextSearcher

Parameters:
text - String text to search for.
Returns:
TextSearcher
See Also:
BasicSearchComparator.createTextSearcher(String), BasicSearchComparator.createSearchMatch(Object, String, String, IRegion)

getPreviewProvider

protected abstract com.ibm.rational.common.test.editor.framework.kernel.search.IPreviewProvider getPreviewProvider()
Returns:
IPreviewProvider

addMatches

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.

Parameters:
matches - List
result - SearchResult
See Also:
SearchMatch, SearchComparator.incCounter(int)

addElementMatch

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).

Parameters:
element - Object model element
result - SearchResult result.

chainComparator

public void chainComparator(com.ibm.rational.common.test.editor.framework.kernel.search.ISearchComparator comparator)

IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2012. All rights reserved.