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

#include <UnboundedRegExpElement.h>

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

Data Structures

class  RvalueVisitor
 
class  RvalueVisitorContext
 
class  Visitor
 
class  VisitorContext
 

Public Member Functions

virtual UnboundedRegExpElement< SymbolType > * clone () const &=0
 
virtual UnboundedRegExpElement< 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 ext::smart_ptr< FormalRegExpElement< SymbolType > > asFormal () 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< UnboundedRegExpElement< 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 UnboundedRegExpElement< 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 UnboundedRegExpElement< 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< UnboundedRegExpElement< 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...
 
UnboundedRegExpElement< SymbolType > * getParent ()
 Getter of the parent of the node. More...
 
const UnboundedRegExpElement< SymbolType > * getParent () const
 Getter of the parent of the node. More...
 

Protected Member Functions

virtual void accept (UnboundedRegExpElement::Visitor &visitor) const &=0
 Accept method of the visitor pattern. This is where the actual type of this object is evaluated. More...
 
virtual void accept (UnboundedRegExpElement::RvalueVisitor &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 UnboundedRegExpElement< SymbolType > &instance)
 

Detailed Description

template<class SymbolType>
class regexp::UnboundedRegExpElement< SymbolType >

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

Template Parameters
SymbolTypeused for the terminal alphabet

Member Function Documentation

◆ accept() [1/4]

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

◆ accept() [2/4]

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

◆ accept() [3/4]

template<class SymbolType >
virtual void regexp::UnboundedRegExpElement< SymbolType >::accept ( UnboundedRegExpElement< SymbolType >::RvalueVisitor 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() [4/4]

template<class SymbolType >
virtual void regexp::UnboundedRegExpElement< SymbolType >::accept ( UnboundedRegExpElement< 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:

◆ asFormal()

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

Creates copy of the element.

Returns
copy of the element

◆ checkAlphabet()

template<class SymbolType >
virtual bool regexp::UnboundedRegExpElement< 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
alphabetalphabet to check against
Returns
true if symbols in the regexp are in the alphabet, false otherwise

◆ clone() [1/2]

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

◆ clone() [2/2]

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

◆ computeMinimalAlphabet() [1/2]

template<class SymbolType >
ext::set< SymbolType > UnboundedRegExpElement::computeMinimalAlphabet

Traverses the regexp tree and constructs the minimal alphabet of symbols used in the expression

Returns
the minimal alphabet
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::UnboundedRegExpElement< 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< UnboundedRegExpElement< DefaultSymbolType > > regexp::UnboundedRegExpElement< 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::UnboundedRegExpElement< SymbolType >::operator<=> ( const UnboundedRegExpElement< 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::UnboundedRegExpElement< SymbolType >::operator== ( const UnboundedRegExpElement< 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::UnboundedRegExpElement< 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::UnboundedRegExpElement< 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 UnboundedRegExpElement< 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: