Package org.aksw.commons.io.deprecated
Class BoyerMooreByteFromWikipedia
java.lang.Object
org.aksw.commons.io.deprecated.BoyerMooreByteFromWikipedia
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int[]createBadCharacterTable(byte[] pattern) static int[]createGoodSuffixTable(byte[] pattern) Makes the jump table based on the scan offset which mismatch occurs.static intindexOf(byte[] haystack, byte[] needle) Returns the index within this string of the first occurrence of the specified substring.static booleanisPrefix(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 intsuffixLength(byte[] needle, int p) Returns the maximum length of the substring ends at p and is a suffix.
-
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 scannedneedle- 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)
-