net.jxta.search.util
Class BM

java.lang.Object
  |
  +--net.jxta.search.util.BM
All Implemented Interfaces:
StringMatcher

public class BM
extends java.lang.Object
implements StringMatcher

Boyer-Moore string-matching algorithm. Usage:

 StringMatcher bm = new BM ();
 
 StringMatcher.CompiledPattern pattern = bm.compile (searchPhrase);
 
 int index = bm.match (text, 0, pattern);
 
 System.out.println ("First location of " + searchPhrase + " at " + index);

 


Inner classes inherited from class net.jxta.search.util.StringMatcher
StringMatcher.CompiledPattern
 
Constructor Summary
BM()
           
 
Method Summary
 StringMatcher.CompiledPattern compile(java.lang.String pattern)
          Compile the pattern into some algorithm-specific data structure.
 int indexOf(char[] text, int start, char c)
           
static void main(java.lang.String[] argv)
           
 int match(char[] text, int textStart, StringMatcher.CompiledPattern compiledPattern)
          Find the first instance of the pattern in the document starting at index docStart.
static boolean test(java.io.PrintStream ps, java.lang.String[] argv)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BM

public BM()
Method Detail

test

public static boolean test(java.io.PrintStream ps,
                           java.lang.String[] argv)

main

public static void main(java.lang.String[] argv)

compile

public StringMatcher.CompiledPattern compile(java.lang.String pattern)
Description copied from interface: StringMatcher
Compile the pattern into some algorithm-specific data structure.
Specified by:
compile in interface StringMatcher

indexOf

public int indexOf(char[] text,
                   int start,
                   char c)

match

public int match(char[] text,
                 int textStart,
                 StringMatcher.CompiledPattern compiledPattern)
Description copied from interface: StringMatcher
Find the first instance of the pattern in the document starting at index docStart.
Specified by:
match in interface StringMatcher