Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Public Member Functions | Friends
tree::PrefixRankedBarTree< SymbolType > Class Template Reference

Tree structure represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol needs to be compatible with unsigned integer. More...

#include <PrefixRankedBarTree.h>

Inheritance diagram for tree::PrefixRankedBarTree< SymbolType >:
[legend]
Collaboration diagram for tree::PrefixRankedBarTree< SymbolType >:
[legend]

Public Member Functions

 PrefixRankedBarTree (ext::set< common::ranked_symbol< SymbolType > > bars, ext::set< common::ranked_symbol< SymbolType > > alphabet, ext::vector< common::ranked_symbol< SymbolType > > data)
 Creates a new instance of the tree with concrete alphabet, bars, and content. More...
 
 PrefixRankedBarTree (ext::set< common::ranked_symbol< SymbolType > > bars, ext::vector< common::ranked_symbol< SymbolType > > data)
 Creates a new instance of the tree based on the content and bar set, the alphabet is implicitly created from the content. More...
 
 PrefixRankedBarTree (SymbolType barBase, const RankedTree< SymbolType > &tree)
 Creates a new instance of the tree based on the RankedTree. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars is provided as a parameter. More...
 
 PrefixRankedBarTree (const RankedTree< > &tree)
 Creates a new instance of the tree based on the RankedTree. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Bar symbols are created using some default value. More...
 
const ext::set< common::ranked_symbol< SymbolType > > & getAlphabet () const &
 
ext::set< common::ranked_symbol< SymbolType > > && getAlphabet () &&
 
void extendAlphabet (const ext::set< common::ranked_symbol< SymbolType > > &symbols)
 
const ext::set< common::ranked_symbol< SymbolType > > & getBars () const &
 
ext::set< common::ranked_symbol< SymbolType > > && getBars () &&
 
void extendBars (const ext::set< common::ranked_symbol< SymbolType > > &bars)
 
const ext::vector< common::ranked_symbol< SymbolType > > & getContent () const &
 
ext::vector< common::ranked_symbol< SymbolType > > && getContent () &&
 
void setContent (ext::vector< common::ranked_symbol< SymbolType > > data)
 
bool isEmpty () const
 
auto operator<=> (const PrefixRankedBarTree &other) const
 
bool operator== (const PrefixRankedBarTree &other) const
 
 operator string::LinearString< common::ranked_symbol< SymbolType > > () const
 Creates a new instance of the string from a linear representation of a tree. More...
 
- Public Member Functions inherited from core::Components< PrefixRankedBarTree< SymbolType >, ext::set< common::ranked_symbol< SymbolType > >, component::Set, std::tuple< GeneralAlphabet, BarSymbols > >
void accessComponent ()
 

Friends

ext::ostreamoperator<< (ext::ostream &out, const PrefixRankedBarTree &instance)
 

Additional Inherited Members

- Static Public Member Functions inherited from core::Components< PrefixRankedBarTree< SymbolType >, ext::set< common::ranked_symbol< SymbolType > >, component::Set, std::tuple< GeneralAlphabet, BarSymbols > >
static void registerComponent ()
 
static void unregisterComponent ()
 

Detailed Description

template<class SymbolType>
class tree::PrefixRankedBarTree< SymbolType >

Tree structure represented as linear sequece as result of preorder traversal with additional bar symbols. The representation is so called ranked, therefore it consists of ranked symbols (bars are ranked as well). The rank of the ranked symbol needs to be compatible with unsigned integer.

The bars represent end mark of all subtrees in the notation.

T = (A, B \subset A, C), A (Alphabet) = finite set of ranked symbols, B (Bars) = finite set of ranked symbols representing bars, C (Content) = linear representation of the tree content

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol

Constructor & Destructor Documentation

◆ PrefixRankedBarTree() [1/4]

template<class SymbolType >
tree::PrefixRankedBarTree< SymbolType >::PrefixRankedBarTree ( ext::set< common::ranked_symbol< SymbolType > >  bars,
ext::set< common::ranked_symbol< SymbolType > >  alphabet,
ext::vector< common::ranked_symbol< SymbolType > >  data 
)
explicit

Creates a new instance of the tree with concrete alphabet, bars, and content.

Parameters
barsthe initial bar set
alphabetthe initial alphabet of the tree
datathe initial tree in linear representation

◆ PrefixRankedBarTree() [2/4]

template<class SymbolType >
tree::PrefixRankedBarTree< SymbolType >::PrefixRankedBarTree ( ext::set< common::ranked_symbol< SymbolType > >  bars,
ext::vector< common::ranked_symbol< SymbolType > >  data 
)
explicit

Creates a new instance of the tree based on the content and bar set, the alphabet is implicitly created from the content.

Parameters
barsthe initial bar set
datathe initial tree in linear representation

◆ PrefixRankedBarTree() [3/4]

template<class SymbolType >
tree::PrefixRankedBarTree< SymbolType >::PrefixRankedBarTree ( SymbolType  barBase,
const RankedTree< SymbolType > &  tree 
)
explicit

Creates a new instance of the tree based on the RankedTree. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars is provided as a parameter.

Parameters
barBasethe symbol part of all bars
treeRankedTree representation of a tree.

◆ PrefixRankedBarTree() [4/4]

template<class SymbolType >
tree::PrefixRankedBarTree< SymbolType >::PrefixRankedBarTree ( const RankedTree< > &  tree)
explicit

Creates a new instance of the tree based on the RankedTree. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Bar symbols are created using some default value.

Parameters
treeRankedTree representation of a tree.

Member Function Documentation

◆ extendAlphabet()

template<class SymbolType >
void tree::PrefixRankedBarTree< SymbolType >::extendAlphabet ( const ext::set< common::ranked_symbol< SymbolType > > &  symbols)
inline

Adder of an alphabet symbols.

Parameters
symbolsthe new symbols to be added to the alphabet

◆ extendBars()

template<class SymbolType >
void tree::PrefixRankedBarTree< SymbolType >::extendBars ( const ext::set< common::ranked_symbol< SymbolType > > &  bars)
inline

Adder of symbols to a bar set.

Parameters
symbolsthe new symbols to be added to the bar set

◆ getAlphabet() [1/2]

template<class SymbolType >
ext::set< common::ranked_symbol< SymbolType > > && tree::PrefixRankedBarTree< SymbolType >::getAlphabet ( ) &&
inline

Getter of the alphabet.

Returns
the alphabet of the tree
Here is the call graph for this function:

◆ getAlphabet() [2/2]

template<class SymbolType >
const ext::set< common::ranked_symbol< SymbolType > > & tree::PrefixRankedBarTree< SymbolType >::getAlphabet ( ) const &
inline

Getter of the alphabet.

Returns
the alphabet of the tree
Here is the caller graph for this function:

◆ getBars() [1/2]

template<class SymbolType >
ext::set< common::ranked_symbol< SymbolType > > && tree::PrefixRankedBarTree< SymbolType >::getBars ( ) &&
inline

Getter of the bar set.

Returns
the bar set of the tree
Here is the call graph for this function:

◆ getBars() [2/2]

template<class SymbolType >
const ext::set< common::ranked_symbol< SymbolType > > & tree::PrefixRankedBarTree< SymbolType >::getBars ( ) const &
inline

Getter of the bar set.

Returns
the bar set of the tree
Here is the caller graph for this function:

◆ getContent() [1/2]

template<class SymbolType >
ext::vector< common::ranked_symbol< SymbolType > > && tree::PrefixRankedBarTree< SymbolType >::getContent ( ) &&

Getter of the tree representation.

Returns
List of symbols forming the linear representation of the tree.

◆ getContent() [2/2]

template<class SymbolType >
const ext::vector< common::ranked_symbol< SymbolType > > & tree::PrefixRankedBarTree< SymbolType >::getContent ( ) const &

Getter of the tree representation.

Returns
List of symbols forming the linear representation of the tree.
Here is the caller graph for this function:

◆ isEmpty()

template<class SymbolType >
bool tree::PrefixRankedBarTree< SymbolType >::isEmpty
Returns
true if tree is an empty word (vector length is 0). The method is present to allow compatibility with strings. Tree is never empty in this datatype.

◆ operator string::LinearString< common::ranked_symbol< SymbolType > >()

template<class SymbolType >
tree::PrefixRankedBarTree< SymbolType >::operator string::LinearString< common::ranked_symbol< SymbolType > > ( ) const
inlineexplicit

Creates a new instance of the string from a linear representation of a tree.

Returns
tree casted to string
Here is the call graph for this function:

◆ operator<=>()

template<class SymbolType >
auto tree::PrefixRankedBarTree< SymbolType >::operator<=> ( const PrefixRankedBarTree< SymbolType > &  other) const
inline

The three way comparison implementation

Parameters
otherthe other instance
Returns
the ordering between this object and the other.
Here is the call graph for this function:

◆ operator==()

template<class SymbolType >
bool tree::PrefixRankedBarTree< SymbolType >::operator== ( const PrefixRankedBarTree< SymbolType > &  other) const
inline

The equality comparison implementation.

Parameters
otherthe other object to compare with.
Returns
true if this and other objects are equal, false othervise
Here is the call graph for this function:

◆ setContent()

template<class SymbolType >
void tree::PrefixRankedBarTree< SymbolType >::setContent ( ext::vector< common::ranked_symbol< SymbolType > >  data)

Setter of the representation of the tree.

Exceptions
TreeExceptionwhen new tree representation is not valid or when symbol of the representation are not present in the alphabet
Parameters
datanew List of symbols forming the representation of the tree.
Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

template<class SymbolType >
ext::ostream & operator<< ( ext::ostream out,
const PrefixRankedBarTree< SymbolType > &  instance 
)
friend

Print this object as raw representation to ostream.

Parameters
outostream where to print
instanceobject to print
Returns
modified output stream

The documentation for this class was generated from the following file: