Skip to content
Snippets Groups Projects
BorderArrayNaive.h 1.43 KiB
Newer Older
  • Learn to ignore specific revisions
  • /*
     * BorderArrayNaive.h
     *
     *  Created on: 5. 11. 2014
     *      Author: Jan Travnicek
     */
    
    #ifndef _ARBOLOGY_BORDER_ARRAY_NAIVE_H_
    #define _ARBOLOGY_BORDER_ARRAY_NAIVE_H_
    
    #include <tree/TreeFeatures.h>
    
    #include <core/multipleDispatch.hpp>
    
    
    #include <vector>
    
    namespace arbology {
    
    namespace exact {
    
    /**
     * Computation of BCS table for BMH from MI(E+\eps)-EVY course 2014
     * To get rid of zeros in BCS table we ignore last haystack character
     */
    
    class BorderArrayNaive : public std::SingleDispatch < BorderArrayNaive, std::vector < size_t >, const tree::TreeBase & > {
    
    	static bool matches ( const tree::PrefixRankedBarPattern < > & pattern, const std::vector < int > & subtreeJumpTable, int stop, int offset );
    
    	static bool matches ( const tree::PrefixRankedPattern < > & pattern, const std::vector < int > & subtreeJumpTable, int stop, int offset );
    
    public:
    	/**
    	 * Search for pattern in linear string.
    	 * @return set set of occurences
    	 */
    
    	static std::vector < size_t > ba ( const tree::Tree & pattern );
    
    
    	/**
    	 * Search for pattern in linear string.
    	 * @return set set of occurences
    	 */
    
    	static std::vector < size_t > ba ( const tree::PrefixRankedBarPattern < > & pattern );
    
    	/**
    	 * Search for pattern in linear string.
    	 * @return set set of occurences
    	 */
    
    	static std::vector < size_t > ba ( const tree::PrefixRankedPattern < > & pattern );
    
    };
    
    } /* namespace exact */
    
    } /* namespace arbology */
    
    #endif /* _ARBOLOGY_BORDER_ARRAY_NAIVE_H_ */