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

Nonlinear tree pattern represented as linear sequece as result of preorder 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. 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). More...

#include <PrefixRankedNonlinearPattern.h>

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

Public Member Functions

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

Friends

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

Additional Inherited Members

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

Detailed Description

template<class SymbolType>
class tree::PrefixRankedNonlinearPattern< SymbolType >

Nonlinear tree pattern represented as linear sequece as result of preorder 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. 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).

T = (A, C, W \in A, V \in A ), A (Alphabet) = finite set of ranked symbols, 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

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol

Constructor & Destructor Documentation

◆ PrefixRankedNonlinearPattern() [1/8]

template<class SymbolType >
tree::PrefixRankedNonlinearPattern< SymbolType >::PrefixRankedNonlinearPattern ( 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, content, wildcard, and nonlinear variables.

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

◆ PrefixRankedNonlinearPattern() [2/8]

template<class SymbolType >
tree::PrefixRankedNonlinearPattern< SymbolType >::PrefixRankedNonlinearPattern ( 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 content, wildcard, and nonlinear variables. The alphabet is deduced from the content.

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

◆ PrefixRankedNonlinearPattern() [3/8]

template<class SymbolType >
tree::PrefixRankedNonlinearPattern< SymbolType >::PrefixRankedNonlinearPattern ( common::ranked_symbol< SymbolType >  subtreeWildcard,
ext::vector< common::ranked_symbol< SymbolType > >  data 
)
explicit

Creates a new instance of the pattern with concrete content and wildcard. The alphabet is deduced from the content. Nonlinear variables are defaultly constructed to empty set.

Parameters
subtreeWildcardthe wildcard symbol
datathe initial pattern in linear representation

◆ PrefixRankedNonlinearPattern() [4/8]

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

Creates a new instance of the pattern based on the PrefixRankedTree. The linear representation is copied from tree. Alphabet as well. subtree wildcard is defaultly constructed and nonlinear variables are defaultly constructed to empty set.

Parameters
treerepresentation of a tree.

◆ PrefixRankedNonlinearPattern() [5/8]

template<class SymbolType >
tree::PrefixRankedNonlinearPattern< SymbolType >::PrefixRankedNonlinearPattern ( const PrefixRankedPattern< SymbolType > &  tree)
explicit

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

Parameters
treerepresentation of a tree.

◆ PrefixRankedNonlinearPattern() [6/8]

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

Creates a new instance of the pattern based on the RankedTree. The linear representation is constructed by preorder traversal on the tree parameter. The subtree wildcard is defaultly constructed and nonlinear variables are defaultly constructed to empty set.

Parameters
treerepresentation of a tree.

◆ PrefixRankedNonlinearPattern() [7/8]

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

Creates a new instance of the pattern based on the RankedPattern. The linear representation is constructed by preorder traversal on the tree parameter. The subtree wildcard is provided by the pattern parameter and nonlinear variables are defaultly constructed to empty set.

Parameters
treerepresentation of a pattern.

◆ PrefixRankedNonlinearPattern() [8/8]

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

Creates a new instance of the pattern based on the RankedNonlinearPattern. The linear representation is constructed by preorder traversal on the tree parameter. The subtree wildcard and nonlinear variables are provided by the pattern parameter.

Parameters
treerepresentation of a pattern.

Member Function Documentation

◆ extendAlphabet()

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

Getter of the alphabet.

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

◆ getContent() [1/2]

template<class SymbolType >
ext::vector< common::ranked_symbol< SymbolType > > && tree::PrefixRankedNonlinearPattern< 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::PrefixRankedNonlinearPattern< 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::PrefixRankedNonlinearPattern< 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::PrefixRankedNonlinearPattern< 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::PrefixRankedNonlinearPattern< 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::PrefixRankedNonlinearPattern< SymbolType >::getSubtreeWildcard ( ) const &
inline

Getter of the wildcard symbol.

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

◆ isEmpty()

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