TV-Browser 3.3.3 API

tvbrowser.core.search.regexsearch
Class RegexSearcher

java.lang.Object
  extended by tvbrowser.core.search.AbstractSearcher
      extended by tvbrowser.core.search.regexsearch.RegexSearcher
All Implemented Interfaces:
ProgramSearcher
Direct Known Subclasses:
ActorSearcher

public class RegexSearcher
extends AbstractSearcher

Searches for programs using a regular expression.

Author:
Til Schneider, www.murfman.de

Field Summary
 
Fields inherited from class tvbrowser.core.search.AbstractSearcher
mReplaceSpCh
 
Constructor Summary
RegexSearcher(java.util.regex.Pattern pattern)
          Creates a new instance of RegexSearcher.
RegexSearcher(java.lang.String regex, boolean caseSensitive)
          Creates a new instance of RegexSearcher.
RegexSearcher(java.lang.String regex, boolean caseSensitive, java.lang.String searchTerm)
          Creates a new instance of RegexSearcher.
 
Method Summary
static java.util.regex.Pattern createSearchPattern(java.lang.String regex, boolean caseSensitive)
          Creates a pattern for a regular expression.
 java.util.regex.Pattern getPattern()
          get the pattern used by this searcher
protected  boolean matches(java.lang.String value)
          Checks whether a value matches to the criteria of this searcher.
static java.lang.String searchTextToRegex(java.lang.String searchText, boolean matchKeyword)
          Creates a regex from a search text.
 
Methods inherited from class tvbrowser.core.search.AbstractSearcher
matches, search, search, search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexSearcher

public RegexSearcher(java.util.regex.Pattern pattern)
Creates a new instance of RegexSearcher.

Parameters:
pattern - The regex pattern to use.

RegexSearcher

public RegexSearcher(java.lang.String regex,
                     boolean caseSensitive)
              throws TvBrowserException
Creates a new instance of RegexSearcher.

Parameters:
regex -
caseSensitive -
Throws:
TvBrowserException - If there is a syntax error in the regular expression.

RegexSearcher

public RegexSearcher(java.lang.String regex,
                     boolean caseSensitive,
                     java.lang.String searchTerm)
              throws TvBrowserException
Creates a new instance of RegexSearcher.

Parameters:
regex -
caseSensitive -
Throws:
TvBrowserException - If there is a syntax error in the regular expression.
Method Detail

createSearchPattern

public static java.util.regex.Pattern createSearchPattern(java.lang.String regex,
                                                          boolean caseSensitive)
                                                   throws TvBrowserException
Creates a pattern for a regular expression.

Parameters:
regex - The regular expression
caseSensitive - Should the search be case sensitive?
Returns:
The pattern
Throws:
TvBrowserException - If there is a syntax error in the regular expression.

searchTextToRegex

public static java.lang.String searchTextToRegex(java.lang.String searchText,
                                                 boolean matchKeyword)
Creates a regex from a search text.

All regex code in the search text will be quoted. The returned regex will ignore differences in whitespace.

Parameters:
searchText - The search text to create a regex for.
matchKeyword - Specifies whether the regex should match a keyword (= substring). If false the returned regex will only match if the checked String matches exactly
Returns:
The search text as regular expression

matches

protected boolean matches(java.lang.String value)
Checks whether a value matches to the criteria of this searcher.

Specified by:
matches in class AbstractSearcher
Parameters:
value - The value to check
Returns:
Whether the value matches.

getPattern

public java.util.regex.Pattern getPattern()
get the pattern used by this searcher

Returns:
the pattern
Since:
3.0

TV-Browser 3.3.3 API

TV-Browser 3.3.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)