Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Public Member Functions | Friends
string::CyclicString< SymbolType > Class Template Referencefinal

Cyclic string. More...

#include <CyclicString.h>

Inheritance diagram for string::CyclicString< SymbolType >:
[legend]
Collaboration diagram for string::CyclicString< SymbolType >:
[legend]

Public Member Functions

 CyclicString ()
 Creates a new instance of the string with an empty content. More...
 
 CyclicString (ext::set< SymbolType > alphabet, ext::vector< SymbolType > str)
 Creates a new instance of the string with a concrete alphabet and content. More...
 
 CyclicString (ext::vector< SymbolType > str)
 Creates a new instance of the string based on content, the alphabet is implicitly created from the content. More...
 
 CyclicString (const std::string &str)
 Creates a new instance of the string from the standard string. The alphabet is deduced from the content. The constructor expects SymbolType of the string is constructible from char. More...
 
 CyclicString (const char *str)
 Creates a new instance of the string from c-string. The alphabet is deduced from the content. The constructor expects SymbolType of the string is constructible from char. More...
 
const ext::set< SymbolType > & getAlphabet () const &
 
ext::set< SymbolType > && getAlphabet () &&
 
void extendAlphabet (ext::set< SymbolType > symbols)
 
const ext::vector< SymbolType > & getContent () const &
 
ext::vector< SymbolType > && getContent () &&
 
void setContent (ext::vector< SymbolType > str)
 
bool isEmpty () const
 
auto operator<=> (const CyclicString &other) const
 
bool operator== (const CyclicString &other) const
 
- Public Member Functions inherited from core::Components< CyclicString< DefaultSymbolType >, ext::set< DefaultSymbolType >, component::Set, GeneralAlphabet >
void accessComponent ()
 

Friends

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

Additional Inherited Members

- Static Public Member Functions inherited from core::Components< CyclicString< DefaultSymbolType >, ext::set< DefaultSymbolType >, component::Set, GeneralAlphabet >
static void registerComponent ()
 
static void unregisterComponent ()
 

Detailed Description

template<class SymbolType = DefaultSymbolType>
class string::CyclicString< SymbolType >

Cyclic string.

Definition is similar to a linear string however cyclic. S = (A, C), A (Alphabet) = finite set of symbols, C (Content) = linear representation of cyclic string in some rotation

Note that two same cyclic strings compare not equal in different rotation. In order to either normalize rotation or compare without influence of particular rotation, use respective algoritm.

Template Parameters
SymbolTypeused for the terminal alphabet

Constructor & Destructor Documentation

◆ CyclicString() [1/5]

template<class SymbolType >
string::CyclicString< SymbolType >::CyclicString
explicit

Creates a new instance of the string with an empty content.

◆ CyclicString() [2/5]

template<class SymbolType >
string::CyclicString< SymbolType >::CyclicString ( ext::set< SymbolType >  alphabet,
ext::vector< SymbolType >  str 
)
explicit

Creates a new instance of the string with a concrete alphabet and content.

Parameters
alphabetthe initial alphabet of the string
strthe initial content of the string

◆ CyclicString() [3/5]

template<class SymbolType >
string::CyclicString< SymbolType >::CyclicString ( ext::vector< SymbolType >  str)
explicit

Creates a new instance of the string based on content, the alphabet is implicitly created from the content.

Parameters
strthe initial content of the string

◆ CyclicString() [4/5]

template<class SymbolType >
string::CyclicString< SymbolType >::CyclicString ( const std::string &  str)
explicit

Creates a new instance of the string from the standard string. The alphabet is deduced from the content. The constructor expects SymbolType of the string is constructible from char.

Parameters
strthe initial content of the string

◆ CyclicString() [5/5]

template<class SymbolType >
string::CyclicString< SymbolType >::CyclicString ( const char *  str)
explicit

Creates a new instance of the string from c-string. The alphabet is deduced from the content. The constructor expects SymbolType of the string is constructible from char.

Parameters
strthe initial content of the string

Member Function Documentation

◆ extendAlphabet()

template<class SymbolType = DefaultSymbolType>
void string::CyclicString< SymbolType >::extendAlphabet ( ext::set< SymbolType >  symbols)
inline

Adder of an alphabet symbols.

Parameters
symbolsthe new symbols to be added to the alphabet

◆ getAlphabet() [1/2]

template<class SymbolType = DefaultSymbolType>
ext::set< SymbolType > && string::CyclicString< SymbolType >::getAlphabet ( ) &&
inline

Getter of the alphabet.

Returns
the alphabet of the string
Here is the call graph for this function:

◆ getAlphabet() [2/2]

template<class SymbolType = DefaultSymbolType>
const ext::set< SymbolType > & string::CyclicString< SymbolType >::getAlphabet ( ) const &
inline

Getter of the alphabet.

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

◆ getContent() [1/2]

template<class SymbolType = DefaultSymbolType>
ext::vector< SymbolType > && string::CyclicString< SymbolType >::getContent ( ) &&

Getter of the string content.

Returns
List of symbols forming string.

◆ getContent() [2/2]

template<class SymbolType = DefaultSymbolType>
const ext::vector< SymbolType > & string::CyclicString< SymbolType >::getContent ( ) const &

Getter of the string content.

Returns
List of symbols forming string.
Here is the caller graph for this function:

◆ isEmpty()

template<class SymbolType >
bool string::CyclicString< SymbolType >::isEmpty

Test function to determine whether the cyclic string is empty

Returns
true if string is an empty word (vector length is 0)

◆ operator<=>()

template<class SymbolType = DefaultSymbolType>
auto string::CyclicString< SymbolType >::operator<=> ( const CyclicString< 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 = DefaultSymbolType>
bool string::CyclicString< SymbolType >::operator== ( const CyclicString< 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 string::CyclicString< SymbolType >::setContent ( ext::vector< SymbolType >  str)

Setter of the string content.

Exceptions
CommonExceptionwhen new string contains symbols not present in the alphabet
Parameters
newList of symbols forming string.
Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator<<

template<class SymbolType = DefaultSymbolType>
ext::ostream & operator<< ( ext::ostream out,
const CyclicString< 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: