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

Tree structure represented as linear sequece as result of postorder traversal. 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 <PostfixRankedTree.h>

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

Public Member Functions

 PostfixRankedTree (ext::set< common::ranked_symbol< SymbolType > > alphabet, ext::vector< common::ranked_symbol< SymbolType > > data)
 Creates a new instance of the tree with concrete alphabet and content. More...
 
 PostfixRankedTree (ext::vector< common::ranked_symbol< SymbolType > > data)
 Creates a new instance of the tree based on the content, the alphabet is implicitly created from the content. More...
 
 PostfixRankedTree (const RankedTree< SymbolType > &tree)
 Creates a new instance of the tree based on the RankedTree. The linear representation is constructed by postorder traversal on the tree parameter. 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::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 PostfixRankedTree &other) const
 
bool operator== (const PostfixRankedTree &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< PostfixRankedTree< SymbolType >, ext::set< common::ranked_symbol< SymbolType > >, component::Set, GeneralAlphabet >
void accessComponent ()
 

Friends

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

Additional Inherited Members

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

Detailed Description

template<class SymbolType>
class tree::PostfixRankedTree< SymbolType >

Tree structure represented as linear sequece as result of postorder traversal. 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) = linear representation of the tree content

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol

Constructor & Destructor Documentation

◆ PostfixRankedTree() [1/3]

template<class SymbolType >
tree::PostfixRankedTree< SymbolType >::PostfixRankedTree ( 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 and content.

Parameters
alphabetthe initial alphabet of the tree
datathe initial tree in linear representation

◆ PostfixRankedTree() [2/3]

template<class SymbolType >
tree::PostfixRankedTree< SymbolType >::PostfixRankedTree ( ext::vector< common::ranked_symbol< SymbolType > >  data)
explicit

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

Parameters
datathe initial tree in linear representation

◆ PostfixRankedTree() [3/3]

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

Creates a new instance of the tree based on the RankedTree. The linear representation is constructed by postorder traversal on the tree parameter.

Parameters
treeRankedTree representation of a tree.

Member Function Documentation

◆ extendAlphabet()

template<class SymbolType >
void tree::PostfixRankedTree< 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::PostfixRankedTree< 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::PostfixRankedTree< 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::vector< common::ranked_symbol< SymbolType > > && tree::PostfixRankedTree< 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::PostfixRankedTree< 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::PostfixRankedTree< 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::PostfixRankedTree< 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::PostfixRankedTree< SymbolType >::operator<=> ( const PostfixRankedTree< 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::PostfixRankedTree< SymbolType >::operator== ( const PostfixRankedTree< 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::PostfixRankedTree< 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 PostfixRankedTree< 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: