org.gjt.sp.jedit.search
Class BoyerMooreSearchMatcher

java.lang.Object
  |
  +--org.gjt.sp.jedit.search.BoyerMooreSearchMatcher
All Implemented Interfaces:
SearchMatcher

public class BoyerMooreSearchMatcher
extends java.lang.Object
implements SearchMatcher

Implements literal search using the Boyer-Moore algorithm.


Constructor Summary
BoyerMooreSearchMatcher(java.lang.String pattern, java.lang.String replace, boolean ignoreCase, boolean beanshell, BshMethod replaceMethod)
          Creates a new string literal matcher.
 
Method Summary
 int match(CharIndexed text, boolean reverse)
           
 int[] nextMatch(CharIndexed text, boolean start, boolean end, boolean firstTime, boolean reverse)
          Returns the offset of the first match of the specified text within this matcher.
 java.lang.String substitute(java.lang.String text)
          Returns the specified text, with any substitution specified within this matcher performed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoyerMooreSearchMatcher

public BoyerMooreSearchMatcher(java.lang.String pattern,
                               java.lang.String replace,
                               boolean ignoreCase,
                               boolean beanshell,
                               BshMethod replaceMethod)
Creates a new string literal matcher.

Method Detail

nextMatch

public int[] nextMatch(CharIndexed text,
                       boolean start,
                       boolean end,
                       boolean firstTime,
                       boolean reverse)
Returns the offset of the first match of the specified text within this matcher.

Specified by:
nextMatch in interface SearchMatcher
Parameters:
text - The text to search in
start - True if the start of the segment is the beginning of the buffer
end - True if the end of the segment is the end of the buffer
firstTime - If false and the search string matched at the start offset with length zero, automatically find next match
reverse - If true, searching will be performed in a backward direction.
Returns:
an array where the first element is the start offset of the match, and the second element is the end offset of the match
Since:
jEdit 4.1pre7

substitute

public java.lang.String substitute(java.lang.String text)
                            throws java.lang.Exception
Returns the specified text, with any substitution specified within this matcher performed.

Specified by:
substitute in interface SearchMatcher
Parameters:
text - The text
Returns:
The changed string
java.lang.Exception

match

public int match(CharIndexed text,
                 boolean reverse)