diff --git a/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.cpp b/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.cpp index e535b8313aace8a950d792f3393aff0b880474ce..ab1944e02b697879973a41304b3eef8764f37967 100644 --- a/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.cpp +++ b/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.cpp @@ -13,11 +13,11 @@ namespace stringology { namespace indexing { -indexes::BitParallelIndex < DefaultSymbolType > BitParallelIndexConstruction::construct ( const string::String & string ) { +indexes::stringology::BitParallelIndex < DefaultSymbolType > BitParallelIndexConstruction::construct ( const string::String & string ) { return dispatch ( string.getData ( ) ); } -auto bitParallelIndexConstructionLinearString = BitParallelIndexConstruction::RegistratorWrapper < indexes::BitParallelIndex < DefaultSymbolType >, string::LinearString < > > ( BitParallelIndexConstruction::construct ); +auto bitParallelIndexConstructionLinearString = BitParallelIndexConstruction::RegistratorWrapper < indexes::stringology::BitParallelIndex < DefaultSymbolType >, string::LinearString < > > ( BitParallelIndexConstruction::construct ); } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.h b/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.h index de02c92a13339e90d644ff2741da3d04457bcf76..ec2086094d0753dd5a1f60a778cd1549c7128b60 100644 --- a/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.h +++ b/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.h @@ -8,7 +8,7 @@ #ifndef BIT_PARALLEL_INDEX_CONSTRUCTION_H_ #define BIT_PARALLEL_INDEX_CONSTRUCTION_H_ -#include <indexes/BitParallelIndex.h> +#include <indexes/stringology/BitParallelIndex.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -23,22 +23,22 @@ namespace indexing { * */ -class BitParallelIndexConstruction : public std::SingleDispatch < BitParallelIndexConstruction, indexes::BitParallelIndex < DefaultSymbolType >, const string::StringBase & > { +class BitParallelIndexConstruction : public std::SingleDispatch < BitParallelIndexConstruction, indexes::stringology::BitParallelIndex < DefaultSymbolType >, const string::StringBase & > { public: /** * Creates suffix trie * @param string string to construct suffix trie for * @return automaton */ - static indexes::BitParallelIndex < DefaultSymbolType > construct ( const string::String & string ); + static indexes::stringology::BitParallelIndex < DefaultSymbolType > construct ( const string::String & string ); template < class SymbolType > - static indexes::BitParallelIndex < SymbolType > construct ( const string::LinearString < SymbolType > & string ); + static indexes::stringology::BitParallelIndex < SymbolType > construct ( const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -indexes::BitParallelIndex < SymbolType > BitParallelIndexConstruction::construct ( const string::LinearString < SymbolType > & w ) { +indexes::stringology::BitParallelIndex < SymbolType > BitParallelIndexConstruction::construct ( const string::LinearString < SymbolType > & w ) { std::map < SymbolType, std::vector < bool > > res; for ( const SymbolType & symbol : w.getAlphabet ( ) ) res [ symbol ].resize ( w.getContent ( ).size ( ) ); @@ -46,7 +46,7 @@ indexes::BitParallelIndex < SymbolType > BitParallelIndexConstruction::construct for ( unsigned i = 0; i < w.getContent ( ).size ( ); ++i ) res [ w.getContent ( ) [ i ] ] [ i ] = true; - return indexes::BitParallelIndex < SymbolType > ( w.getAlphabet ( ), res ); + return indexes::stringology::BitParallelIndex < SymbolType > ( w.getAlphabet ( ), res ); } } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.cpp b/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.cpp index 0219ca14cb131e6bdcd8bca723168f1a2e843d73..d88f00999c7374c29398b83d66212dbdd4c11d69 100644 --- a/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.cpp +++ b/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.cpp @@ -13,11 +13,11 @@ namespace stringology { namespace indexing { -indexes::CompressedBitParallelIndex < DefaultSymbolType > CompressedBitParallelIndexConstruction::construct ( const string::String & string ) { +indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType > CompressedBitParallelIndexConstruction::construct ( const string::String & string ) { return dispatch ( string.getData ( ) ); } -auto compressedCompressedBitParallelIndexConstructionLinearString = CompressedBitParallelIndexConstruction::RegistratorWrapper < indexes::CompressedBitParallelIndex < DefaultSymbolType >, string::LinearString < > > ( CompressedBitParallelIndexConstruction::construct ); +auto compressedCompressedBitParallelIndexConstructionLinearString = CompressedBitParallelIndexConstruction::RegistratorWrapper < indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType >, string::LinearString < > > ( CompressedBitParallelIndexConstruction::construct ); } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.h b/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.h index 32b61d51148fb8a21c7d35d96769295078df2d5f..6e9b6c4cb2ed45dff831c69a95ffb2b9ac29667b 100644 --- a/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.h +++ b/alib2algo/src/stringology/indexing/CompressedBitParallelIndexConstruction.h @@ -8,7 +8,7 @@ #ifndef COMPRESSED_BIT_PARALLEL_INDEX_CONSTRUCTION_H_ #define COMPRESSED_BIT_PARALLEL_INDEX_CONSTRUCTION_H_ -#include <indexes/CompressedBitParallelIndex.h> +#include <indexes/stringology/CompressedBitParallelIndex.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -23,22 +23,22 @@ namespace indexing { * */ -class CompressedBitParallelIndexConstruction : public std::SingleDispatch < CompressedBitParallelIndexConstruction, indexes::CompressedBitParallelIndex < DefaultSymbolType >, const string::StringBase & > { +class CompressedBitParallelIndexConstruction : public std::SingleDispatch < CompressedBitParallelIndexConstruction, indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType >, const string::StringBase & > { public: /** * Creates suffix trie * @param string string to construct suffix trie for * @return automaton */ - static indexes::CompressedBitParallelIndex < DefaultSymbolType > construct ( const string::String & string ); + static indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType > construct ( const string::String & string ); template < class SymbolType > - static indexes::CompressedBitParallelIndex < SymbolType > construct ( const string::LinearString < SymbolType > & string ); + static indexes::stringology::CompressedBitParallelIndex < SymbolType > construct ( const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -indexes::CompressedBitParallelIndex < SymbolType > CompressedBitParallelIndexConstruction::construct ( const string::LinearString < SymbolType > & w ) { +indexes::stringology::CompressedBitParallelIndex < SymbolType > CompressedBitParallelIndexConstruction::construct ( const string::LinearString < SymbolType > & w ) { std::map < SymbolType, common::SparseBoolVector > res; for ( const SymbolType & symbol : w.getAlphabet ( ) ) res [ symbol ].resize ( w.getContent ( ).size ( ) ); @@ -46,7 +46,7 @@ indexes::CompressedBitParallelIndex < SymbolType > CompressedBitParallelIndexCon for ( unsigned i = 0; i < w.getContent ( ).size ( ); ++i ) res [ w.getContent ( ) [ i ] ] [ i ] = true; - return indexes::CompressedBitParallelIndex < SymbolType > ( w.getAlphabet ( ), res ); + return indexes::stringology::CompressedBitParallelIndex < SymbolType > ( w.getAlphabet ( ), res ); } } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/PositionHeapNaive.cpp b/alib2algo/src/stringology/indexing/PositionHeapNaive.cpp index a1beaccbaae286121900f9be3067a61abd1e6445..0cf33b496851a0a3a5de01fe121b1203184226f6 100644 --- a/alib2algo/src/stringology/indexing/PositionHeapNaive.cpp +++ b/alib2algo/src/stringology/indexing/PositionHeapNaive.cpp @@ -13,11 +13,11 @@ namespace stringology { namespace indexing { -indexes::PositionHeap < DefaultSymbolType > PositionHeapNaive::construct ( const string::String & string ) { +indexes::stringology::PositionHeap < DefaultSymbolType > PositionHeapNaive::construct ( const string::String & string ) { return dispatch ( string.getData ( ) ); } -auto positionHeapNaiveLinearString = PositionHeapNaive::RegistratorWrapper < indexes::PositionHeap < DefaultSymbolType >, string::LinearString < > > ( PositionHeapNaive::construct ); +auto positionHeapNaiveLinearString = PositionHeapNaive::RegistratorWrapper < indexes::stringology::PositionHeap < DefaultSymbolType >, string::LinearString < > > ( PositionHeapNaive::construct ); } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/PositionHeapNaive.h b/alib2algo/src/stringology/indexing/PositionHeapNaive.h index 08b636be337725a3b52ae91c5f32e56091ba06ed..9dfbdd1dcff3f206703cc24efb1507905edef5af 100644 --- a/alib2algo/src/stringology/indexing/PositionHeapNaive.h +++ b/alib2algo/src/stringology/indexing/PositionHeapNaive.h @@ -8,7 +8,7 @@ #ifndef POSITION_HEAP_NAIVE_H_ #define POSITION_HEAP_NAIVE_H_ -#include <indexes/PositionHeap.h> +#include <indexes/stringology/PositionHeap.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -25,22 +25,22 @@ namespace indexing { * Andrzej Ehrenfeucht, Ross M. McConnell, Nissa Osheim, Sung-Whan Woo */ -class PositionHeapNaive : public std::SingleDispatch < PositionHeapNaive, indexes::PositionHeap < DefaultSymbolType >, const string::StringBase & > { +class PositionHeapNaive : public std::SingleDispatch < PositionHeapNaive, indexes::stringology::PositionHeap < DefaultSymbolType >, const string::StringBase & > { public: /** * Creates suffix trie * @param string string to construct suffix trie for * @return automaton */ - static indexes::PositionHeap < DefaultSymbolType > construct ( const string::String & string ); + static indexes::stringology::PositionHeap < DefaultSymbolType > construct ( const string::String & string ); template < class SymbolType > - static indexes::PositionHeap < SymbolType > construct ( const string::LinearString < SymbolType > & string ); + static indexes::stringology::PositionHeap < SymbolType > construct ( const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -indexes::PositionHeap < SymbolType > PositionHeapNaive::construct ( const string::LinearString < SymbolType > & w ) { +indexes::stringology::PositionHeap < SymbolType > PositionHeapNaive::construct ( const string::LinearString < SymbolType > & w ) { if ( w.getContent ( ).size ( ) == 0 ) throw exception::CommonException ( "Position heap can't index empty string" ); @@ -57,7 +57,7 @@ indexes::PositionHeap < SymbolType > PositionHeapNaive::construct ( const string n = & n->getChildren ( ).insert ( std::make_pair ( w.getContent ( )[k], std::trie < SymbolType, unsigned > ( node ) ) ).first->second; } - return indexes::PositionHeap < SymbolType > ( w.getAlphabet ( ), trie, w.getContent ( ) ); + return indexes::stringology::PositionHeap < SymbolType > ( w.getAlphabet ( ), trie, w.getContent ( ) ); } } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/SuffixArrayNaive.cpp b/alib2algo/src/stringology/indexing/SuffixArrayNaive.cpp index 481591421dad641e28c14833ed5eefe6331517b1..b003e712e09cba1b4df59b39061104604abca7e6 100644 --- a/alib2algo/src/stringology/indexing/SuffixArrayNaive.cpp +++ b/alib2algo/src/stringology/indexing/SuffixArrayNaive.cpp @@ -13,11 +13,11 @@ namespace stringology { namespace indexing { -indexes::SuffixArray < > SuffixArrayNaive::construct ( const string::String & string ) { +indexes::stringology::SuffixArray < > SuffixArrayNaive::construct ( const string::String & string ) { return dispatch ( string.getData ( ) ); } -auto suffixArrayNaiveLinearString = SuffixArrayNaive::RegistratorWrapper < indexes::SuffixArray < >, string::LinearString < > > ( SuffixArrayNaive::construct ); +auto suffixArrayNaiveLinearString = SuffixArrayNaive::RegistratorWrapper < indexes::stringology::SuffixArray < >, string::LinearString < > > ( SuffixArrayNaive::construct ); } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/SuffixArrayNaive.h b/alib2algo/src/stringology/indexing/SuffixArrayNaive.h index 9012363556f9428fa3985008ddf2ad7cb4c4f9a8..ceb66817d64e117d17ef1079f05f53c081a09e06 100644 --- a/alib2algo/src/stringology/indexing/SuffixArrayNaive.h +++ b/alib2algo/src/stringology/indexing/SuffixArrayNaive.h @@ -8,7 +8,7 @@ #ifndef SUFFIX_ARRAY_NAIVE_H_ #define SUFFIX_ARRAY_NAIVE_H_ -#include <indexes/SuffixArray.h> +#include <indexes/stringology/SuffixArray.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -22,22 +22,22 @@ namespace indexing { * */ -class SuffixArrayNaive : public std::SingleDispatch < SuffixArrayNaive, indexes::SuffixArray < >, const string::StringBase & > { +class SuffixArrayNaive : public std::SingleDispatch < SuffixArrayNaive, indexes::stringology::SuffixArray < >, const string::StringBase & > { public: /** * Creates suffix trie * @param string string to construct suffix trie for * @return automaton */ - static indexes::SuffixArray < > construct ( const string::String & string ); + static indexes::stringology::SuffixArray < > construct ( const string::String & string ); template < class SymbolType > - static indexes::SuffixArray < SymbolType > construct ( const string::LinearString < SymbolType > & string ); + static indexes::stringology::SuffixArray < SymbolType > construct ( const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -indexes::SuffixArray < SymbolType > SuffixArrayNaive::construct ( const string::LinearString < SymbolType > & w ) { +indexes::stringology::SuffixArray < SymbolType > SuffixArrayNaive::construct ( const string::LinearString < SymbolType > & w ) { std::vector < unsigned > data; for ( unsigned i = 0; i < w.getContent ( ).size ( ); ++ i ) @@ -57,7 +57,7 @@ indexes::SuffixArray < SymbolType > SuffixArrayNaive::construct ( const string:: return first > second; } ); - return indexes::SuffixArray < SymbolType > ( w.getAlphabet ( ), data, w.getContent ( ) ); + return indexes::stringology::SuffixArray < SymbolType > ( w.getAlphabet ( ), data, w.getContent ( ) ); } } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/SuffixTrieNaive.cpp b/alib2algo/src/stringology/indexing/SuffixTrieNaive.cpp index a16fa12ebb710332430b8981cb329f80548f051f..c5bb33a5a70d21b1833579d674d219f7fe75cf86 100644 --- a/alib2algo/src/stringology/indexing/SuffixTrieNaive.cpp +++ b/alib2algo/src/stringology/indexing/SuffixTrieNaive.cpp @@ -13,11 +13,11 @@ namespace stringology { namespace indexing { -indexes::SuffixTrie < DefaultSymbolType > SuffixTrieNaive::construct ( const string::String & string ) { +indexes::stringology::SuffixTrie < DefaultSymbolType > SuffixTrieNaive::construct ( const string::String & string ) { return dispatch ( string.getData ( ) ); } -auto suffixTrieNaiveLinearString = SuffixTrieNaive::RegistratorWrapper < indexes::SuffixTrie < DefaultSymbolType >, string::LinearString < > > ( SuffixTrieNaive::construct ); +auto suffixTrieNaiveLinearString = SuffixTrieNaive::RegistratorWrapper < indexes::stringology::SuffixTrie < DefaultSymbolType >, string::LinearString < > > ( SuffixTrieNaive::construct ); } /* namespace indexing */ diff --git a/alib2algo/src/stringology/indexing/SuffixTrieNaive.h b/alib2algo/src/stringology/indexing/SuffixTrieNaive.h index 02ea1a1899035bcbc529e20c53b71132d0524e9f..c9e81447e3e3dd3b54b8d6e0000766bc2e6da771 100644 --- a/alib2algo/src/stringology/indexing/SuffixTrieNaive.h +++ b/alib2algo/src/stringology/indexing/SuffixTrieNaive.h @@ -8,7 +8,7 @@ #ifndef SUFFIX_TRIE_NAIVE_H_ #define SUFFIX_TRIE_NAIVE_H_ -#include <indexes/SuffixTrie.h> +#include <indexes/stringology/SuffixTrie.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -23,22 +23,22 @@ namespace indexing { * Source: Lectures MI-EVY (CTU in Prague), Year 2014, Lecture 3, slide 4 */ -class SuffixTrieNaive : public std::SingleDispatch < SuffixTrieNaive, indexes::SuffixTrie < DefaultSymbolType >, const string::StringBase & > { +class SuffixTrieNaive : public std::SingleDispatch < SuffixTrieNaive, indexes::stringology::SuffixTrie < DefaultSymbolType >, const string::StringBase & > { public: /** * Creates suffix trie * @param string string to construct suffix trie for * @return automaton */ - static indexes::SuffixTrie < DefaultSymbolType > construct ( const string::String & string ); + static indexes::stringology::SuffixTrie < DefaultSymbolType > construct ( const string::String & string ); template < class SymbolType > - static indexes::SuffixTrie < SymbolType > construct ( const string::LinearString < SymbolType > & string ); + static indexes::stringology::SuffixTrie < SymbolType > construct ( const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -indexes::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( const string::LinearString < SymbolType > & w ) { +indexes::stringology::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( const string::LinearString < SymbolType > & w ) { std::trie < SymbolType, std::variant < void, unsigned > > trie ( std::variant < void, unsigned > ( ( unsigned ) w.getContent ( ).size ( ) ) ); for ( unsigned i = w.getContent ( ).size ( ); i > 0; i-- ) { @@ -55,7 +55,7 @@ indexes::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( const string::Li } } - return indexes::SuffixTrie < SymbolType > ( w.getAlphabet ( ), trie ); + return indexes::stringology::SuffixTrie < SymbolType > ( w.getAlphabet ( ), trie ); } } /* namespace indexing */ diff --git a/alib2algo/src/stringology/query/BitParallelismFactors.cpp b/alib2algo/src/stringology/query/BitParallelismFactors.cpp index 58f41cfa4c5b2b03d5caaa0c733e04f951edc519..d2eb2f41cf125577bb93b1bbdc0bb0a9306e24d8 100644 --- a/alib2algo/src/stringology/query/BitParallelismFactors.cpp +++ b/alib2algo/src/stringology/query/BitParallelismFactors.cpp @@ -13,7 +13,7 @@ namespace stringology { namespace query { -std::set < unsigned > BitParallelismFactors::query ( const indexes::BitParallelIndex < DefaultSymbolType > & bitParallelIndex, const string::String & string ) { +std::set < unsigned > BitParallelismFactors::query ( const indexes::stringology::BitParallelIndex < DefaultSymbolType > & bitParallelIndex, const string::String & string ) { return dispatch ( bitParallelIndex, string.getData ( ) ); } diff --git a/alib2algo/src/stringology/query/BitParallelismFactors.h b/alib2algo/src/stringology/query/BitParallelismFactors.h index fcc5d8963e9d56bc302ed546d14c8b29ba1c388d..71d25922b9375fafbe9aca3e06d6090f421f06ba 100644 --- a/alib2algo/src/stringology/query/BitParallelismFactors.h +++ b/alib2algo/src/stringology/query/BitParallelismFactors.h @@ -8,7 +8,7 @@ #ifndef BIT_PARALLELISM_FACTORS_H_ #define BIT_PARALLELISM_FACTORS_H_ -#include <indexes/BitParallelIndex.h> +#include <indexes/stringology/BitParallelIndex.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -23,7 +23,7 @@ namespace query { * */ -class BitParallelismFactors : public std::SingleDispatchFirstStaticParam < BitParallelismFactors, std::set < unsigned >, const indexes::BitParallelIndex < DefaultSymbolType > &, const string::StringBase & > { +class BitParallelismFactors : public std::SingleDispatchFirstStaticParam < BitParallelismFactors, std::set < unsigned >, const indexes::stringology::BitParallelIndex < DefaultSymbolType > &, const string::StringBase & > { public: /** @@ -32,15 +32,15 @@ public: * @param string string to query by * @return occurences of factors */ - static std::set < unsigned > query ( const indexes::BitParallelIndex < DefaultSymbolType > & bitParallelIndex, const string::String & string ); + static std::set < unsigned > query ( const indexes::stringology::BitParallelIndex < DefaultSymbolType > & bitParallelIndex, const string::String & string ); template < class SymbolType > - static std::set < unsigned > query ( const indexes::BitParallelIndex < SymbolType > & bitParallelIndex, const string::LinearString < SymbolType > & string ); + static std::set < unsigned > query ( const indexes::stringology::BitParallelIndex < SymbolType > & bitParallelIndex, const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -std::set < unsigned > BitParallelismFactors::query ( const indexes::BitParallelIndex < SymbolType > & bitParallelIndex, const string::LinearString < SymbolType > & string ) { +std::set < unsigned > BitParallelismFactors::query ( const indexes::stringology::BitParallelIndex < SymbolType > & bitParallelIndex, const string::LinearString < SymbolType > & string ) { std::vector < bool > indexVector; indexVector.resize ( bitParallelIndex.getData ( ).begin ( )->second.size ( ) + 1); indexVector.flip ( ); diff --git a/alib2algo/src/stringology/query/CompressedBitParallelismFactors.cpp b/alib2algo/src/stringology/query/CompressedBitParallelismFactors.cpp index be3a416889a3b237ac2508eac22d961f94580de0..d1eea5dd839ce1123100ff26a45037e980273117 100644 --- a/alib2algo/src/stringology/query/CompressedBitParallelismFactors.cpp +++ b/alib2algo/src/stringology/query/CompressedBitParallelismFactors.cpp @@ -13,7 +13,7 @@ namespace stringology { namespace query { -std::set < unsigned > CompressedBitParallelismFactors::query ( const indexes::CompressedBitParallelIndex < DefaultSymbolType > & compressedBitParallelIndex, const string::String & string ) { +std::set < unsigned > CompressedBitParallelismFactors::query ( const indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType > & compressedBitParallelIndex, const string::String & string ) { return dispatch ( compressedBitParallelIndex, string.getData ( ) ); } diff --git a/alib2algo/src/stringology/query/CompressedBitParallelismFactors.h b/alib2algo/src/stringology/query/CompressedBitParallelismFactors.h index f6f393e6c9ef165370d5895cb0984195d6e0862a..f8a62e3ad84262e9ea829f118e16e24bf07ef3e0 100644 --- a/alib2algo/src/stringology/query/CompressedBitParallelismFactors.h +++ b/alib2algo/src/stringology/query/CompressedBitParallelismFactors.h @@ -8,7 +8,7 @@ #ifndef COMPRESSED_BIT_PARALLELISM_FACTORS_H_ #define COMPRESSED_BIT_PARALLELISM_FACTORS_H_ -#include <indexes/CompressedBitParallelIndex.h> +#include <indexes/stringology/CompressedBitParallelIndex.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -23,7 +23,7 @@ namespace query { * */ -class CompressedBitParallelismFactors : public std::SingleDispatchFirstStaticParam < CompressedBitParallelismFactors, std::set < unsigned >, const indexes::CompressedBitParallelIndex < DefaultSymbolType > &, const string::StringBase & > { +class CompressedBitParallelismFactors : public std::SingleDispatchFirstStaticParam < CompressedBitParallelismFactors, std::set < unsigned >, const indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType > &, const string::StringBase & > { public: /** @@ -32,15 +32,15 @@ public: * @param string string to query by * @return occurences of factors */ - static std::set < unsigned > query ( const indexes::CompressedBitParallelIndex < DefaultSymbolType > & compressedBitParallelIndex, const string::String & string ); + static std::set < unsigned > query ( const indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType > & compressedBitParallelIndex, const string::String & string ); template < class SymbolType > - static std::set < unsigned > query ( const indexes::CompressedBitParallelIndex < SymbolType > & compressedBitParallelIndex, const string::LinearString < SymbolType > & string ); + static std::set < unsigned > query ( const indexes::stringology::CompressedBitParallelIndex < SymbolType > & compressedBitParallelIndex, const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -std::set < unsigned > CompressedBitParallelismFactors::query ( const indexes::CompressedBitParallelIndex < SymbolType > & compressedBitParallelIndex, const string::LinearString < SymbolType > & string ) { +std::set < unsigned > CompressedBitParallelismFactors::query ( const indexes::stringology::CompressedBitParallelIndex < SymbolType > & compressedBitParallelIndex, const string::LinearString < SymbolType > & string ) { if ( string.getContent ( ).size ( ) == 0 ) { if ( compressedBitParallelIndex.getData ( ).begin ( ) == compressedBitParallelIndex.getData ( ).end ( ) ) return { }; diff --git a/alib2algo/src/stringology/query/PositionHeapFactors.cpp b/alib2algo/src/stringology/query/PositionHeapFactors.cpp index 75ee85ab40929c78fafb4583fe6f808667a4599d..ce32e67fca9c841e92630c89f4a1d0bc3f7367d7 100644 --- a/alib2algo/src/stringology/query/PositionHeapFactors.cpp +++ b/alib2algo/src/stringology/query/PositionHeapFactors.cpp @@ -13,7 +13,7 @@ namespace stringology { namespace query { -std::set < unsigned > PositionHeapFactors::query ( const indexes::PositionHeap < DefaultSymbolType > & positionHeap, const string::String & string ) { +std::set < unsigned > PositionHeapFactors::query ( const indexes::stringology::PositionHeap < DefaultSymbolType > & positionHeap, const string::String & string ) { return dispatch ( positionHeap, string.getData ( ) ); } diff --git a/alib2algo/src/stringology/query/PositionHeapFactors.h b/alib2algo/src/stringology/query/PositionHeapFactors.h index 0c7884fc8d3890acf730ebff602a947e0cdfe03a..6ac56572fe593da9109e9301cfc1512314c3fddf 100644 --- a/alib2algo/src/stringology/query/PositionHeapFactors.h +++ b/alib2algo/src/stringology/query/PositionHeapFactors.h @@ -8,7 +8,7 @@ #ifndef POSITION_HEAP_FACTORS_H_ #define POSITION_HEAP_FACTORS_H_ -#include <indexes/PositionHeap.h> +#include <indexes/stringology/PositionHeap.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -26,7 +26,7 @@ namespace query { * */ -class PositionHeapFactors : public std::SingleDispatchFirstStaticParam < PositionHeapFactors, std::set < unsigned >, const indexes::PositionHeap < DefaultSymbolType > &, const string::StringBase & > { +class PositionHeapFactors : public std::SingleDispatchFirstStaticParam < PositionHeapFactors, std::set < unsigned >, const indexes::stringology::PositionHeap < DefaultSymbolType > &, const string::StringBase & > { template < class SymbolType > static void accumulateResult ( const std::trie < SymbolType, unsigned > & trie, std::set < unsigned > & res, unsigned indexedStringSize ) { res.insert ( indexedStringSize - trie.getData ( ) ); @@ -55,15 +55,15 @@ public: * @param string string to query by * @return occurences of factors */ - static std::set < unsigned > query ( const indexes::PositionHeap < DefaultSymbolType > & positionHeap, const string::String & string ); + static std::set < unsigned > query ( const indexes::stringology::PositionHeap < DefaultSymbolType > & positionHeap, const string::String & string ); template < class SymbolType > - static std::set < unsigned > query ( const indexes::PositionHeap < SymbolType > & positionHeap, const string::LinearString < SymbolType > & string ); + static std::set < unsigned > query ( const indexes::stringology::PositionHeap < SymbolType > & positionHeap, const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -std::set < unsigned > PositionHeapFactors::query ( const indexes::PositionHeap < SymbolType > & positionHeap, const string::LinearString < SymbolType > & string ) { +std::set < unsigned > PositionHeapFactors::query ( const indexes::stringology::PositionHeap < SymbolType > & positionHeap, const string::LinearString < SymbolType > & string ) { std::set < unsigned > res; const std::trie < SymbolType, unsigned > * node = & positionHeap.getRoot ( ); diff --git a/alib2algo/src/stringology/query/SuffixArrayFactors.cpp b/alib2algo/src/stringology/query/SuffixArrayFactors.cpp index a4bb0a15a212febf77e5fbd619a3a8ddd13a5efd..52d61687c48c15945b9e9992d8c2d4fbf9bd001d 100644 --- a/alib2algo/src/stringology/query/SuffixArrayFactors.cpp +++ b/alib2algo/src/stringology/query/SuffixArrayFactors.cpp @@ -13,7 +13,7 @@ namespace stringology { namespace query { -std::set < unsigned > SuffixArrayFactors::query ( const indexes::SuffixArray < > & suffixArray, const string::String & string ) { +std::set < unsigned > SuffixArrayFactors::query ( const indexes::stringology::SuffixArray < > & suffixArray, const string::String & string ) { return dispatch ( suffixArray, string.getData ( ) ); } diff --git a/alib2algo/src/stringology/query/SuffixArrayFactors.h b/alib2algo/src/stringology/query/SuffixArrayFactors.h index 8724b0306a479ba5737781fcf0e1b8f8bdf59df9..592591c51526df03f9a6ccf984ac53069298a052 100644 --- a/alib2algo/src/stringology/query/SuffixArrayFactors.h +++ b/alib2algo/src/stringology/query/SuffixArrayFactors.h @@ -8,7 +8,7 @@ #ifndef SUFFIX_ARRAY_FACTORS_H_ #define SUFFIX_ARRAY_FACTORS_H_ -#include <indexes/SuffixArray.h> +#include <indexes/stringology/SuffixArray.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -25,7 +25,7 @@ namespace query { * Source: ?? */ -class SuffixArrayFactors : public std::SingleDispatchFirstStaticParam < SuffixArrayFactors, std::set < unsigned >, const indexes::SuffixArray < DefaultSymbolType > &, const string::StringBase & > { +class SuffixArrayFactors : public std::SingleDispatchFirstStaticParam < SuffixArrayFactors, std::set < unsigned >, const indexes::stringology::SuffixArray < DefaultSymbolType > &, const string::StringBase & > { public: /** * Query a suffix array @@ -33,15 +33,15 @@ public: * @param string string to query by * @return occurences of factors */ - static std::set < unsigned > query ( const indexes::SuffixArray < DefaultSymbolType > & suffixArray, const string::String & string ); + static std::set < unsigned > query ( const indexes::stringology::SuffixArray < DefaultSymbolType > & suffixArray, const string::String & string ); template < class SymbolType > - static std::set < unsigned > query ( const indexes::SuffixArray < SymbolType > & suffixArray, const string::LinearString < SymbolType > & string ); + static std::set < unsigned > query ( const indexes::stringology::SuffixArray < SymbolType > & suffixArray, const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -std::set < unsigned > SuffixArrayFactors::query ( const indexes::SuffixArray < SymbolType > & suffixArray, const string::LinearString < SymbolType > & string ) { +std::set < unsigned > SuffixArrayFactors::query ( const indexes::stringology::SuffixArray < SymbolType > & suffixArray, const string::LinearString < SymbolType > & string ) { auto comparator = [ & ] ( const std::vector < SymbolType > & first, unsigned firstIndex, const std::vector < SymbolType > & second, unsigned secondIndex, unsigned limit ) -> int { static std::compare < SymbolType > comp; diff --git a/alib2algo/src/stringology/query/SuffixTrieFactors.cpp b/alib2algo/src/stringology/query/SuffixTrieFactors.cpp index 0667edcd1922f3a9ac962d8a0d1f624ce6ebc2b6..c47ad35bd805ab58f2eeecf52a3bcbd558f8943e 100644 --- a/alib2algo/src/stringology/query/SuffixTrieFactors.cpp +++ b/alib2algo/src/stringology/query/SuffixTrieFactors.cpp @@ -13,7 +13,7 @@ namespace stringology { namespace query { -std::set < unsigned > SuffixTrieFactors::query ( const indexes::SuffixTrie < DefaultSymbolType > & suffixTrie, const string::String & string ) { +std::set < unsigned > SuffixTrieFactors::query ( const indexes::stringology::SuffixTrie < DefaultSymbolType > & suffixTrie, const string::String & string ) { return dispatch ( suffixTrie, string.getData ( ) ); } diff --git a/alib2algo/src/stringology/query/SuffixTrieFactors.h b/alib2algo/src/stringology/query/SuffixTrieFactors.h index 0098f88c2918136899a14ad3f26e566ddef2d8f0..e203084120c0e385da237f4cf3c90e7190d21a16 100644 --- a/alib2algo/src/stringology/query/SuffixTrieFactors.h +++ b/alib2algo/src/stringology/query/SuffixTrieFactors.h @@ -8,7 +8,7 @@ #ifndef SUFFIX_TRIE_FACTORS_H_ #define SUFFIX_TRIE_FACTORS_H_ -#include <indexes/SuffixTrie.h> +#include <indexes/stringology/SuffixTrie.h> #include <string/String.h> #include <string/LinearString.h> #include <core/multipleDispatch.hpp> @@ -23,7 +23,7 @@ namespace query { * Source: ?? */ -class SuffixTrieFactors : public std::SingleDispatchFirstStaticParam < SuffixTrieFactors, std::set < unsigned >, const indexes::SuffixTrie < DefaultSymbolType > &, const string::StringBase & > { +class SuffixTrieFactors : public std::SingleDispatchFirstStaticParam < SuffixTrieFactors, std::set < unsigned >, const indexes::stringology::SuffixTrie < DefaultSymbolType > &, const string::StringBase & > { template < class SymbolType > static void accumulateResult ( const std::trie < SymbolType, std::variant < void, unsigned > > & trie, std::set < unsigned > & res ) { if ( trie.getData ( ).template is < unsigned > ( ) ) @@ -41,15 +41,15 @@ public: * @param string string to query by * @return occurences of factors */ - static std::set < unsigned > query ( const indexes::SuffixTrie < DefaultSymbolType > & suffixTrie, const string::String & string ); + static std::set < unsigned > query ( const indexes::stringology::SuffixTrie < DefaultSymbolType > & suffixTrie, const string::String & string ); template < class SymbolType > - static std::set < unsigned > query ( const indexes::SuffixTrie < SymbolType > & suffixTrie, const string::LinearString < SymbolType > & string ); + static std::set < unsigned > query ( const indexes::stringology::SuffixTrie < SymbolType > & suffixTrie, const string::LinearString < SymbolType > & string ); }; template < class SymbolType > -std::set < unsigned > SuffixTrieFactors::query ( const indexes::SuffixTrie < SymbolType > & suffixTrie, const string::LinearString < SymbolType > & string ) { +std::set < unsigned > SuffixTrieFactors::query ( const indexes::stringology::SuffixTrie < SymbolType > & suffixTrie, const string::LinearString < SymbolType > & string ) { const std::trie < SymbolType, std::variant < void, unsigned > > * node = & suffixTrie.getRoot ( ); for ( const SymbolType & symbol : string.getContent ( ) ) { auto iter = node->getChildren ( ).find ( symbol ); diff --git a/alib2data/src/indexes/BitParallelIndex.cpp b/alib2data/src/indexes/stringology/BitParallelIndex.cpp similarity index 77% rename from alib2data/src/indexes/BitParallelIndex.cpp rename to alib2data/src/indexes/stringology/BitParallelIndex.cpp index af8bc32b68c8d572574e86ace04031bfd40e14fc..150aa89b2d065872e3e9d822acd6c44e1a04f4a9 100644 --- a/alib2data/src/indexes/BitParallelIndex.cpp +++ b/alib2data/src/indexes/stringology/BitParallelIndex.cpp @@ -9,6 +9,6 @@ namespace alib { -auto bitParallelIndexParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::BitParallelIndex < > > ( ); +auto bitParallelIndexParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::stringology::BitParallelIndex < > > ( ); } /* namespace alib */ diff --git a/alib2data/src/indexes/BitParallelIndex.h b/alib2data/src/indexes/stringology/BitParallelIndex.h similarity index 92% rename from alib2data/src/indexes/BitParallelIndex.h rename to alib2data/src/indexes/stringology/BitParallelIndex.h index 79ab57d5837bc8f85365c6c2b6e88ec89788985c..100a2c99620a615e119401f5e37f1782523fb92f 100644 --- a/alib2data/src/indexes/BitParallelIndex.h +++ b/alib2data/src/indexes/stringology/BitParallelIndex.h @@ -30,6 +30,8 @@ namespace indexes { +namespace stringology { + class GeneralAlphabet; /** @@ -109,10 +111,14 @@ public: virtual alib::ObjectBase * inc ( ) &&; }; +} /* namespace stringology */ + } /* namespace indexes */ namespace indexes { +namespace stringology { + template < class SymbolType > BitParallelIndex < SymbolType >::BitParallelIndex ( std::set < SymbolType > alphabet, std::map < SymbolType, std::vector < bool > > vectors ) : std::Components < BitParallelIndex, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), m_vectors ( std::move ( vectors ) ) { } @@ -200,23 +206,25 @@ alib::ObjectBase* BitParallelIndex < SymbolType >::inc() && { return new alib::UniqueObject(alib::Object(std::move(*this)), primitive::Integer(0)); } +} /* namespace stringology */ + } /* namespace indexes */ namespace std { template < class SymbolType > -class ComponentConstraint < indexes::BitParallelIndex < SymbolType >, SymbolType, indexes::GeneralAlphabet > { +class ComponentConstraint < indexes::stringology::BitParallelIndex < SymbolType >, SymbolType, indexes::stringology::GeneralAlphabet > { public: - static bool used ( const indexes::BitParallelIndex < SymbolType > & index, const SymbolType & symbol ) { + static bool used ( const indexes::stringology::BitParallelIndex < SymbolType > & index, const SymbolType & symbol ) { const std::map < SymbolType, std::vector < bool > > & content = index.getData ( ); return content.find( symbol ) != content.end(); } - static bool available ( const indexes::BitParallelIndex < SymbolType > &, const SymbolType & ) { + static bool available ( const indexes::stringology::BitParallelIndex < SymbolType > &, const SymbolType & ) { return true; } - static void valid ( const indexes::BitParallelIndex < SymbolType > &, const SymbolType & ) { + static void valid ( const indexes::stringology::BitParallelIndex < SymbolType > &, const SymbolType & ) { } }; diff --git a/alib2data/src/indexes/CompressedBitParallelIndex.cpp b/alib2data/src/indexes/stringology/CompressedBitParallelIndex.cpp similarity index 74% rename from alib2data/src/indexes/CompressedBitParallelIndex.cpp rename to alib2data/src/indexes/stringology/CompressedBitParallelIndex.cpp index 3e7ac15a1c9d4fa5e5af1ec79efdadcfde4bdf20..c33b2e224c2e1f6c8a79e32963bf28b52713125b 100644 --- a/alib2data/src/indexes/CompressedBitParallelIndex.cpp +++ b/alib2data/src/indexes/stringology/CompressedBitParallelIndex.cpp @@ -9,6 +9,6 @@ namespace alib { -auto compressedBitParallelIndexParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::CompressedBitParallelIndex < > > ( ); +auto compressedBitParallelIndexParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::stringology::CompressedBitParallelIndex < > > ( ); } /* namespace alib */ diff --git a/alib2data/src/indexes/CompressedBitParallelIndex.h b/alib2data/src/indexes/stringology/CompressedBitParallelIndex.h similarity index 92% rename from alib2data/src/indexes/CompressedBitParallelIndex.h rename to alib2data/src/indexes/stringology/CompressedBitParallelIndex.h index fe0528cfdcbfc72ee986a8a18818bf78cc301e60..54ceee7133721ce410da4099e098327d42bc0886 100644 --- a/alib2data/src/indexes/CompressedBitParallelIndex.h +++ b/alib2data/src/indexes/stringology/CompressedBitParallelIndex.h @@ -30,6 +30,8 @@ namespace indexes { +namespace stringology { + class GeneralAlphabet; /** @@ -109,10 +111,14 @@ public: virtual alib::ObjectBase * inc ( ) &&; }; +} /* namespace stringology */ + } /* namespace indexes */ namespace indexes { +namespace stringology { + template < class SymbolType > CompressedBitParallelIndex < SymbolType >::CompressedBitParallelIndex ( std::set < SymbolType > alphabet, std::map < SymbolType, common::SparseBoolVector > vectors ) : std::Components < CompressedBitParallelIndex, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), m_vectors ( std::move ( vectors ) ) { } @@ -200,23 +206,25 @@ alib::ObjectBase* CompressedBitParallelIndex < SymbolType >::inc() && { return new alib::UniqueObject(alib::Object(std::move(*this)), primitive::Integer(0)); } +} /* namespace stringology */ + } /* namespace indexes */ namespace std { template < class SymbolType > -class ComponentConstraint < indexes::CompressedBitParallelIndex < SymbolType >, SymbolType, indexes::GeneralAlphabet > { +class ComponentConstraint < indexes::stringology::CompressedBitParallelIndex < SymbolType >, SymbolType, indexes::stringology::GeneralAlphabet > { public: - static bool used ( const indexes::CompressedBitParallelIndex < SymbolType > & index, const SymbolType & symbol ) { + static bool used ( const indexes::stringology::CompressedBitParallelIndex < SymbolType > & index, const SymbolType & symbol ) { const std::map < SymbolType, common::SparseBoolVector > & content = index.getData ( ); return content.find( symbol ) != content.end(); } - static bool available ( const indexes::CompressedBitParallelIndex < SymbolType > &, const SymbolType & ) { + static bool available ( const indexes::stringology::CompressedBitParallelIndex < SymbolType > &, const SymbolType & ) { return true; } - static void valid ( const indexes::CompressedBitParallelIndex < SymbolType > &, const SymbolType & ) { + static void valid ( const indexes::stringology::CompressedBitParallelIndex < SymbolType > &, const SymbolType & ) { } }; diff --git a/alib2data/src/indexes/PositionHeap.cpp b/alib2data/src/indexes/stringology/PositionHeap.cpp similarity index 79% rename from alib2data/src/indexes/PositionHeap.cpp rename to alib2data/src/indexes/stringology/PositionHeap.cpp index 9b47d21c3913212ce903b74ed693e37c280b95ee..0b973aca0a9d7917d6fd07b2bc681019a27ca8bb 100644 --- a/alib2data/src/indexes/PositionHeap.cpp +++ b/alib2data/src/indexes/stringology/PositionHeap.cpp @@ -9,6 +9,6 @@ namespace alib { -auto positionHeapParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::PositionHeap < > > ( ); +auto positionHeapParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::stringology::PositionHeap < > > ( ); } /* namespace alib */ diff --git a/alib2data/src/indexes/PositionHeap.h b/alib2data/src/indexes/stringology/PositionHeap.h similarity index 93% rename from alib2data/src/indexes/PositionHeap.h rename to alib2data/src/indexes/stringology/PositionHeap.h index 950fc95d935598e9e6bb6ac1084a376e12499be2..058710b7b484d13806c94393e872c6937ad46248 100644 --- a/alib2data/src/indexes/PositionHeap.h +++ b/alib2data/src/indexes/stringology/PositionHeap.h @@ -35,6 +35,8 @@ namespace indexes { +namespace stringology { + class GeneralAlphabet; /** @@ -118,10 +120,14 @@ public: virtual alib::ObjectBase * inc ( ) &&; }; +} /* namespace stringology */ + } /* namespace indexes */ namespace indexes { +namespace stringology { + template < class SymbolType > PositionHeap < SymbolType >::PositionHeap ( std::set < SymbolType > edgeAlphabet, std::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ) : std::Components < PositionHeap, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( edgeAlphabet ) ), std::tuple < > ( ) ), m_trie ( std::move ( trie ) ), m_string ( std::move ( string ) ) { checkTrie ( this->m_trie ); @@ -215,12 +221,14 @@ alib::ObjectBase* PositionHeap < SymbolType >::inc() && { return new alib::UniqueObject(alib::Object(std::move(*this)), primitive::Integer(0)); } +} /* namespace stringology */ + } /* namespace indexes */ namespace std { template < class SymbolType > -class ComponentConstraint < indexes::PositionHeap < SymbolType >, SymbolType, indexes::GeneralAlphabet > { +class ComponentConstraint < indexes::stringology::PositionHeap < SymbolType >, SymbolType, indexes::stringology::GeneralAlphabet > { static bool used ( const std::trie < SymbolType, unsigned > & trie, const SymbolType & symbol ) { for ( const std::pair < const SymbolType, std::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) { @@ -231,16 +239,16 @@ class ComponentConstraint < indexes::PositionHeap < SymbolType >, SymbolType, in } public: - static bool used ( const indexes::PositionHeap < SymbolType > & index, const SymbolType & symbol ) { + static bool used ( const indexes::stringology::PositionHeap < SymbolType > & index, const SymbolType & symbol ) { const std::vector < SymbolType > & content = index.getString ( ); return std::find ( content.begin(), content.end(), symbol ) != content.end() || used ( index.getRoot ( ), symbol ); } - static bool available ( const indexes::PositionHeap < SymbolType > &, const SymbolType & ) { + static bool available ( const indexes::stringology::PositionHeap < SymbolType > &, const SymbolType & ) { return true; } - static void valid ( const indexes::PositionHeap < SymbolType > &, const SymbolType & ) { + static void valid ( const indexes::stringology::PositionHeap < SymbolType > &, const SymbolType & ) { } }; diff --git a/alib2data/src/indexes/SuffixArray.cpp b/alib2data/src/indexes/stringology/SuffixArray.cpp similarity index 79% rename from alib2data/src/indexes/SuffixArray.cpp rename to alib2data/src/indexes/stringology/SuffixArray.cpp index a8a78135893259797721950b3f6ce1e55614ace0..6da125bfb0b59722df6e4821e07a77231dfb80a2 100644 --- a/alib2data/src/indexes/SuffixArray.cpp +++ b/alib2data/src/indexes/stringology/SuffixArray.cpp @@ -9,6 +9,6 @@ namespace alib { -auto suffixArrayParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::SuffixArray < > > ( ); +auto suffixArrayParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::stringology::SuffixArray < > > ( ); } /* namespace alib */ diff --git a/alib2data/src/indexes/SuffixArray.h b/alib2data/src/indexes/stringology/SuffixArray.h similarity index 92% rename from alib2data/src/indexes/SuffixArray.h rename to alib2data/src/indexes/stringology/SuffixArray.h index 1c0e5597120af4e8f238e3963acbcf15025f998b..58d74706c8780b5e6844053e62d70f5dede114b7 100644 --- a/alib2data/src/indexes/SuffixArray.h +++ b/alib2data/src/indexes/stringology/SuffixArray.h @@ -33,6 +33,8 @@ namespace indexes { +namespace stringology { + class GeneralAlphabet; /** @@ -113,10 +115,14 @@ public: virtual alib::ObjectBase * inc ( ) &&; }; +} /* namespace stringology */ + } /* namespace indexes */ namespace indexes { +namespace stringology { + template < class SymbolType > SuffixArray < SymbolType >::SuffixArray ( std::set < SymbolType > alphabet, std::vector < unsigned > data, std::vector < SymbolType > string ) : std::Components < SuffixArray, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), m_data ( std::move ( data ) ), m_string ( std::move ( string ) ) { // TODO check validity of the string like in LinearString @@ -195,23 +201,25 @@ alib::ObjectBase* SuffixArray < SymbolType >::inc() && { return new alib::UniqueObject(alib::Object(std::move(*this)), primitive::Integer(0)); } +} /* namespace stringology */ + } /* namespace indexes */ namespace std { template < class SymbolType > -class ComponentConstraint < indexes::SuffixArray < SymbolType >, SymbolType, indexes::GeneralAlphabet > { +class ComponentConstraint < indexes::stringology::SuffixArray < SymbolType >, SymbolType, indexes::stringology::GeneralAlphabet > { public: - static bool used ( const indexes::SuffixArray < SymbolType > & index, const SymbolType & symbol ) { + static bool used ( const indexes::stringology::SuffixArray < SymbolType > & index, const SymbolType & symbol ) { const std::vector < SymbolType > & content = index.getString ( ); return std::find ( content.begin(), content.end(), symbol ) != content.end(); } - static bool available ( const indexes::SuffixArray < SymbolType > &, const SymbolType & ) { + static bool available ( const indexes::stringology::SuffixArray < SymbolType > &, const SymbolType & ) { return true; } - static void valid ( const indexes::SuffixArray < SymbolType > &, const SymbolType & ) { + static void valid ( const indexes::stringology::SuffixArray < SymbolType > &, const SymbolType & ) { } }; diff --git a/alib2data/src/indexes/SuffixTrie.cpp b/alib2data/src/indexes/stringology/SuffixTrie.cpp similarity index 80% rename from alib2data/src/indexes/SuffixTrie.cpp rename to alib2data/src/indexes/stringology/SuffixTrie.cpp index a832205c778cd0460fe07f2bfd6ac764e52d4135..16dea4cef077d51c5364f7b944b259961d288b6f 100644 --- a/alib2data/src/indexes/SuffixTrie.cpp +++ b/alib2data/src/indexes/stringology/SuffixTrie.cpp @@ -9,6 +9,6 @@ namespace alib { -auto suffixTrieParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::SuffixTrie < > > ( ); +auto suffixTrieParserRegister = xmlApi < alib::Object >::ParserRegister < indexes::stringology::SuffixTrie < > > ( ); } /* namespace alib */ diff --git a/alib2data/src/indexes/SuffixTrie.h b/alib2data/src/indexes/stringology/SuffixTrie.h similarity index 93% rename from alib2data/src/indexes/SuffixTrie.h rename to alib2data/src/indexes/stringology/SuffixTrie.h index d8b4e8a3c934d4180be054946a1b3c6565dab543..ed2123bc0abba726d8cb6220db19214e64c30109 100644 --- a/alib2data/src/indexes/SuffixTrie.h +++ b/alib2data/src/indexes/stringology/SuffixTrie.h @@ -37,6 +37,8 @@ namespace indexes { +namespace stringology { + class GeneralAlphabet; /** @@ -118,10 +120,14 @@ public: virtual alib::ObjectBase * inc ( ) &&; }; +} /* namespace stringology */ + } /* namespace indexes */ namespace indexes { +namespace stringology { + template < class SymbolType > SuffixTrie < SymbolType >::SuffixTrie ( std::set < SymbolType > edgeAlphabet ) : SuffixTrie ( std::move ( edgeAlphabet ), std::trie < SymbolType, std::variant < void, unsigned > > ( std::variant < void, unsigned >::template from < void > ( ) ) ) { } @@ -211,12 +217,14 @@ alib::ObjectBase* SuffixTrie < SymbolType >::inc() && { return new alib::UniqueObject(alib::Object(std::move(*this)), primitive::Integer(0)); } +} /* namespace stringology */ + } /* namespace indexes */ namespace std { template < class SymbolType > -class ComponentConstraint < indexes::SuffixTrie < SymbolType >, SymbolType, indexes::GeneralAlphabet > { +class ComponentConstraint < indexes::stringology::SuffixTrie < SymbolType >, SymbolType, indexes::stringology::GeneralAlphabet > { static bool used ( const std::trie < SymbolType, std::variant < void, unsigned > > & trie, const SymbolType & symbol ) { for ( const std::pair < const SymbolType, std::trie < SymbolType, std::variant < void, unsigned > > > & child : trie.getChildren ( ) ) { @@ -227,15 +235,15 @@ class ComponentConstraint < indexes::SuffixTrie < SymbolType >, SymbolType, inde } public: - static bool used ( const indexes::SuffixTrie < SymbolType > & index, const SymbolType & symbol ) { + static bool used ( const indexes::stringology::SuffixTrie < SymbolType > & index, const SymbolType & symbol ) { return used ( index.getRoot ( ), symbol ); } - static bool available ( const indexes::SuffixTrie < SymbolType > &, const SymbolType & ) { + static bool available ( const indexes::stringology::SuffixTrie < SymbolType > &, const SymbolType & ) { return true; } - static void valid ( const indexes::SuffixTrie < SymbolType > &, const SymbolType & ) { + static void valid ( const indexes::stringology::SuffixTrie < SymbolType > &, const SymbolType & ) { } }; diff --git a/aquery2/src/aquery.cpp b/aquery2/src/aquery.cpp index 15e00462bb38e1ce81729addc383b788403c0164..df81f9a05a088a1d8c5d7ced35692071f2e69ae5 100644 --- a/aquery2/src/aquery.cpp +++ b/aquery2/src/aquery.cpp @@ -62,7 +62,7 @@ int main ( int argc, char * argv[] ) { measurements::start ( "Input read", measurements::Type::AUXILIARY ); if ( query.getValue ( ) == "suffixTrieFactors" ) { - indexes::SuffixTrie < DefaultSymbolType > suffixTrie = alib::XmlDataFactory::fromTokens < indexes::SuffixTrie < DefaultSymbolType > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); + indexes::stringology::SuffixTrie < DefaultSymbolType > suffixTrie = alib::XmlDataFactory::fromTokens < indexes::stringology::SuffixTrie < DefaultSymbolType > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) ); measurements::end ( ); @@ -75,7 +75,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( res ); } else if ( query.getValue ( ) == "suffixArrayFactors" ) { - indexes::SuffixArray < > suffixArray = alib::XmlDataFactory::fromTokens < indexes::SuffixArray < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); + indexes::stringology::SuffixArray < > suffixArray = alib::XmlDataFactory::fromTokens < indexes::stringology::SuffixArray < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) ); measurements::end ( ); @@ -88,7 +88,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( res ); } else if ( query.getValue ( ) == "positionHeapFactors" ) { - indexes::PositionHeap < > positionHeap = alib::XmlDataFactory::fromTokens < indexes::PositionHeap < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); + indexes::stringology::PositionHeap < > positionHeap = alib::XmlDataFactory::fromTokens < indexes::stringology::PositionHeap < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) ); measurements::end ( ); @@ -101,7 +101,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( res ); } else if ( query.getValue ( ) == "bitParallelismFactors" ) { - indexes::BitParallelIndex < > bitParallelIndex = alib::XmlDataFactory::fromTokens < indexes::BitParallelIndex < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); + indexes::stringology::BitParallelIndex < > bitParallelIndex = alib::XmlDataFactory::fromTokens < indexes::stringology::BitParallelIndex < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) ); measurements::end ( ); @@ -114,7 +114,7 @@ int main ( int argc, char * argv[] ) { alib::XmlDataFactory::toStdout ( res ); } else if ( query.getValue ( ) == "compressedBitParallelismFactors" ) { - indexes::CompressedBitParallelIndex < > compressedBitParallelIndex = alib::XmlDataFactory::fromTokens < indexes::CompressedBitParallelIndex < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); + indexes::stringology::CompressedBitParallelIndex < > compressedBitParallelIndex = alib::XmlDataFactory::fromTokens < indexes::stringology::CompressedBitParallelIndex < > > ( sax::FromXMLParserHelper::parseInput ( indexInput ) ); string::String pattern = alib::XmlDataFactory::fromTokens < string::String > ( std::move ( sax::FromXMLParserHelper::parseInput(true, patternInput).front ( ) ) ); measurements::end ( ); diff --git a/astringology2/src/astringology.cpp b/astringology2/src/astringology.cpp index 048414bd58079e323b7c06b803b78edf4ac9a8f5..2f9b7f12c9c6417932aaa0c56e5a6bd556e3f342 100644 --- a/astringology2/src/astringology.cpp +++ b/astringology2/src/astringology.cpp @@ -291,7 +291,7 @@ int main ( int argc, char * argv[] ) { measurements::end ( ); measurements::start ( "Algorithm", measurements::Type::MAIN ); - indexes::SuffixTrie < DefaultSymbolType > suffixTrie = stringology::indexing::SuffixTrieNaive::construct ( subject ); + indexes::stringology::SuffixTrie < DefaultSymbolType > suffixTrie = stringology::indexing::SuffixTrieNaive::construct ( subject ); measurements::end ( ); measurements::start ( "Output write", measurements::Type::AUXILIARY ); @@ -303,7 +303,7 @@ int main ( int argc, char * argv[] ) { measurements::end ( ); measurements::start ( "Algorithm", measurements::Type::MAIN ); - indexes::PositionHeap < DefaultSymbolType > positionHeap = stringology::indexing::PositionHeapNaive::construct ( subject ); + indexes::stringology::PositionHeap < DefaultSymbolType > positionHeap = stringology::indexing::PositionHeapNaive::construct ( subject ); measurements::end ( ); measurements::start ( "Output write", measurements::Type::AUXILIARY ); @@ -315,7 +315,7 @@ int main ( int argc, char * argv[] ) { measurements::end ( ); measurements::start ( "Algorithm", measurements::Type::MAIN ); - indexes::BitParallelIndex < DefaultSymbolType > bitParallelIndex = stringology::indexing::BitParallelIndexConstruction::construct ( subject ); + indexes::stringology::BitParallelIndex < DefaultSymbolType > bitParallelIndex = stringology::indexing::BitParallelIndexConstruction::construct ( subject ); measurements::end ( ); measurements::start ( "Output write", measurements::Type::AUXILIARY ); @@ -327,7 +327,7 @@ int main ( int argc, char * argv[] ) { measurements::end ( ); measurements::start ( "Algorithm", measurements::Type::MAIN ); - indexes::CompressedBitParallelIndex < DefaultSymbolType > compressedBitParallelIndex = stringology::indexing::CompressedBitParallelIndexConstruction::construct ( subject ); + indexes::stringology::CompressedBitParallelIndex < DefaultSymbolType > compressedBitParallelIndex = stringology::indexing::CompressedBitParallelIndexConstruction::construct ( subject ); measurements::end ( ); measurements::start ( "Output write", measurements::Type::AUXILIARY ); @@ -339,7 +339,7 @@ int main ( int argc, char * argv[] ) { measurements::end ( ); measurements::start ( "Algorithm", measurements::Type::MAIN ); - indexes::SuffixArray < > suffixArray = stringology::indexing::SuffixArrayNaive::construct ( subject ); + indexes::stringology::SuffixArray < > suffixArray = stringology::indexing::SuffixArrayNaive::construct ( subject ); measurements::end ( ); measurements::start ( "Output write", measurements::Type::AUXILIARY );