diff --git a/alib2algo/src/stringology/exact/BadCharacterShiftTable.h b/alib2algo/src/stringology/exact/BadCharacterShiftTable.h index b8839b7de84bdaefe5b2293993ddf153ce246541..d8405822687645efc7d493fcc9756da5394f84ce 100644 --- a/alib2algo/src/stringology/exact/BadCharacterShiftTable.h +++ b/alib2algo/src/stringology/exact/BadCharacterShiftTable.h @@ -5,8 +5,8 @@ * Author: Radomir Polach, Tomas Pecka, Jan Travnicek */ -#ifndef _BAD_CHARACTER_SHIFT_TABLE_H_ -#define _BAD_CHARACTER_SHIFT_TABLE_H_ +#ifndef _STRINGOLOGY_BAD_CHARACTER_SHIFT_TABLE_H_ +#define _STRINGOLOGY_BAD_CHARACTER_SHIFT_TABLE_H_ #include <string/String.h> #include <string/StringFeatures.h> @@ -23,32 +23,34 @@ 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 BadCharacterShiftTable : public std::SingleDispatchFirstStaticParam<std::map<alphabet::Symbol, size_t>, const std::set<alphabet::Symbol>&, string::StringBase> { +class BadCharacterShiftTable : public std::SingleDispatchFirstStaticParam < std::map < alphabet::Symbol, size_t >, const std::set < alphabet::Symbol > &, string::StringBase > { public: /** * Search for pattern in linear string. * @return set set of occurences */ - static std::map<alphabet::Symbol, size_t> bcs(const string::String& pattern); + static std::map < alphabet::Symbol, size_t > bcs ( const string::String & pattern ); /** * Search for pattern in linear string. * @return set set of occurences */ - static std::map<alphabet::Symbol, size_t> bcs(const std::set<alphabet::Symbol>& alphabet, const string::String& pattern); + static std::map < alphabet::Symbol, size_t > bcs ( const std::set < alphabet::Symbol > & alphabet, const string::String & pattern ); - static std::map<alphabet::Symbol, size_t> bcs(const string::LinearString& pattern); + static std::map < alphabet::Symbol, size_t > bcs ( const string::LinearString & pattern ); - static std::map<alphabet::Symbol, size_t> bcs(const std::set<alphabet::Symbol>& alphabet, const string::LinearString& pattern); + static std::map < alphabet::Symbol, size_t > bcs ( const std::set < alphabet::Symbol > & alphabet, const string::LinearString & pattern ); - static BadCharacterShiftTable& getInstance() { + static BadCharacterShiftTable & getInstance ( ) { static BadCharacterShiftTable res; + return res; } + }; } /* namespace exact */ } /* namespace stringology */ -#endif /* _BAD_CHARACTER_SHIFT_TABLE_H_ */ +#endif /* _STRINGOLOGY_BAD_CHARACTER_SHIFT_TABLE_H_ */ diff --git a/alib2algo/src/stringology/exact/BoyerMooreHorspool.h b/alib2algo/src/stringology/exact/BoyerMooreHorspool.h index f3970faa2cca657030c6dee32801e5bb87dcb26a..be7dd02536ae95216f1e406fa9c8d71f67fc018f 100644 --- a/alib2algo/src/stringology/exact/BoyerMooreHorspool.h +++ b/alib2algo/src/stringology/exact/BoyerMooreHorspool.h @@ -5,8 +5,8 @@ * Author: Radomir Polach, Tomas Pecka */ -#ifndef _BOYER_MOORE_HORSPOOL_H -#define _BOYER_MOORE_HORSPOOL_H +#ifndef _STRINGOLOGY_BOYER_MOORE_HORSPOOL_H_ +#define _STRINGOLOGY_BOYER_MOORE_HORSPOOL_H_ #include <set> #include <common/multipleDispatch.hpp> @@ -21,24 +21,26 @@ namespace exact { * Implementation of BMH for MI(E+\eps)-EVY course 2014 * To get rid of zeros in BCS table we ignore last haystack character */ -class BoyerMooreHorspool : public std::DoubleDispatch<std::set<unsigned>, string::StringBase, string::StringBase> { +class BoyerMooreHorspool : public std::DoubleDispatch < std::set < unsigned >, string::StringBase, string::StringBase > { public: /** * Search for pattern in linear string. * @return set set of occurences */ - static std::set<unsigned> match(const string::String& subject, const string::String& pattern); + 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 > match ( const string::LinearString & subject, const string::LinearString & pattern ); - static BoyerMooreHorspool& getInstance() { + static BoyerMooreHorspool & getInstance ( ) { static BoyerMooreHorspool res; + return res; } + }; } /* namespace exact */ } /* namespace stringology */ -#endif /* _BOYER_MOORE_HORSPOOL_H */ +#endif /* _STRINGOLOGY_BOYER_MOORE_HORSPOOL_H_ */