From a56b0a9ca420c186e35250767a556eb3f3507262 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 14 Mar 2017 08:24:43 +0100 Subject: [PATCH] move string indexes to separate namespace --- .../indexing/BitParallelIndexConstruction.cpp | 4 ++-- .../indexing/BitParallelIndexConstruction.h | 12 ++++++------ .../CompressedBitParallelIndexConstruction.cpp | 4 ++-- .../CompressedBitParallelIndexConstruction.h | 12 ++++++------ .../stringology/indexing/PositionHeapNaive.cpp | 4 ++-- .../src/stringology/indexing/PositionHeapNaive.h | 12 ++++++------ .../stringology/indexing/SuffixArrayNaive.cpp | 4 ++-- .../src/stringology/indexing/SuffixArrayNaive.h | 12 ++++++------ .../src/stringology/indexing/SuffixTrieNaive.cpp | 4 ++-- .../src/stringology/indexing/SuffixTrieNaive.h | 12 ++++++------ .../stringology/query/BitParallelismFactors.cpp | 2 +- .../stringology/query/BitParallelismFactors.h | 10 +++++----- .../query/CompressedBitParallelismFactors.cpp | 2 +- .../query/CompressedBitParallelismFactors.h | 10 +++++----- .../stringology/query/PositionHeapFactors.cpp | 2 +- .../src/stringology/query/PositionHeapFactors.h | 10 +++++----- .../src/stringology/query/SuffixArrayFactors.cpp | 2 +- .../src/stringology/query/SuffixArrayFactors.h | 10 +++++----- .../src/stringology/query/SuffixTrieFactors.cpp | 2 +- .../src/stringology/query/SuffixTrieFactors.h | 10 +++++----- .../{ => stringology}/BitParallelIndex.cpp | 2 +- .../indexes/{ => stringology}/BitParallelIndex.h | 16 ++++++++++++---- .../CompressedBitParallelIndex.cpp | 2 +- .../CompressedBitParallelIndex.h | 16 ++++++++++++---- .../indexes/{ => stringology}/PositionHeap.cpp | 2 +- .../src/indexes/{ => stringology}/PositionHeap.h | 16 ++++++++++++---- .../indexes/{ => stringology}/SuffixArray.cpp | 2 +- .../src/indexes/{ => stringology}/SuffixArray.h | 16 ++++++++++++---- .../src/indexes/{ => stringology}/SuffixTrie.cpp | 2 +- .../src/indexes/{ => stringology}/SuffixTrie.h | 16 ++++++++++++---- aquery2/src/aquery.cpp | 10 +++++----- astringology2/src/astringology.cpp | 10 +++++----- 32 files changed, 145 insertions(+), 105 deletions(-) rename alib2data/src/indexes/{ => stringology}/BitParallelIndex.cpp (77%) rename alib2data/src/indexes/{ => stringology}/BitParallelIndex.h (92%) rename alib2data/src/indexes/{ => stringology}/CompressedBitParallelIndex.cpp (74%) rename alib2data/src/indexes/{ => stringology}/CompressedBitParallelIndex.h (92%) rename alib2data/src/indexes/{ => stringology}/PositionHeap.cpp (79%) rename alib2data/src/indexes/{ => stringology}/PositionHeap.h (93%) rename alib2data/src/indexes/{ => stringology}/SuffixArray.cpp (79%) rename alib2data/src/indexes/{ => stringology}/SuffixArray.h (92%) rename alib2data/src/indexes/{ => stringology}/SuffixTrie.cpp (80%) rename alib2data/src/indexes/{ => stringology}/SuffixTrie.h (93%) diff --git a/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.cpp b/alib2algo/src/stringology/indexing/BitParallelIndexConstruction.cpp index e535b8313a..ab1944e02b 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 de02c92a13..ec2086094d 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 0219ca14cb..d88f00999c 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 32b61d5114..6e9b6c4cb2 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 a1beaccbaa..0cf33b4968 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 08b636be33..9dfbdd1dcf 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 481591421d..b003e712e0 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 9012363556..ceb66817d6 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 a16fa12ebb..c5bb33a5a7 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 02ea1a1899..c9e81447e3 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 58f41cfa4c..d2eb2f41cf 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 fcc5d8963e..71d25922b9 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 be3a416889..d1eea5dd83 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 f6f393e6c9..f8a62e3ad8 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 75ee85ab40..ce32e67fca 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 0c7884fc8d..6ac56572fe 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 a4bb0a15a2..52d61687c4 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 8724b0306a..592591c515 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 0667edcd19..c47ad35bd8 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 0098f88c29..e203084120 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 af8bc32b68..150aa89b2d 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 79ab57d583..100a2c9962 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 3e7ac15a1c..c33b2e224c 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 fe0528cfdc..54ceee7133 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 9b47d21c39..0b973aca0a 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 950fc95d93..058710b7b4 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 a8a7813589..6da125bfb0 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 1c0e559712..58d74706c8 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 a832205c77..16dea4cef0 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 d8b4e8a3c9..ed2123bc0a 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 15e00462bb..df81f9a05a 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 048414bd58..2f9b7f12c9 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 ); -- GitLab