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

Tree pattern 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. Additionally the pattern contains a special wildcard symbol representing any subtree. To match the wildcard, special bar symbol called variables bar is present as well. More...

#include <PrefixRankedBarPattern.h>

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

Public Member Functions

 PrefixRankedBarPattern (ext::set< common::ranked_symbol< SymbolType > > bars, common::ranked_symbol< SymbolType > variablesBar, common::ranked_symbol< SymbolType > subtreeWildcard, ext::set< common::ranked_symbol< SymbolType > > alphabet, ext::vector< common::ranked_symbol< SymbolType > > data)
 Creates a new instance of the pattern with concrete alphabet, bars, content, wildcard, and variables bar. More...
 
 PrefixRankedBarPattern (ext::set< common::ranked_symbol< SymbolType > > bars, common::ranked_symbol< SymbolType > variablesBar, common::ranked_symbol< SymbolType > subtreeWildcard, ext::vector< common::ranked_symbol< SymbolType > > data)
 Creates a new instance of the pattern with concrete bars, content, wildcard, and variables bar. The alphabet is deduced from the content. More...
 
 PrefixRankedBarPattern (SymbolType barBase, common::ranked_symbol< SymbolType > variablesBar, const RankedPattern< SymbolType > &tree)
 Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars and variables bar are provided as parameters. More...
 
 PrefixRankedBarPattern (const PrefixRankedBarTree< SymbolType > &tree)
 Creates a new instance of the pattern based on the PrefixRankedBarTree. The linear representation is copied from tree. Bars and alphabet as well. Variables bar and subtree wildcard are defaultly constructed. More...
 
 PrefixRankedBarPattern (const RankedPattern< SymbolType > &tree)
 Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Bars are computed to match symbols used in the representation from RankedPattern and variables bar is defaultly constructed. 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 common::ranked_symbol< SymbolType > & getSubtreeWildcard () const &
 
common::ranked_symbol< SymbolType > && getSubtreeWildcard () &&
 
const common::ranked_symbol< SymbolType > & getVariablesBar () const &
 
common::ranked_symbol< SymbolType > && getVariablesBar () &&
 
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 PrefixRankedBarPattern &other) const
 
bool operator== (const PrefixRankedBarPattern &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< PrefixRankedBarPattern< SymbolType >, ext::set< common::ranked_symbol< SymbolType > >, component::Set, std::tuple< GeneralAlphabet, BarSymbols >, common::ranked_symbol< SymbolType >, component::Value, std::tuple< SubtreeWildcard, VariablesBarSymbol > >
void accessComponent ()
 

Friends

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

Additional Inherited Members

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

Detailed Description

template<class SymbolType>
class tree::PrefixRankedBarPattern< SymbolType >

Tree pattern 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. Additionally the pattern contains a special wildcard symbol representing any subtree. To match the wildcard, special bar symbol called variables bar is present as well.

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

T = (A, B \subset A, C, W \in ( A \minus B ), Wb \in B ), A (Alphabet) = finite set of ranked symbols, B (Bars) = finite set of ranked symbols representing bars, C (Content) = linear representation of the pattern content W (Wildcard) = special symbol representing any subtree Wb (VariablesBar) = special bar symbol to match wildcard

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol

Constructor & Destructor Documentation

◆ PrefixRankedBarPattern() [1/5]

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

Creates a new instance of the pattern with concrete alphabet, bars, content, wildcard, and variables bar.

Parameters
barsthe initial bar set
variablesBarthe initial variables bar
subtreeWildcardthe wildcard symbol
alphabetthe initial alphabet of the pattern
datathe initial pattern in linear representation

◆ PrefixRankedBarPattern() [2/5]

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

Creates a new instance of the pattern with concrete bars, content, wildcard, and variables bar. The alphabet is deduced from the content.

Parameters
barsthe initial bar set
variablesBarthe initial variables bar
subtreeWildcardthe wildcard symbol
datathe initial pattern in linear representation

◆ PrefixRankedBarPattern() [3/5]

template<class SymbolType >
tree::PrefixRankedBarPattern< SymbolType >::PrefixRankedBarPattern ( SymbolType  barBase,
common::ranked_symbol< SymbolType >  variablesBar,
const RankedPattern< SymbolType > &  tree 
)
explicit

Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Symbol part of bars and variables bar are provided as parameters.

Parameters
barBasethe symbol part of all bars
variablesBarthe bar to match the subtree wildcard
treerepresentation of a pattern.

◆ PrefixRankedBarPattern() [4/5]

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

Creates a new instance of the pattern based on the PrefixRankedBarTree. The linear representation is copied from tree. Bars and alphabet as well. Variables bar and subtree wildcard are defaultly constructed.

Parameters
treerepresentation of a tree.

◆ PrefixRankedBarPattern() [5/5]

template<class SymbolType >
tree::PrefixRankedBarPattern< SymbolType >::PrefixRankedBarPattern ( const RankedPattern< SymbolType > &  tree)
explicit

Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed (including bars) by preorder traversal on the tree parameter. Bars are computed to match symbols used in the representation from RankedPattern and variables bar is defaultly constructed.

Parameters
treeRankedTree representation of a tree.

Member Function Documentation

◆ extendAlphabet()

template<class SymbolType >
void tree::PrefixRankedBarPattern< 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::PrefixRankedBarPattern< 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::PrefixRankedBarPattern< SymbolType >::getAlphabet ( ) &&
inline

Getter of the alphabet.

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

◆ getAlphabet() [2/2]

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

Getter of the alphabet.

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

◆ getBars() [1/2]

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

Getter of the bar set.

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

◆ getBars() [2/2]

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

Getter of the bar set.

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

◆ getContent() [1/2]

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

Getter of the pattern representation.

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

◆ getContent() [2/2]

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

Getter of the pattern representation.

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

◆ getSubtreeWildcard() [1/2]

template<class SymbolType >
common::ranked_symbol< SymbolType > && tree::PrefixRankedBarPattern< SymbolType >::getSubtreeWildcard ( ) &&
inline

Getter of the wildcard symbol.

Returns
the wildcard symbol of the pattern
Here is the call graph for this function:

◆ getSubtreeWildcard() [2/2]

template<class SymbolType >
const common::ranked_symbol< SymbolType > & tree::PrefixRankedBarPattern< SymbolType >::getSubtreeWildcard ( ) const &
inline

Getter of the wildcard symbol.

Returns
the wildcard symbol of the pattern
Here is the caller graph for this function:

◆ getVariablesBar() [1/2]

template<class SymbolType >
common::ranked_symbol< SymbolType > && tree::PrefixRankedBarPattern< SymbolType >::getVariablesBar ( ) &&
inline

Getter of the variables bar.

Returns
the variables bar of the pattern
Here is the call graph for this function:

◆ getVariablesBar() [2/2]

template<class SymbolType >
const common::ranked_symbol< SymbolType > & tree::PrefixRankedBarPattern< SymbolType >::getVariablesBar ( ) const &
inline

Getter of the variables bar.

Returns
the variables bar of the pattern
Here is the caller graph for this function:

◆ isEmpty()

template<class SymbolType >
bool tree::PrefixRankedBarPattern< SymbolType >::isEmpty
Returns
true if pattern 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::PrefixRankedBarPattern< 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::PrefixRankedBarPattern< SymbolType >::operator<=> ( const PrefixRankedBarPattern< 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::PrefixRankedBarPattern< SymbolType >::operator== ( const PrefixRankedBarPattern< 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::PrefixRankedBarPattern< SymbolType >::setContent ( ext::vector< common::ranked_symbol< SymbolType > >  data)

Setter of the representation of the pattern.

Exceptions
TreeExceptionwhen new pattern 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 pattern.
Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

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