ghm.follow.search
Class SearchEngine

java.lang.Object
  extended by ghm.follow.search.SearchEngine

public class SearchEngine
extends java.lang.Object

Searches through text based on flags passed at time of search.

Author:
Carl Hall (carl.hall@gmail.com)

Field Summary
static int CASE_SENSITIVE
           
static int REGEX
           
 
Constructor Summary
SearchEngine(int flags)
          Constructor for search text and tracking display elements for results list
 
Method Summary
protected  java.util.List<WordResult> regexSearch(java.util.regex.Pattern p, java.lang.String text)
          Searches text using the provided Pattern

Thanks to prec in #regex for correcting the use of Matcher.
 java.util.List<WordResult> search(java.lang.String term, java.lang.String text)
          Search for term.
protected  java.util.List<WordResult> textSearch(java.lang.String term, java.lang.String text)
          Searches text for term by performing a simple text search.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CASE_SENSITIVE

public static final int CASE_SENSITIVE
See Also:
Constant Field Values

REGEX

public static final int REGEX
See Also:
Constant Field Values
Constructor Detail

SearchEngine

public SearchEngine(int flags)
Constructor for search text and tracking display elements for results list

Parameters:
textPane -
Method Detail

search

public java.util.List<WordResult> search(java.lang.String term,
                                         java.lang.String text)
Search for term. Use the constants of this class for flags.

Parameters:
term -
Returns:
An array of found positions of term

textSearch

protected java.util.List<WordResult> textSearch(java.lang.String term,
                                                java.lang.String text)
Searches text for term by performing a simple text search.

Parameters:
term -
text -
Returns:

regexSearch

protected java.util.List<WordResult> regexSearch(java.util.regex.Pattern p,
                                                 java.lang.String text)
Searches text using the provided Pattern

Thanks to prec in #regex for correcting the use of Matcher.

Parameters:
p -
text -
Returns:


Copyright © 2008. All Rights Reserved.