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

Nonlinear 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 be to compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree and nonlinear variables each to represent same subtree (in the particular occurrence in a tree). To match the wildcard and nonlinear variable, special bar symbol called variables bar is present as well. More...

#include <PrefixRankedBarNonlinearPattern.h>

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

Public Member Functions

 PrefixRankedBarNonlinearPattern (ext::set< common::ranked_symbol< SymbolType > > bars, common::ranked_symbol< SymbolType > variablesBar, common::ranked_symbol< SymbolType > subtreeWildcard, ext::set< common::ranked_symbol< SymbolType > > nonlinearVariables, 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, nonlinear variables, and variables bar. More...
 
 PrefixRankedBarNonlinearPattern (ext::set< common::ranked_symbol< SymbolType > > bars, common::ranked_symbol< SymbolType > variablesBar, common::ranked_symbol< SymbolType > subtreeWildcard, ext::set< common::ranked_symbol< SymbolType > > nonlinearVariables, ext::vector< common::ranked_symbol< SymbolType > > data)
 Creates a new instance of the pattern with concrete bars, content, wildcard, nonlinear variables, and variables bar. The alphabet is deduced from the content. More...
 
 PrefixRankedBarNonlinearPattern (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. Nonlinear variables are defaultly constructed to empty set. More...
 
 PrefixRankedBarNonlinearPattern (SymbolType barBase, common::ranked_symbol< SymbolType > variablesBar, const RankedTree< SymbolType > &tree)
 Creates a new instance of the pattern based on the RankedTree. 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. The subtree wildcard is defaultly constructed and nonlinear variables are defaultly constructed to empty set. More...
 
 PrefixRankedBarNonlinearPattern (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. The subtree wildcard is provided by the pattern parameter and nonlinear variables are defaultly constructed to empty set. More...
 
 PrefixRankedBarNonlinearPattern (SymbolType barBase, common::ranked_symbol< SymbolType > variablesBar, const RankedNonlinearPattern< SymbolType > &tree)
 Creates a new instance of the pattern based on the RankedNonlinearPattern. 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. The subtree wildcard and nonlinear variables are provided by the pattern parameter. More...
 
 PrefixRankedBarNonlinearPattern (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, subtree wildcard are defaultly constructed and nonlinear variables are defaultly constructed to empty set. More...
 
 PrefixRankedBarNonlinearPattern (const PrefixRankedBarPattern< SymbolType > &tree)
 Creates a new instance of the pattern based on the PrefixRankedBarPattern. The linear representation is copied from tree. Subtree wildcard, variables bar, bars, and alphabet as well. Nonlinear variables are defaultly constructed to empty set. More...
 
 PrefixRankedBarNonlinearPattern (const RankedTree< SymbolType > &tree)
 Creates a new instance of the pattern based on the RankedTree. 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. Subtree wildcard and variables bar are defaultly constructed. Nonlinear variables are defaultly constructed to empty set. More...
 
 PrefixRankedBarNonlinearPattern (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. Subtree wildcard is copied from the pattern. Variables bar is defaultly constructed. Nonlinear variables are defaultly constructed to empty set. More...
 
 PrefixRankedBarNonlinearPattern (const RankedNonlinearPattern< SymbolType > &tree)
 Creates a new instance of the pattern based on the NonlinearRankedPattern. 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. Subtree wildcard and nonlinear variables are copied from the pattern. 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 ext::set< common::ranked_symbol< SymbolType > > & getNonlinearVariables () const &
 
ext::set< common::ranked_symbol< SymbolType > > && getNonlinearVariables () &&
 
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 PrefixRankedBarNonlinearPattern &other) const
 
bool operator== (const PrefixRankedBarNonlinearPattern &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< PrefixRankedBarNonlinearPattern< SymbolType >, ext::set< common::ranked_symbol< SymbolType > >, component::Set, std::tuple< GeneralAlphabet, NonlinearAlphabet, BarSymbols >, common::ranked_symbol< SymbolType >, component::Value, std::tuple< SubtreeWildcard, VariablesBarSymbol > >
void accessComponent ()
 

Friends

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

Additional Inherited Members

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

Detailed Description

template<class SymbolType>
class tree::PrefixRankedBarNonlinearPattern< SymbolType >

Nonlinear 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 be to compatible with unsigned integer. Additionally the pattern contains a special wildcard symbol representing any subtree and nonlinear variables each to represent same subtree (in the particular occurrence in a tree). To match the wildcard and nonlinear variable, 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 ), V \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 V (Variables) = finite set of special symbols each representing same subtree Wb (VariablesBar) = special bar symbol to match wildcard

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol

Constructor & Destructor Documentation

◆ PrefixRankedBarNonlinearPattern() [1/11]

template<class SymbolType >
tree::PrefixRankedBarNonlinearPattern< SymbolType >::PrefixRankedBarNonlinearPattern ( ext::set< common::ranked_symbol< SymbolType > >  bars,
common::ranked_symbol< SymbolType >  variablesBar,
common::ranked_symbol< SymbolType >  subtreeWildcard,
ext::set< common::ranked_symbol< SymbolType > >  nonlinearVariables,
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, nonlinear variables, and variables bar.

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

◆ PrefixRankedBarNonlinearPattern() [2/11]

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

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

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

◆ PrefixRankedBarNonlinearPattern() [3/11]

template<class SymbolType >
tree::PrefixRankedBarNonlinearPattern< SymbolType >::PrefixRankedBarNonlinearPattern ( 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. Nonlinear variables are defaultly constructed to empty set.

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

◆ PrefixRankedBarNonlinearPattern() [4/11]

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

Creates a new instance of the pattern based on the RankedTree. 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. The subtree wildcard is defaultly constructed and nonlinear variables are defaultly constructed to empty set.

Parameters
barBasethe symbol part of all bars
variablesBarthe initial variables bar
treerepresentation of a tree.

◆ PrefixRankedBarNonlinearPattern() [5/11]

template<class SymbolType >
tree::PrefixRankedBarNonlinearPattern< SymbolType >::PrefixRankedBarNonlinearPattern ( 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. The subtree wildcard is provided by the pattern parameter and nonlinear variables are defaultly constructed to empty set.

Parameters
barBasethe symbol part of all bars
variablesBarthe initial variables bar
treerepresentation of a pattern.

◆ PrefixRankedBarNonlinearPattern() [6/11]

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

Creates a new instance of the pattern based on the RankedNonlinearPattern. 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. The subtree wildcard and nonlinear variables are provided by the pattern parameter.

Parameters
barBasethe symbol part of all bars
variablesBarthe initial variables bar
treerepresentation of a pattern.

◆ PrefixRankedBarNonlinearPattern() [7/11]

template<class SymbolType >
tree::PrefixRankedBarNonlinearPattern< SymbolType >::PrefixRankedBarNonlinearPattern ( 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, subtree wildcard are defaultly constructed and nonlinear variables are defaultly constructed to empty set.

Parameters
treerepresentation of a tree.

◆ PrefixRankedBarNonlinearPattern() [8/11]

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

Creates a new instance of the pattern based on the PrefixRankedBarPattern. The linear representation is copied from tree. Subtree wildcard, variables bar, bars, and alphabet as well. Nonlinear variables are defaultly constructed to empty set.

Parameters
treerepresentation of a tree.

◆ PrefixRankedBarNonlinearPattern() [9/11]

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

Creates a new instance of the pattern based on the RankedTree. 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. Subtree wildcard and variables bar are defaultly constructed. Nonlinear variables are defaultly constructed to empty set.

Parameters
treeRankedTree representation of a tree.

◆ PrefixRankedBarNonlinearPattern() [10/11]

template<class SymbolType >
tree::PrefixRankedBarNonlinearPattern< SymbolType >::PrefixRankedBarNonlinearPattern ( 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. Subtree wildcard is copied from the pattern. Variables bar is defaultly constructed. Nonlinear variables are defaultly constructed to empty set.

Parameters
treeRankedTree representation of a tree.

◆ PrefixRankedBarNonlinearPattern() [11/11]

template<class SymbolType >
tree::PrefixRankedBarNonlinearPattern< SymbolType >::PrefixRankedBarNonlinearPattern ( const RankedNonlinearPattern< SymbolType > &  tree)
explicit

Creates a new instance of the pattern based on the NonlinearRankedPattern. 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. Subtree wildcard and nonlinear variables are copied from the pattern. Variables bar is defaultly constructed.

Parameters
treeRankedTree representation of a tree.

Member Function Documentation

◆ extendAlphabet()

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

◆ getNonlinearVariables() [1/2]

template<class SymbolType >
ext::set< common::ranked_symbol< SymbolType > > && tree::PrefixRankedBarNonlinearPattern< SymbolType >::getNonlinearVariables ( ) &&
inline

Getter of the nonlinear variables.

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

◆ getNonlinearVariables() [2/2]

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

Getter of the nonlinear variables.

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

◆ getSubtreeWildcard() [1/2]

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