-
Jan Trávníček authoredJan Trávníček authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
BackwardNondeterministicDAWGMatching.hpp 2.19 KiB
/*
* Author: Radovan Cerveny
*/
#ifndef STRINGOLOGY_BACKWARD_NONDETERMINISTIC_DAWG_MATCHING_HPP__
#define STRINGOLOGY_BACKWARD_NONDETERMINISTIC_DAWG_MATCHING_HPP__
#include <string/String.h>
#include <string/StringFeatures.h>
#include <core/multipleDispatch.hpp>
#include <set>
namespace stringology {
namespace exact {
/**
* Implementation of Backward Nondeterministic DAWG Matching using bit parallelism with 32/64/128bit bitmask and brute force switch for longer patterns.
*/
class BackwardNondeterministicDAWGMatching : public std::DoubleDispatch < BackwardNondeterministicDAWGMatching, std::set < unsigned >, const string::StringBase &, const string::StringBase & > {
private:
/**
* Search for pattern in linear string.
* @return set set of occurences
*/
template <size_t BitmaskBitCount>
static std::set < unsigned > matchTemplate ( const string::String & subject, const string::String & pattern );
template <size_t BitmaskBitCount >
static std::set < unsigned > matchTemplate ( const string::LinearString < > & subject, const string::LinearString < > & pattern );
public:
// Defaults to 32 bits
static std::set < unsigned > match ( const string::String & subject, const string::String & pattern );
static std::set < unsigned > match ( const string::LinearString < > & subject, const string::LinearString < > & pattern );
static std::set < unsigned > match32 ( const string::String & subject, const string::String & pattern );
static std::set < unsigned > match32 ( const string::LinearString < > & subject, const string::LinearString < > & pattern );
static std::set < unsigned > match64 ( const string::String & subject, const string::String & pattern );
static std::set < unsigned > match64 ( const string::LinearString < > & subject, const string::LinearString < > & pattern );
static std::set < unsigned > match128 ( const string::String & subject, const string::String & pattern );
static std::set < unsigned > match128 ( const string::LinearString < > & subject, const string::LinearString < > & pattern );
};
} /* namespace exact */
} /* namespace stringology */
#endif /* STRINGOLOGY_BACKWARD_NONDETERMINISTIC_DAWG_MATCHING_HPP__ */