com.jaxfront.core.util.stringSearch
Class ShiftOrClasses

java.lang.Object
  extended by com.jaxfront.core.util.stringSearch.StringSearch
      extended by com.jaxfront.core.util.stringSearch.ShiftOr
          extended by com.jaxfront.core.util.stringSearch.ShiftOrClasses

public class ShiftOrClasses
extends ShiftOr

An implementation of the Shift-Or algorithm that supports character classes. The following character classes are supported:

x a character from the Alphabet Σ
? a "don't care" symbol which matches all symbols
[characters] a class of characters where ranges (a-z, 0-9) are allowed
^ the negation of a class(^a, ^[abc], ^[c-h])
\ escapes the next character (\ must be written as \\ in Java).

Examples:

 Preprocessing: O(2n + ∑) time
 
 Searching    : O(mn / log n) (worst case and average)
 

Version:
1.2
Author:
Johann Burkard
See Also:
com.eaio.stringsearch.ShiftOr

Constructor Summary
ShiftOrClasses()
          Constructor for ShiftOrClasses.
 
Method Summary
 java.lang.Object processBytes(byte[] pattern)
          Pre-processing of the pattern.
 java.lang.Object processChars(char[] pattern)
          Pre-processing of the pattern.
 
Methods inherited from class com.jaxfront.core.util.stringSearch.ShiftOr
searchBytes, searchChars
 
Methods inherited from class com.jaxfront.core.util.stringSearch.StringSearch
equals, getAllOccurences, hashCode, processString, searchBytes, searchBytes, searchBytes, searchBytes, searchBytes, searchChars, searchChars, searchChars, searchChars, searchChars, searchString, searchString, searchString, searchString, searchString, searchString, toString, toStringBuffer, usesNative, usesReflection
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShiftOrClasses

public ShiftOrClasses()
Constructor for ShiftOrClasses. Note that it is not required to create multiple instances.

Method Detail

processBytes

public java.lang.Object processBytes(byte[] pattern)
Description copied from class: ShiftOr
Pre-processing of the pattern. The pattern may not exceed 31 bytes in length. If it does, only it's first 31 bytes are processed which might lead to unexpected results. Returns an int array.

Overrides:
processBytes in class ShiftOr
Parameters:
pattern - the byte array containing the pattern, may not be null
Returns:
an Object
See Also:
ShiftOr.processBytes(byte[])

processChars

public java.lang.Object processChars(char[] pattern)
Description copied from class: ShiftOr
Pre-processing of the pattern. The pattern may not exceed 31 characters in length. If it does, only it's first 31 characters are processed which might lead to unexpected results. Returns a CharIntMap.

Overrides:
processChars in class ShiftOr
Parameters:
pattern - a char array containing the pattern, may not be null
Returns:
an Object
See Also:
ShiftOr.processChars(char[])