Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.javatools.ui.search
Class SearchMatcher

java.lang.Object
  extended by oracle.javatools.ui.search.SearchMatcher


public abstract class SearchMatcher
extends java.lang.Object

Provides standard implementations of basic search and filter matching.

This class is abstract. You can obtain an instance of a specific matching algorithm by calling one of the static factory methods.

Two standard implementations are provided.

substring matcher will return true if the text to search contains the search string as a substring.

prefix matcher will return true if any of the words in the text to search are prefixed by any of the words in the search string. A word is any sequence of letters or digits surrounded by non digits or letters (e.g. whitespace, symbols)

The recommended default for general text search is the prefix matcher configured to be case insensitive and exclusive, i.e.:

   SearchMatcher m = SearchMatcher.getPrefixMatcher( "search text", true, true );
 

Only use the substring matcher if performance is a significant issue (although, since you should usually be searching short, local Strings, this should rarely be the case).

Since:
11.0

Constructor Summary
SearchMatcher()
           

 

Method Summary
static SearchMatcher getPrefixMatcher(java.lang.CharSequence searchString, boolean ignoreCase, boolean exclusive)
          Returns a matcher which will match if any of the words in the search string can be found as prefixes of words in the text to search.
static SearchMatcher getSubstringMatcher(java.lang.CharSequence searchString, boolean ignoreCase)
          Returns a matcher which will match if the text to search contains the complete search string at any position.
abstract  boolean matches(java.lang.CharSequence textToSearch)
          Returns true if the specified searchString was successfully matched with the textToSearch.
 java.lang.CharSequence searchString()
          Returns the search string this matcher will match.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

SearchMatcher

public SearchMatcher()

Method Detail

matches

public abstract boolean matches(java.lang.CharSequence textToSearch)
Returns true if the specified searchString was successfully matched with the textToSearch.
Parameters:
textToSearch - the text to search. Must not be null.
Returns:
true if the search was successful, false otherwise.

searchString

public java.lang.CharSequence searchString()
Returns the search string this matcher will match.
Returns:
the search string this matcher will match.

getSubstringMatcher

public static SearchMatcher getSubstringMatcher(java.lang.CharSequence searchString,
                                                boolean ignoreCase)
Returns a matcher which will match if the text to search contains the complete search string at any position.
Parameters:
searchString - the search string.
ignoreCase - if true, case will be considered insignificant while matching.
Returns:
a SearchMatcher which matches substrings.

getPrefixMatcher

public static SearchMatcher getPrefixMatcher(java.lang.CharSequence searchString,
                                             boolean ignoreCase,
                                             boolean exclusive)
Returns a matcher which will match if any of the words in the search string can be found as prefixes of words in the text to search.

The exclusive parameter can be used to control whether this is a mutually exclusive (OR) search (the match will be successful if any of the words in the search string are prefixes of words in the text to search), or an AND search (the match will be successful if all of the words in the search string are prefixes of words in the text to search).

Parameters:
searchString - the search string.
ignoreCase - if true, case will be considered insignificant while matching.
exclusive - if true, the match will be successful if any of the words in the search string are prefixes of words in the text to search. If false, the match will be successful if all of the words in the search string are prefixes of words in the text to search.
Returns:
a SearchMatcher which matches prefixes.

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.