diff --git a/alib2common/src/base/CommonBase.hpp b/alib2common/src/base/CommonBase.hpp index d95240caf9eb52e97f3e95388299949221f75ec9..c537870be68283d67f94fde19a15efc3003c2ec1 100644 --- a/alib2common/src/base/CommonBase.hpp +++ b/alib2common/src/base/CommonBase.hpp @@ -67,6 +67,8 @@ public: template< typename T > class CommonBase : public CommonBaseMiddle < T > { +public: + virtual T * normalize ( ) && = 0; }; } /* namespace alib */ diff --git a/alib2common/src/base/WrapperBase.hpp b/alib2common/src/base/WrapperBase.hpp index 126a634f46bfa44d342bc247d8efcd8846215dc1..21e2f1f6a153a9528ae942b996376a07ea4922de 100644 --- a/alib2common/src/base/WrapperBase.hpp +++ b/alib2common/src/base/WrapperBase.hpp @@ -125,6 +125,10 @@ class WrapperBase : public WrapperBaseMiddle < T > { public: using WrapperBaseMiddle < T >::WrapperBaseMiddle; + void normalize ( ) { + this->setData ( std::move ( this->getData ( ) ).normalize ( ) ); + } + }; } /* namespace alib */ diff --git a/alib2common/src/object/ObjectBase.h b/alib2common/src/object/ObjectBase.h index ca4729381285e30e0b379a18ce50ebb2a36ecc27..2079613dccfadcee9124134455c8ae6442b49aa6 100644 --- a/alib2common/src/object/ObjectBase.h +++ b/alib2common/src/object/ObjectBase.h @@ -26,6 +26,8 @@ public: virtual ObjectBase * plunder() && = 0; virtual ObjectBase * inc() && = 0; + + virtual ObjectBase * normalize() && = 0; }; } /* namespace alib */ diff --git a/alib2data/src/indexes/arbology/FullAndLinearIndex.h b/alib2data/src/indexes/arbology/FullAndLinearIndex.h index d1baf0bf262c53e66f582607761d3776531f47a5..1f27a248a048426a1afd403197adf4874fb4b72a 100644 --- a/alib2data/src/indexes/arbology/FullAndLinearIndex.h +++ b/alib2data/src/indexes/arbology/FullAndLinearIndex.h @@ -115,7 +115,7 @@ public: virtual alib::ObjectBase * inc ( ) &&; virtual ObjectBase * normalize ( ) && { - indexes::stringology::PositionHeap < DefaultSymbolType > stringIndex = manage_move ( std::move ( m_StringIndex ).normalize ( ) ); + indexes::stringology::PositionHeap < DefaultSymbolType > stringIndex = std::move ( m_StringIndex ).normalizeRaw ( ); return new FullAndLinearIndex < > ( std::move ( stringIndex ), std::move ( m_JumpTable ) ); } diff --git a/alib2data/src/indexes/stringology/PositionHeap.h b/alib2data/src/indexes/stringology/PositionHeap.h index b72c23fb1d14c6d811f18a90c6f2c3d2351c3645..960824bb627aa677e0f6c8d9f816b29099f31887 100644 --- a/alib2data/src/indexes/stringology/PositionHeap.h +++ b/alib2data/src/indexes/stringology/PositionHeap.h @@ -122,12 +122,16 @@ public: virtual alib::ObjectBase * inc ( ) &&; - virtual PositionHeap < > * normalize ( ) && { + PositionHeap < > normalizeRaw ( ) && { std::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); std::trie < DefaultSymbolType, unsigned > trie = IndexesNormalize::normalizeTrie ( std::move ( m_trie ) ); std::vector < DefaultSymbolType > string = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( m_string ) ); - return new PositionHeap < > ( std::move ( alphabet ), std::move ( trie ), std::move ( string ) ); + return PositionHeap < > ( std::move ( alphabet ), std::move ( trie ), std::move ( string ) ); + } + + virtual alib::ObjectBase * normalize ( ) && { + return std::move ( * this ).normalizeRaw ( ).plunder ( ); } }; diff --git a/alib2data/src/indexes/stringology/SuffixTrie.h b/alib2data/src/indexes/stringology/SuffixTrie.h index a029a1028165a9d521bca2fccb828e82887621d4..f7a730e386fd827a7b3cb98e3de1cd132c4fa4ab 100644 --- a/alib2data/src/indexes/stringology/SuffixTrie.h +++ b/alib2data/src/indexes/stringology/SuffixTrie.h @@ -122,7 +122,7 @@ public: virtual alib::ObjectBase * inc ( ) &&; - virtual SuffixTrie < > * normalize ( ) && { + virtual alib::ObjectBase * normalize ( ) && { std::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); std::trie < DefaultSymbolType, std::variant < void, unsigned > > trie = IndexesNormalize::normalizeTrie ( std::move ( m_trie ) ); diff --git a/alib2data/src/rte/formal/FormalRTEElement.h b/alib2data/src/rte/formal/FormalRTEElement.h index 244c91233da90e0e6569cbaca4e4a0ab251d6c5f..1708e12bfd3c791a54492451098bb7ea9d975067 100644 --- a/alib2data/src/rte/formal/FormalRTEElement.h +++ b/alib2data/src/rte/formal/FormalRTEElement.h @@ -17,7 +17,7 @@ namespace rte { template < class SymbolType, class RankType > -class FormalRTEElement : public alib::CommonBase < FormalRTEElement < SymbolType, RankType > >, public std::BaseNode < FormalRTEElement < SymbolType, RankType > > { +class FormalRTEElement : public alib::CommonBaseMiddle < FormalRTEElement < SymbolType, RankType > >, public std::BaseNode < FormalRTEElement < SymbolType, RankType > > { public: class Visitor { public: diff --git a/alib2data_experimental/src/graph/directed/AdjacencyListDirectedGraph.h b/alib2data_experimental/src/graph/directed/AdjacencyListDirectedGraph.h index 48120c6b1d7110658b46555a85877233ead59ec7..5b67f45fc5ebf31447d7b7bf3f81bd4ee34f9cb6 100644 --- a/alib2data_experimental/src/graph/directed/AdjacencyListDirectedGraph.h +++ b/alib2data_experimental/src/graph/directed/AdjacencyListDirectedGraph.h @@ -91,7 +91,7 @@ public: alib::ObjectBase * inc ( ) && override; - virtual AdjacencyListDirectedGraph * normalize ( ) && { + virtual AdjacencyListDirectedGraph * normalize ( ) && override { return this; } }; diff --git a/alib2data_experimental/src/graph/directed/AdjacencyMatrixDirectedGraph.h b/alib2data_experimental/src/graph/directed/AdjacencyMatrixDirectedGraph.h index c94adb9e6bb43c51e439b11bca9e7b543f9465a9..9bb8b67051d5b191274db6d20c0cc510abf7dc42 100644 --- a/alib2data_experimental/src/graph/directed/AdjacencyMatrixDirectedGraph.h +++ b/alib2data_experimental/src/graph/directed/AdjacencyMatrixDirectedGraph.h @@ -94,7 +94,7 @@ public: alib::ObjectBase * inc ( ) && override; - virtual AdjacencyMatrixDirectedGraph * normalize ( ) && { + virtual AdjacencyMatrixDirectedGraph * normalize ( ) && override { return this; } }; diff --git a/alib2data_experimental/src/graph/undirected/AdjacencyListUndirectedGraph.h b/alib2data_experimental/src/graph/undirected/AdjacencyListUndirectedGraph.h index 13a06f483b0d52a3e84e3c29ec52af48c443250b..52e931c513d4194783f2bca0ae91d27c58daea49 100644 --- a/alib2data_experimental/src/graph/undirected/AdjacencyListUndirectedGraph.h +++ b/alib2data_experimental/src/graph/undirected/AdjacencyListUndirectedGraph.h @@ -88,7 +88,7 @@ public: alib::ObjectBase * inc ( ) && override; - virtual AdjacencyListUndirectedGraph * normalize ( ) && { + virtual AdjacencyListUndirectedGraph * normalize ( ) && override { return this; } }; diff --git a/alib2data_experimental/src/graph/undirected/AdjacencyMatrixUndirectedGraph.h b/alib2data_experimental/src/graph/undirected/AdjacencyMatrixUndirectedGraph.h index a2e26f09b5132aa7fa2e3e461da9b5c4f91683ec..62b32d1064184261abad5a3438057f2ccad25233 100644 --- a/alib2data_experimental/src/graph/undirected/AdjacencyMatrixUndirectedGraph.h +++ b/alib2data_experimental/src/graph/undirected/AdjacencyMatrixUndirectedGraph.h @@ -91,7 +91,7 @@ public: alib::ObjectBase * inc ( ) && override; - virtual AdjacencyMatrixUndirectedGraph * normalize ( ) && { + virtual AdjacencyMatrixUndirectedGraph * normalize ( ) && override { return this; } };