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

Linear string. More...

#include <LinearString.h>

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

Public Member Functions

 LinearString ()
 Creates a new instance of the string with an empty content. More...
 
 LinearString (ext::set< SymbolType > alphabet, ext::vector< SymbolType > str)
 Creates a new instance of the string with a concrete alphabet and content. More...
 
 LinearString (ext::vector< SymbolType > str)
 Creates a new instance of the string based on content, the alphabet is implicitly created from the content. More...
 
 LinearString (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...
 
 LinearString (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 (const ext::set< SymbolType > &symbols)
 
void appendSymbol (SymbolType symbol)
 
const ext::vector< SymbolType > & getContent () const &
 
ext::vector< SymbolType > && getContent () &&
 
void setContent (ext::vector< SymbolType > str)
 
bool empty () const
 
size_t size () const
 
auto operator<=> (const LinearString &other) const
 
bool operator== (const LinearString &other) const
 
- Public Member Functions inherited from core::Components< LinearString< DefaultSymbolType >, ext::set< DefaultSymbolType >, component::Set, GeneralAlphabet >
void accessComponent ()
 

Friends

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

Additional Inherited Members

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

Detailed Description

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

Linear string.

S = (A, C), A (Alphabet) = finite set of symbols, C (Content) = representation of the string content

Template Parameters
SymbolTypeused for the terminal alphabet

Constructor & Destructor Documentation

◆ LinearString() [1/5]

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

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

◆ LinearString() [2/5]

template<class SymbolType >
string::LinearString< SymbolType >::LinearString ( 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

◆ LinearString() [3/5]

template<class SymbolType >
string::LinearString< SymbolType >::LinearString ( 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

◆ LinearString() [4/5]

template<class SymbolType >
string::LinearString< SymbolType >::LinearString ( 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

◆ LinearString() [5/5]

template<class SymbolType >
string::LinearString< SymbolType >::LinearString ( 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

◆ appendSymbol()

template<class SymbolType >
void string::LinearString< SymbolType >::appendSymbol ( SymbolType  symbol)

Appender of a symbol to the string.

Parameters
symbolthe symbol to be added to the end of the string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty()

template<class SymbolType >
bool string::LinearString< SymbolType >::empty

Test function to determine whether the cyclic string is empty

Returns
true if string is an empty word (vector length is 0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extendAlphabet()

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

Adder of an alphabet symbols.

Parameters
symbolsthe new symbols to be added to the alphabet
Here is the caller graph for this function:

◆ getAlphabet() [1/2]

template<class SymbolType = DefaultSymbolType>
ext::set< SymbolType > && string::LinearString< 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::LinearString< 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::LinearString< 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::LinearString< SymbolType >::getContent ( ) const &

Getter of the string content.

Returns
List of symbols forming string.

◆ operator<=>()

template<class SymbolType = DefaultSymbolType>
auto string::LinearString< SymbolType >::operator<=> ( const LinearString< 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::LinearString< SymbolType >::operator== ( const LinearString< 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::LinearString< 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:

◆ size()

template<class SymbolType >
size_t string::LinearString< SymbolType >::size

Returns length of the content.

Returns
the length of the string.
Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

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