Class BoyerMooreByteFromWikipedia

java.lang.Object
org.aksw.commons.io.deprecated.BoyerMooreByteFromWikipedia

public class BoyerMooreByteFromWikipedia extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int[]
    createBadCharacterTable(byte[] pattern)
     
    static int[]
    createGoodSuffixTable(byte[] pattern)
    Makes the jump table based on the scan offset which mismatch occurs.
    static int
    indexOf(byte[] haystack, byte[] needle)
    Returns the index within this string of the first occurrence of the specified substring.
    static boolean
    isPrefix(byte[] pattern, int p)
    Is needle[p:end] a prefix of needle?
    static int[]
    makeByteTableOld(byte[] needle)
    Makes the jump table based on the mismatched character information.
    static int[]
    makeOffsetTableFromC(byte[] needle)
    Makes the jump table based on the scan offset which mismatch occurs.
    static int
    suffixLength(byte[] needle, int p)
    Returns the maximum length of the substring ends at p and is a suffix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BoyerMooreByteFromWikipedia

      public BoyerMooreByteFromWikipedia()
  • Method Details

    • indexOf

      public static int indexOf(byte[] haystack, byte[] needle)
      Returns the index within this string of the first occurrence of the specified substring. If it is not a substring, return -1. There is no Galil because it only generates one match.
      Parameters:
      haystack - The string to be scanned
      needle - The target string to search
      Returns:
      The start index of the substring
    • createBadCharacterTable

      public static int[] createBadCharacterTable(byte[] pattern)
    • makeByteTableOld

      public static int[] makeByteTableOld(byte[] needle)
      Makes the jump table based on the mismatched character information. (bad character rule?).
    • createGoodSuffixTable

      public static int[] createGoodSuffixTable(byte[] pattern)
      Makes the jump table based on the scan offset which mismatch occurs. (bad character rule).
    • makeOffsetTableFromC

      public static int[] makeOffsetTableFromC(byte[] needle)
      Makes the jump table based on the scan offset which mismatch occurs. This is only different from the java version that the array is reversed (good suffix)
    • isPrefix

      public static boolean isPrefix(byte[] pattern, int p)
      Is needle[p:end] a prefix of needle?
    • suffixLength

      public static int suffixLength(byte[] needle, int p)
      Returns the maximum length of the substring ends at p and is a suffix. (good suffix rule)