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

Tree structure represented in its natural representation. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer. More...

#include <RankedTree.h>

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

Public Member Functions

 RankedTree (ext::set< common::ranked_symbol< SymbolType > > alphabet, ext::tree< common::ranked_symbol< SymbolType > > tree)
 Creates a new instance of the tree with concrete alphabet and content. More...
 
 RankedTree (ext::tree< common::ranked_symbol< SymbolType > > tree)
 Creates a new instance of the tree based on the content, the alphabet is implicitly created from the content. More...
 
 RankedTree (const UnrankedTree< SymbolType > &other)
 Creates a new instance of the tree based on UnrankedTree, the alphabet is created from the content of the UnrankedTree. The alphabet is created since ranks cannot be deduced. More...
 
 RankedTree (const PostfixRankedTree< SymbolType > &other)
 Creates a new instance of the tree based on the PostfixRankedTree. The natural representation is recreated from postfix representation. More...
 
 RankedTree (const PrefixRankedTree< SymbolType > &other)
 Creates a new instance of the tree based on the PrefixRankedTree. The natural representation is recreated from prefix representation. 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::tree< common::ranked_symbol< SymbolType > > & getContent () const &
 
ext::tree< common::ranked_symbol< SymbolType > > && getContent () &&
 
void setTree (ext::tree< common::ranked_symbol< SymbolType > > tree)
 
auto operator<=> (const RankedTree &other) const
 
bool operator== (const RankedTree &other) const
 
void nicePrint (ext::ostream &os) const
 
- Public Member Functions inherited from core::Components< RankedTree< SymbolType >, ext::set< common::ranked_symbol< SymbolType > >, component::Set, GeneralAlphabet >
void accessComponent ()
 

Friends

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

Additional Inherited Members

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

Detailed Description

template<class SymbolType>
class tree::RankedTree< SymbolType >

Tree structure represented in its natural representation. The representation is so called ranked, therefore it consists of ranked symbols. The rank of the ranked symbol needs to be compatible with unsigned integer.

T = (A, C), A (Alphabet) = finite set of ranked symbols, C (Content) = tree in its natural representation

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol

Constructor & Destructor Documentation

◆ RankedTree() [1/5]

template<class SymbolType >
tree::RankedTree< SymbolType >::RankedTree ( ext::set< common::ranked_symbol< SymbolType > >  alphabet,
ext::tree< common::ranked_symbol< SymbolType > >  tree 
)
explicit

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

Parameters
alphabetthe initial alphabet of the tree
treethe initial tree in its natural representation

◆ RankedTree() [2/5]

template<class SymbolType >
tree::RankedTree< SymbolType >::RankedTree ( ext::tree< common::ranked_symbol< SymbolType > >  tree)
explicit

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

Parameters
treethe initial tree in its natural representation

◆ RankedTree() [3/5]

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

Creates a new instance of the tree based on UnrankedTree, the alphabet is created from the content of the UnrankedTree. The alphabet is created since ranks cannot be deduced.

Parameters
otherthe tree represented as UnrankedTree

◆ RankedTree() [4/5]

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

Creates a new instance of the tree based on the PostfixRankedTree. The natural representation is recreated from postfix representation.

Parameters
otherPostfixRankedTree representation of a tree.

◆ RankedTree() [5/5]

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

Creates a new instance of the tree based on the PrefixRankedTree. The natural representation is recreated from prefix representation.

Parameters
otherPrefixRankedTree representation of a tree.

Member Function Documentation

◆ extendAlphabet()

template<class SymbolType >
void tree::RankedTree< 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

◆ getAlphabet() [1/2]

template<class SymbolType >
ext::set< common::ranked_symbol< SymbolType > > && tree::RankedTree< 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::RankedTree< SymbolType >::getAlphabet ( ) const &
inline

Getter of the alphabet.

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

◆ getContent() [1/2]

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

Getter of the tree representation.

Returns
the natural representation of the tree.

◆ getContent() [2/2]

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

Getter of the tree representation.

Returns
the natural representation of the tree.
Here is the caller graph for this function:

◆ nicePrint()

template<class SymbolType >
void tree::RankedTree< SymbolType >::nicePrint ( ext::ostream os) const

Hierarchical printer of the tree.

Parameters
osthe output stream destination of the print
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<=>()

template<class SymbolType >
auto tree::RankedTree< SymbolType >::operator<=> ( const RankedTree< 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::RankedTree< SymbolType >::operator== ( const RankedTree< 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:

◆ setTree()

template<class SymbolType >
void tree::RankedTree< SymbolType >::setTree ( ext::tree< common::ranked_symbol< SymbolType > >  tree)

Setter of the representation of the tree.

Exceptions
TreeExceptionin same situations as checkAlphabet and checkArities
Parameters
treenew representation of the tree.

Friends And Related Function Documentation

◆ operator<<

template<class SymbolType >
ext::ostream & operator<< ( ext::ostream out,
const RankedTree< 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: