Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Data Structures | Public Member Functions | Protected Member Functions | Friends
rte::FormalRTEElement< SymbolType > Class Template Referenceabstract

#include <FormalRTEElement.h>

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

Data Structures

class  ConstVisitor
 
class  ConstVisitorContext
 
class  Visitor
 
class  VisitorContext
 

Public Member Functions

virtual FormalRTEElement< SymbolType > * clone () const &=0
 
virtual FormalRTEElement< SymbolType > * clone () &&=0
 
template<class ReturnType , class Visitorr , class ... Params>
ReturnType accept (Params &&... params) const
 
template<class ReturnType , class Visitorr , class ... Params>
ReturnType accept (Params &&... params)
 
virtual bool testSymbol (const common::ranked_symbol< SymbolType > &symbol) const =0
 
virtual void computeMinimalAlphabet (ext::set< common::ranked_symbol< SymbolType > > &alphabetF, ext::set< common::ranked_symbol< SymbolType > > &alphabetK) const =0
 
std::pair< ext::set< common::ranked_symbol< SymbolType > >, ext::set< common::ranked_symbol< SymbolType > > > computeMinimalAlphabets () const
 
virtual bool checkAlphabet (const ext::set< common::ranked_symbol< SymbolType > > &alphabetF, const ext::set< common::ranked_symbol< SymbolType > > &alphabetK) const =0
 
virtual ext::smart_ptr< FormalRTEElement< DefaultSymbolType > > normalize () &&=0
 Traverses the rte tree and normalizes the symbols to DefaultSymbolType. More...
 
virtual void operator>> (ext::ostream &) const =0
 
virtual std::strong_ordering operator<=> (const FormalRTEElement< SymbolType > &other) const =0
 Three way comparison helper method evaluating allowing possibly deeper comparison of this with other class of the same hierarchy. More...
 
virtual bool operator== (const FormalRTEElement< SymbolType > &other) const =0
 Comparison helper method evaluating allowing possibly deeper comparison of this with other class of the same hierarchy. More...
 
- Public Member Functions inherited from ext::BaseNode< FormalRTEElement< SymbolType > >
 BaseNode ()
 Constructor of the tree hierarchy base class. More...
 
 BaseNode (const BaseNode &)
 Copy construction does not copy the parent pointer. More...
 
 BaseNode (BaseNode &&) noexcept
 Move construction does not copy the parent pointer. More...
 
virtual ~BaseNode () noexcept=default
 Destructor of the tree hierarchy base class. More...
 
BaseNodeoperator= (const BaseNode &)
 Copy assignment does not change the parent pointer. More...
 
BaseNodeoperator= (BaseNode &&) noexcept
 Move assignment does not change the parent pointer. More...
 
FormalRTEElement< SymbolType > * getParent ()
 Getter of the parent of the node. More...
 
const FormalRTEElement< SymbolType > * getParent () const
 Getter of the parent of the node. More...
 

Protected Member Functions

virtual void accept (FormalRTEElement::ConstVisitor &visitor) const =0
 Accept method of the visitor pattern. This is where the actual type of this object is evaluated. More...
 
virtual void accept (FormalRTEElement::Visitor &visitor)=0
 Accept method of the visitor pattern. This is where the actual type of this object is evaluated. More...
 

Friends

ext::ostreamoperator<< (ext::ostream &os, const FormalRTEElement< SymbolType > &instance)
 

Detailed Description

template<class SymbolType>
class rte::FormalRTEElement< SymbolType >

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

Member Function Documentation

◆ accept() [1/4]

template<class SymbolType >
virtual void rte::FormalRTEElement< SymbolType >::accept ( FormalRTEElement< SymbolType >::ConstVisitor visitor) const
protectedpure virtual

Accept method of the visitor pattern. This is where the actual type of this object is evaluated.

Parameters
visitorthe accepted visitor.
Here is the caller graph for this function:

◆ accept() [2/4]

template<class SymbolType >
virtual void rte::FormalRTEElement< SymbolType >::accept ( FormalRTEElement< SymbolType >::Visitor visitor)
protectedpure virtual

Accept method of the visitor pattern. This is where the actual type of this object is evaluated.

Parameters
visitorthe accepted visitor.

◆ accept() [3/4]

template<class SymbolType >
template<class ReturnType , class Visitorr , class ... Params>
ReturnType rte::FormalRTEElement< SymbolType >::accept ( Params &&...  params)
inline

Visitor interface method.

Template Parameters
ReturnTypethe return type of the result of the visit
Visitorrthe type of the actuall visitor
Params... types of data passed with the visitor call

\params params ... Additional params passed to visited nodes

Returns
result of the visit
Here is the call graph for this function:

◆ accept() [4/4]

template<class SymbolType >
template<class ReturnType , class Visitorr , class ... Params>
ReturnType rte::FormalRTEElement< SymbolType >::accept ( Params &&...  params) const
inline

Visitor interface method.

Template Parameters
ReturnTypethe return type of the result of the visit
Visitorrthe type of the actuall visitor
Params... types of data passed with the visitor call

\params params ... Additional params passed to visited nodes

Returns
result of the visit
Here is the call graph for this function:

◆ checkAlphabet()

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

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

◆ clone() [1/2]

template<class SymbolType >
virtual FormalRTEElement< SymbolType > * rte::FormalRTEElement< SymbolType >::clone ( ) &&
pure virtual

◆ clone() [2/2]

template<class SymbolType >
virtual FormalRTEElement< SymbolType > * rte::FormalRTEElement< SymbolType >::clone ( ) const &
pure virtual

◆ computeMinimalAlphabet()

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

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
Here is the caller graph for this function:

◆ computeMinimalAlphabets()

template<class SymbolType >
std::pair< ext::set< common::ranked_symbol< SymbolType > >, ext::set< common::ranked_symbol< SymbolType > > > FormalRTEElement::computeMinimalAlphabets

Traverses the rte tree computing minimal symbol alphabet and substitution alphabet needed by rte

Returns
the minimal symbol and substitution alphabet needed by the rte
Here is the call graph for this function:

◆ normalize()

template<class SymbolType >
virtual ext::smart_ptr< FormalRTEElement< DefaultSymbolType > > rte::FormalRTEElement< SymbolType >::normalize ( ) &&
pure virtual

Traverses the rte tree and normalizes the symbols to DefaultSymbolType.

Returns
the cloned node including children representing the same content but with type of symbols normalized to DefaultSymbolType

◆ operator<=>()

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

Three way comparison helper method evaluating allowing possibly deeper comparison of this with other class of the same hierarchy.

If the other class is of different type the relative order is computer by means of type_index.

Parameters
otherthe other class to compare with
Returns
the strong ordering between this and other instance.

◆ operator==()

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

Comparison helper method evaluating allowing possibly deeper comparison of this with other class of the same hierarchy.

If the other class is of different type the relative order is computer by means of type_index.

Parameters
otherthe other class to compare with
Returns
true if this is equal to the other instance, false otherwise.

◆ operator>>()

template<class SymbolType >
virtual void rte::FormalRTEElement< SymbolType >::operator>> ( ext::ostream ) const
pure virtual

Print this instance as raw representation to ostream.

Parameters
osostream where to print

◆ testSymbol()

template<class SymbolType >
virtual bool rte::FormalRTEElement< SymbolType >::testSymbol ( const common::ranked_symbol< SymbolType > &  symbol) const
pure virtual

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

Friends And Related Function Documentation

◆ operator<<

template<class SymbolType >
ext::ostream & operator<< ( ext::ostream os,
const FormalRTEElement< SymbolType > &  instance 
)
friend

Print this object as raw representation to ostream.

Parameters
osostream where to print
instanceobject to print
Returns
modified output stream

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