Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Public Member Functions
rte::FormalRTEAlternation< SymbolType > Class Template Reference

Represents the alternation operator in the regular tree expression. The node must have exactly two children. More...

#include <FormalRTEAlternation.h>

Inheritance diagram for rte::FormalRTEAlternation< SymbolType >:
[legend]
Collaboration diagram for rte::FormalRTEAlternation< SymbolType >:
[legend]

Public Member Functions

 FormalRTEAlternation (FormalRTEElement< SymbolType > &&left, FormalRTEElement< SymbolType > &&right)
 Creates a new instance of the alternation node with explicit alternated elements. More...
 
 FormalRTEAlternation (const FormalRTEElement< SymbolType > &left, const FormalRTEElement< SymbolType > &right)
 Creates a new instance of the alternation node with explicit alternated elements. More...
 
FormalRTEAlternation< SymbolType > * clone () const &override
 ( ) const & More...
 
FormalRTEAlternation< SymbolType > * clone () &&override
 ( ) && More...
 
bool testSymbol (const common::ranked_symbol< SymbolType > &symbol) const override
 ( const common::ranked_symbol < SymbolType > & ) const More...
 
void computeMinimalAlphabet (ext::set< common::ranked_symbol< SymbolType > > &alphabetF, ext::set< common::ranked_symbol< SymbolType > > &alphabetK) const override
 ( ext::set < common::ranked_symbol < SymbolType > > &, ext::set < common::ranked_symbol < SymbolType > > & ) const More...
 
bool checkAlphabet (const ext::set< common::ranked_symbol< SymbolType > > &alphabetF, const ext::set< common::ranked_symbol< SymbolType > > &alphabetK) const override
 ( const ext::set < common::ranked_symbol < SymbolType > > &, const ext::set < common::ranked_symbol < SymbolType > > & ) const More...
 
const FormalRTEElement< SymbolType > & getLeftElement () const
 
const FormalRTEElement< SymbolType > & getRightElement () const
 
FormalRTEElement< SymbolType > & getLeftElement ()
 
FormalRTEElement< SymbolType > & getRightElement ()
 
void setLeftElement (FormalRTEElement< SymbolType > &&element)
 
void setLeftElement (const FormalRTEElement< SymbolType > &element)
 
void setRightElement (FormalRTEElement< SymbolType > &&element)
 
void setRightElement (const FormalRTEElement< SymbolType > &element)
 
std::strong_ordering operator<=> (const FormalRTEElement< SymbolType > &other) const override
 < SymbolType >::operator <=> ( const FormalRTEElement < SymbolType > & other ) const; More...
 
std::strong_ordering operator<=> (const FormalRTEAlternation< SymbolType > &) const
 
bool operator== (const FormalRTEElement< SymbolType > &other) const override
 < SymbolType >::operator == ( const FormalRTEElement < SymbolType > & other ) const; More...
 
bool operator== (const FormalRTEAlternation< SymbolType > &) const
 
void operator>> (ext::ostream &out) const override
 < SymbolType >::operator == ( const FormalRTEElement < SymbolType > & other ) const; More...
 
ext::smart_ptr< FormalRTEElement< DefaultSymbolType > > normalize () &&override
 < SymbolType >::normalize ( ) && More...
 
- Public Member Functions inherited from ext::BinaryNode< FormalRTEElement< SymbolType > >
 BinaryNode (const FormalRTEElement< SymbolType > &l, const FormalRTEElement< SymbolType > &r)
 Constructor of the class accepting the two child nodes. More...
 
 BinaryNode (FormalRTEElement< SymbolType > &&l, FormalRTEElement< SymbolType > &&r)
 Constructor of the class accepting the two child nodes. More...
 
FormalRTEElement< SymbolType > & getLeft ()
 Getter of the first child of the node. More...
 
const FormalRTEElement< SymbolType > & getLeft () const
 Getter of the first child of the node. More...
 
void setLeft (const FormalRTEElement< SymbolType > &l)
 Setter of the first child of the node. More...
 
void setLeft (FormalRTEElement< SymbolType > &&l)
 Setter of the first child of the node. More...
 
FormalRTEElement< SymbolType > & getRight ()
 Getter of the second child of the node. More...
 
const FormalRTEElement< SymbolType > & getRight () const
 Getter of the second child of the node. More...
 
void setRight (const FormalRTEElement< SymbolType > &r)
 Setter of the second child of the node. More...
 
void setRight (FormalRTEElement< SymbolType > &&r)
 Setter of the second child of the node. More...
 
- Public Member Functions inherited from ext::AnyaryNode< Data, arity, Base >
 AnyaryNode (ext::ptr_array< Data, arity > c)
 Constructor based on array of child nodes. More...
 
 ~AnyaryNode () noexcept override=default
 Destructor of the class. More...
 
 AnyaryNode (const AnyaryNode &other)
 Copy constructor. More...
 
 AnyaryNode (AnyaryNode &&other) noexcept
 Move constructor. More...
 
AnyaryNodeoperator= (const AnyaryNode &other)
 Copy operator of assignment. More...
 
AnyaryNodeoperator= (AnyaryNode &&other) noexcept
 move operator of assignment. More...
 
const ext::ptr_array< Data, arity > & getChildren () &
 Getter of the child nodes. More...
 
const ext::ptr_array< Data, arity > & getChildren () const &
 Getter of the child nodes. More...
 
ext::ptr_array< Data, arity > && getChildren () &&
 Getter of the child nodes. More...
 
template<size_t N>
const Data & getChild () const
 Getter of the child node based on compile time index. More...
 
template<size_t N>
Data & getChild ()
 Getter of the child node based on compile time index. More...
 
void setChildren (ext::ptr_array< Data, arity > c)
 Setter of the child nodes. More...
 
template<size_t N>
void setChild (const Data &d)
 Setter of the child node based on compile time index. More...
 
template<size_t N>
void setChild (Data &&d)
 Setter of the child node based on compile time index. More...
 
ext::ptr_array< Data, arity >::iterator begin ()
 Getter of an iterator to the begining of children array. More...
 
ext::ptr_array< Data, arity >::const_iterator begin () const
 Getter of an iterator to the begining of children array. More...
 
ext::ptr_array< Data, arity >::iterator end ()
 Getter of an iterator to the end of children array. More...
 
ext::ptr_array< Data, arity >::const_iterator end () const
 Getter of an iterator to the end of children array. More...
 

Detailed Description

template<class SymbolType>
class rte::FormalRTEAlternation< SymbolType >

Represents the alternation operator in the regular tree expression. The node must have exactly two children.

The structure is derived from BinaryNode that provides the children accessors.

The node can be visited by the FormalRTEElement < SymbolType >::Visitor

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol

Constructor & Destructor Documentation

◆ FormalRTEAlternation() [1/2]

template<class SymbolType >
rte::FormalRTEAlternation< SymbolType >::FormalRTEAlternation ( FormalRTEElement< SymbolType > &&  left,
FormalRTEElement< SymbolType > &&  right 
)
explicit

Creates a new instance of the alternation node with explicit alternated elements.

Parameters
leftthe first alternated element
rightthe second alternated element

◆ FormalRTEAlternation() [2/2]

template<class SymbolType >
rte::FormalRTEAlternation< SymbolType >::FormalRTEAlternation ( const FormalRTEElement< SymbolType > &  left,
const FormalRTEElement< SymbolType > &  right 
)
explicit

Creates a new instance of the alternation node with explicit alternated elements.

Parameters
leftthe first alternated element
rightthe second alternated element

Member Function Documentation

◆ checkAlphabet()

template<class SymbolType >
bool rte::FormalRTEAlternation< SymbolType >::checkAlphabet ( const ext::set< common::ranked_symbol< SymbolType > > &  alphabetF,
const ext::set< common::ranked_symbol< SymbolType > > &  alphabetK 
) const
override

( const ext::set < common::ranked_symbol < SymbolType > > &, const ext::set < common::ranked_symbol < SymbolType > > & ) const

Traverses the rte tree and checks whether all symbols in the rte tree are in the alphabet

Parameters
alphabetFAll terminal alphabet symbols encountered are added into this set
alphabetKAll substitution alphabet symbols encountered are added into this set
Returns
true if symbols in the rte are in the alphabet, false otherwise ( const ext::set < common::ranked_symbol < SymbolType > > &, const ext::set < common::ranked_symbol < SymbolType > > & ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clone() [1/2]

template<class SymbolType >
FormalRTEAlternation< SymbolType > * rte::FormalRTEAlternation< SymbolType >::clone ( ) &&
override

( ) &&

( ) &&

◆ clone() [2/2]

template<class SymbolType >
FormalRTEAlternation< SymbolType > * rte::FormalRTEAlternation< SymbolType >::clone ( ) const &
override

( ) const &

( ) const &

◆ computeMinimalAlphabet()

template<class SymbolType >
void rte::FormalRTEAlternation< SymbolType >::computeMinimalAlphabet ( ext::set< common::ranked_symbol< SymbolType > > &  alphabetF,
ext::set< common::ranked_symbol< SymbolType > > &  alphabetK 
) const
override

( ext::set < common::ranked_symbol < SymbolType > > &, ext::set < common::ranked_symbol < SymbolType > > & ) const

Traverses the rte tree computing minimal alphabet needed by rte

Parameters
alphabetFAll terminal alphabet symbols encountered are added into this set
alphabetKAll substitution alphabet symbols encountered are added into this set ( ext::set < common::ranked_symbol < SymbolType > > &, ext::set < common::ranked_symbol < SymbolType > > & ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLeftElement() [1/2]

template<class SymbolType >
FormalRTEElement< SymbolType > & rte::FormalRTEAlternation< SymbolType >::getLeftElement

Getter of the left alternated element

Returns
left alternated element

◆ getLeftElement() [2/2]

template<class SymbolType >
const FormalRTEElement< SymbolType > & rte::FormalRTEAlternation< SymbolType >::getLeftElement

Getter of the left alternated element

Returns
left alternated element
Here is the caller graph for this function:

◆ getRightElement() [1/2]

template<class SymbolType >
FormalRTEElement< SymbolType > & rte::FormalRTEAlternation< SymbolType >::getRightElement

Getter of the right alternated element

Returns
right alternated element

◆ getRightElement() [2/2]

template<class SymbolType >
const FormalRTEElement< SymbolType > & rte::FormalRTEAlternation< SymbolType >::getRightElement

Getter of the right alternated element

Returns
right alternated element
Here is the caller graph for this function:

◆ normalize()

template<class SymbolType >
ext::smart_ptr< FormalRTEElement< DefaultSymbolType > > rte::FormalRTEAlternation< SymbolType >::normalize ( ) &&
inlineoverride

< SymbolType >::normalize ( ) &&

Abstract class representing element in the formal regular tree expression. Can be an operator, special node, or a symbol.

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol < SymbolType >::normalize ( ) &&
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator<=>() [1/2]

template<class SymbolType >
std::strong_ordering rte::FormalRTEAlternation< SymbolType >::operator<=> ( const FormalRTEAlternation< SymbolType > &  other) const

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<=>() [2/2]

template<class SymbolType >
std::strong_ordering rte::FormalRTEAlternation< SymbolType >::operator<=> ( const FormalRTEElement< SymbolType > &  other) const
inlineoverride

< SymbolType >::operator <=> ( const FormalRTEElement < SymbolType > & other ) const;

Abstract class representing element in the formal regular tree expression. Can be an operator, special node, or a symbol.

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol < SymbolType >::operator <=> ( const FormalRTEElement < SymbolType > & other ) const;

◆ operator==() [1/2]

template<class SymbolType >
bool rte::FormalRTEAlternation< SymbolType >::operator== ( const FormalRTEAlternation< SymbolType > &  other) const

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:

◆ operator==() [2/2]

template<class SymbolType >
bool rte::FormalRTEAlternation< SymbolType >::operator== ( const FormalRTEElement< SymbolType > &  other) const
inlineoverride

< SymbolType >::operator == ( const FormalRTEElement < SymbolType > & other ) const;

Abstract class representing element in the formal regular tree expression. Can be an operator, special node, or a symbol.

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol < SymbolType >::operator == ( const FormalRTEElement < SymbolType > & other ) const;

◆ operator>>()

template<class SymbolType >
void rte::FormalRTEAlternation< SymbolType >::operator>> ( ext::ostream out) const
override

< SymbolType >::operator == ( const FormalRTEElement < SymbolType > & other ) const;

Abstract class representing element in the formal regular tree expression. Can be an operator, special node, or a symbol.

Template Parameters
SymbolTypeused for the symbol part of the ranked symbol < SymbolType >::operator == ( const FormalRTEElement < SymbolType > & other ) const;

◆ setLeftElement() [1/2]

template<class SymbolType >
void rte::FormalRTEAlternation< SymbolType >::setLeftElement ( const FormalRTEElement< SymbolType > &  element)

Setter of the left alternated element

Parameters
elementleft alternated element
Here is the call graph for this function:

◆ setLeftElement() [2/2]

template<class SymbolType >
void rte::FormalRTEAlternation< SymbolType >::setLeftElement ( FormalRTEElement< SymbolType > &&  element)

Setter of the left alternated element

Parameters
elementleft alternated element

◆ setRightElement() [1/2]

template<class SymbolType >
void rte::FormalRTEAlternation< SymbolType >::setRightElement ( const FormalRTEElement< SymbolType > &  element)

Setter of the right alternated element

Parameters
elementright alternated element
Here is the call graph for this function:

◆ setRightElement() [2/2]

template<class SymbolType >
void rte::FormalRTEAlternation< SymbolType >::setRightElement ( FormalRTEElement< SymbolType > &&  element)

Setter of the right alternated element

Parameters
elementright alternated element

◆ testSymbol()

template<class SymbolType >
bool rte::FormalRTEAlternation< SymbolType >::testSymbol ( const common::ranked_symbol< SymbolType > &  symbol) const
override

( const common::ranked_symbol < SymbolType > & ) const

Traverses the rte tree looking if particular Symbol is used in the rte.

Parameters
symbolto test if used in rte element
Returns
true if symbol is used by the element and its successor ( const common::ranked_symbol < SymbolType > & ) const

The documentation for this class was generated from the following file: