Class FTBitapSearch

java.lang.Object
org.basex.util.ft.FTBitapSearch

public final class FTBitapSearch extends Object
Generalized search algorithm based on the Bitap string matching algorithm. The implementation is based on the implementation in Wikipedia, but uses BitSet for fast bit operation. This version works with a set of needles and each one of it can be matched in the haystack.
Author:
BaseX Team 2005-21, BSD License, Dimitar Popov
See Also:
  • Constructor Details

    • FTBitapSearch

      public FTBitapSearch(FTIterator iter, FTTokens tokens, FTBitapSearch.TokenComparator cmp)
      Constructor.
      Parameters:
      iter - iterator over the set of elements being searched ("haystack")
      tokens - a list of "needles" (a needle is an array of elements being searched for)
      cmp - comparator for comparing two elements for equality
  • Method Details

    • hasNext

      public boolean hasNext() throws QueryException
      Is there one more match?
      Returns:
      true if yes
      Throws:
      QueryException - if an error occurs during search
    • next

      public int next() throws QueryException
      Position in the haystack of the next match.
      Returns:
      start position of the match; first position is 0
      Throws:
      QueryException - if an error occurs during search