30template <
class SymbolType = DefaultSymbolType >
36#include <ext/algorithm>
55#include <string/LinearString.h>
76template <
class SymbolType >
77class PrefixBarTree final :
public core::Components < PrefixBarTree < SymbolType >, ext::set < SymbolType >, component::Set, GeneralAlphabet, SymbolType, component::Value, BarSymbol > {
129 return this->
template accessComponent < GeneralAlphabet > ( ).get ( );
138 return std::move ( this->
template accessComponent < GeneralAlphabet > ( ).
get ( ) );
147 this->
template accessComponent < GeneralAlphabet > ( ).add ( symbols );
156 return this->
template accessComponent < BarSymbol > ( ).get ( );
165 return std::move ( this->
template accessComponent < BarSymbol > ( ).
get ( ) );
227 out <<
"(PrefixBarTree";
229 out <<
" content = " << instance.
getContent ( );
244template <
class SymbolType >
246 setContent ( std::move ( data ) );
249template <
class SymbolType >
253template <
class SymbolType >
257template <
class SymbolType >
261template <
class SymbolType >
266template <
class SymbolType >
268 return std::move ( this->m_Data );
271template <
class SymbolType >
273 arityChecksum ( data );
277 throw TreeException (
"Input symbols not in the alphabet." );
280 this->m_Data = std::move ( data );
283template <
class SymbolType >
285 int arityChecksumTypes = 0;
288 if ( symbol == getBar ( ) )
289 arityChecksumTypes -= 1;
291 arityChecksumTypes += 1;
294 if ( arityChecksumTypes != 0 )
throw TreeException (
"The string does not form a tree" );
297template <
class SymbolType >
299 return this->m_Data.empty ( );
311template <
class SymbolType >
325 return std::find ( content.
begin ( ), content.
end ( ), symbol ) != content.
end ( );
355template <
class SymbolType >
367 return tree.template accessComponent < tree::GeneralAlphabet > ( ).get ( ).count ( symbol );
385template <
class SymbolType >
static ext::set< DefaultSymbolType > normalizeAlphabet(ext::set< SymbolType > &&symbols)
Definition: SymbolNormalize.h:50
static ext::vector< DefaultSymbolType > normalizeSymbols(ext::vector< SymbolType > &&symbols)
Definition: SymbolNormalize.h:86
static DefaultSymbolType normalizeSymbol(SymbolType &&symbol)
Definition: SymbolNormalize.h:68
Definition: components.hpp:181
static void valid(const tree::PrefixBarTree< SymbolType > &, const SymbolType &)
Definition: PrefixBarTree.h:376
static bool available(const tree::PrefixBarTree< SymbolType > &tree, const SymbolType &symbol)
Definition: PrefixBarTree.h:366
Definition: components.hpp:25
static void valid(const tree::PrefixBarTree< SymbolType > &, const SymbolType &)
Definition: PrefixBarTree.h:346
static bool available(const tree::PrefixBarTree< SymbolType > &, const SymbolType &)
Definition: PrefixBarTree.h:336
static bool used(const tree::PrefixBarTree< SymbolType > &tree, const SymbolType &symbol)
Definition: PrefixBarTree.h:322
Definition: setComponents.hpp:26
Output iterator calling a callback function on assignment.
Definition: iterator.hpp:923
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: set.hpp:99
auto end() &
Inherited behavior of end for non-const instance.
Definition: set.hpp:129
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
auto begin() &
Inherited behavior of begin for non-const instance.
Definition: vector.hpp:125
auto end() &
Inherited behavior of end for non-const instance.
Definition: vector.hpp:155
Linear string.
Definition: LinearString.h:57
Tree structure represented as linear sequece as result of preorder traversal with additional bar symb...
Definition: PrefixBarTree.h:77
const SymbolType & getBar() const &
Definition: PrefixBarTree.h:155
const ext::set< SymbolType > & getAlphabet() const &
Definition: PrefixBarTree.h:128
PrefixBarTree(SymbolType bar, ext::set< SymbolType > alphabet, ext::vector< SymbolType > data)
Creates a new instance of the tree with concrete alphabet, bar, and content.
Definition: PrefixBarTree.h:245
ext::set< SymbolType > && getAlphabet() &&
Definition: PrefixBarTree.h:137
SymbolType && getBar() &&
Definition: PrefixBarTree.h:164
void extendAlphabet(const ext::set< SymbolType > &symbols)
Definition: PrefixBarTree.h:146
bool operator==(const PrefixBarTree &other) const
Definition: PrefixBarTree.h:214
const ext::vector< SymbolType > & getContent() const &
Definition: PrefixBarTree.h:262
friend ext::ostream & operator<<(ext::ostream &out, const PrefixBarTree &instance)
Definition: PrefixBarTree.h:226
bool isEmpty() const
Definition: PrefixBarTree.h:298
void setContent(ext::vector< SymbolType > data)
Definition: PrefixBarTree.h:272
static ext::vector< common::ranked_symbol< SymbolType > > treeToPrefix(const ext::tree< common::ranked_symbol< SymbolType > > &tree)
Definition: TreeAuxiliary.h:185
Definition: TreeException.h:15
Tree represented in its natural representation. The representation is so called unranked,...
Definition: UnrankedTree.h:69
Definition: BarSymbol.cpp:12
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
Definition: normalize.hpp:10
Definition: sigHandler.cpp:20
constexpr tuple< Elements &... > tie(Elements &... args) noexcept
Helper of extended tuple of references construction. The tuple is constructed to reffer to values in ...
Definition: tuple.hpp:218
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
void end()
Definition: measurements.cpp:19
auto & get(ext::ptr_array< Type, N > &tpl)
Specialisation of get function for pointer arrays.
Definition: ptr_array.hpp:693
Definition: BackwardOccurrenceTest.h:17
static tree::PrefixBarTree< > eval(tree::PrefixBarTree< SymbolType > &&value)
Definition: PrefixBarTree.h:387
Definition: normalize.hpp:13