Class BoyerMooreMatcher

java.lang.Object
org.aksw.commons.io.deprecated.BoyerMooreMatcher
All Implemented Interfaces:
SeekableMatcher

public class BoyerMooreMatcher extends Object implements SeekableMatcher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int[]
    This is the version of a character table that only tracks mismatch on the first instance of a char There is another approach which uses more memory using badCharacterTable[byteValueInText][positionOfMisMatch]
    protected int[]
     
    protected boolean
     
    protected byte[]
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BoyerMooreMatcher(boolean isFwd, byte[] pat, int[] badCharacter, int[] goodSuffix)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Move the position to the next match.
    protected byte
    getByte(Seekable seekable)
     
    boolean
    Whether the matcher matches in forward direction and thus nextPos() moves towards the end of the match.
    protected boolean
    nextPos(Seekable seekable, int delta)
     
    protected boolean
    prevPos(Seekable seekable, int delta)
     
    void
    Reset the state of the matcher such that it can be used with a fresh seekable

    Methods inherited from class Object

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

    • isFwd

      protected boolean isFwd
    • pat

      protected byte[] pat
    • badCharacterTable

      protected int[] badCharacterTable
      This is the version of a character table that only tracks mismatch on the first instance of a char There is another approach which uses more memory using badCharacterTable[byteValueInText][positionOfMisMatch]
    • goodSuffixTable

      protected int[] goodSuffixTable
    • returningFromMatch

      protected boolean returningFromMatch
  • Constructor Details

    • BoyerMooreMatcher

      public BoyerMooreMatcher(boolean isFwd, byte[] pat, int[] badCharacter, int[] goodSuffix)
  • Method Details

    • resetState

      public void resetState()
      Description copied from interface: SeekableMatcher
      Reset the state of the matcher such that it can be used with a fresh seekable
      Specified by:
      resetState in interface SeekableMatcher
    • isForward

      public boolean isForward()
      Description copied from interface: SeekableMatcher
      Whether the matcher matches in forward direction and thus nextPos() moves towards the end of the match. If false, prevPos() moves towards the end of the match
      Specified by:
      isForward in interface SeekableMatcher
      Returns:
    • nextPos

      protected boolean nextPos(Seekable seekable, int delta) throws IOException
      Throws:
      IOException
    • prevPos

      protected boolean prevPos(Seekable seekable, int delta) throws IOException
      Throws:
      IOException
    • getByte

      protected byte getByte(Seekable seekable) throws IOException
      Throws:
      IOException
    • find

      public boolean find(Seekable pn) throws IOException
      Description copied from interface: SeekableMatcher
      Move the position to the next match. Position is unspecified if no match was found. TODO Add a horizon argument to limit scanning in case of infinite streams
      Specified by:
      find in interface SeekableMatcher
      Parameters:
      pn -
      Returns:
      true if a match was found, false otherwise
      Throws:
      IOException