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

#include <FormalRegExpElement.h>

Inheritance diagram for regexp::FormalRegExpElement< SymbolType >:
[legend]
Collaboration diagram for regexp::FormalRegExpElement< SymbolType >:
[legend]

Data Structures

class  Visitor
 
class  VisitorContext
 

Public Member Functions

virtual FormalRegExpElement< SymbolType > * clone () const &=0
 
virtual FormalRegExpElement< SymbolType > * clone () &&=0
 
template<class ReturnType , class Visitor , class ... Params>
ReturnType accept (Params &&... params) const
 
virtual ext::smart_ptr< UnboundedRegExpElement< SymbolType > > asUnbounded () const =0
 
virtual bool testSymbol (const SymbolType &symbol) const =0
 
virtual void computeMinimalAlphabet (ext::set< SymbolType > &alphabet) const =0
 
virtual bool checkAlphabet (const ext::set< SymbolType > &alphabet) const =0
 
ext::set< SymbolType > computeMinimalAlphabet () const
 
virtual ext::smart_ptr< FormalRegExpElement< DefaultSymbolType > > normalize () &&=0
 Traverses the regexp tree and normalizes the symbols to DefaultSymbolType. More...
 
virtual void operator>> (ext::ostream &) const =0
 
virtual std::strong_ordering operator<=> (const FormalRegExpElement< 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 FormalRegExpElement< 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< FormalRegExpElement< 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...
 
FormalRegExpElement< SymbolType > * getParent ()
 Getter of the parent of the node. More...
 
const FormalRegExpElement< SymbolType > * getParent () const
 Getter of the parent of the node. More...
 

Protected Member Functions

virtual void accept (FormalRegExpElement::Visitor &visitor) const =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 FormalRegExpElement< SymbolType > &instance)
 

Detailed Description

template<class SymbolType>
class regexp::FormalRegExpElement< SymbolType >

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

Template Parameters
SymbolTypeused for the terminal alphabet

Member Function Documentation

◆ accept() [1/2]

template<class SymbolType >
virtual void regexp::FormalRegExpElement< SymbolType >::accept ( FormalRegExpElement< SymbolType >::Visitor 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/2]

template<class SymbolType >
template<class ReturnType , class Visitor , class ... Params>
ReturnType regexp::FormalRegExpElement< 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:

◆ asUnbounded()

template<class SymbolType >
virtual ext::smart_ptr< UnboundedRegExpElement< SymbolType > > regexp::FormalRegExpElement< SymbolType >::asUnbounded ( ) const
pure virtual

Creates copy of the element.

Returns
copy of the element

◆ checkAlphabet()

template<class SymbolType >
virtual bool regexp::FormalRegExpElement< SymbolType >::checkAlphabet ( const ext::set< SymbolType > &  alphabet) const
pure virtual

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

Parameters
alphabet
Returns
true if symbols in the regexp are in the alphabet, false otherwise

◆ clone() [1/2]

template<class SymbolType >
virtual FormalRegExpElement< SymbolType > * regexp::FormalRegExpElement< SymbolType >::clone ( ) &&
pure virtual

◆ clone() [2/2]

template<class SymbolType >
virtual FormalRegExpElement< SymbolType > * regexp::FormalRegExpElement< SymbolType >::clone ( ) const &
pure virtual

◆ computeMinimalAlphabet() [1/2]

template<class SymbolType >
ext::set< SymbolType > regexp::FormalRegExpElement< SymbolType >::computeMinimalAlphabet

Traverses the regexp tree computing minimal alphabet needed by regexp

Returns
the minimal alphabet needed by the regexp
Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeMinimalAlphabet() [2/2]

template<class SymbolType >
virtual void regexp::FormalRegExpElement< SymbolType >::computeMinimalAlphabet ( ext::set< SymbolType > &  alphabet) const
pure virtual

Traverses the regexp tree computing minimal alphabet needed by regexp

Parameters
alphabetAll alphabet symbols encountered are added into this set

◆ normalize()

template<class SymbolType >
virtual ext::smart_ptr< FormalRegExpElement< DefaultSymbolType > > regexp::FormalRegExpElement< SymbolType >::normalize ( ) &&
pure virtual

Traverses the regexp 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 regexp::FormalRegExpElement< SymbolType >::operator<=> ( const FormalRegExpElement< 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 regexp::FormalRegExpElement< SymbolType >::operator== ( const FormalRegExpElement< 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 regexp::FormalRegExpElement< 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 regexp::FormalRegExpElement< SymbolType >::testSymbol ( const SymbolType &  symbol) const
pure virtual

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

Parameters
symbolto test if used in regexp 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 FormalRegExpElement< 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: