org.jscience.linguistics.search
Class ShiftOrClasses

java.lang.Object
  extended by org.jscience.linguistics.search.StringSearch
      extended by org.jscience.linguistics.search.ShiftOr
          extended by org.jscience.linguistics.search.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)

See Also:
ShiftOr

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jscience.linguistics.search.StringSearch
StringSearch.Dispatch, StringSearch.ReflectionDispatch
 
Field Summary
 
Fields inherited from class org.jscience.linguistics.search.StringSearch
activeDispatch, useNative
 
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 org.jscience.linguistics.search.ShiftOr
searchBytes, searchChars
 
Methods inherited from class org.jscience.linguistics.search.StringSearch
createCharIntMap, createCharIntMap, equals, hashCode, index, 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
clone, finalize, 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 - the pattern
Returns:
an Object
See Also:
ShiftOr.processChars(char[])