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

Suffix array string index. Linear representation of all suffixes ordered lexicographically. Suffixes are represented as indexes to the indexed string and alphabet is stored within the string as well. Therefore the string is stored allong with Tree like representation of all suffixes. The class does not checks whether the suffixes order is correct. More...

#include <SuffixArray.h>

Public Member Functions

 SuffixArray (ext::vector< unsigned > data, string::LinearString< SymbolType > string)
 
const ext::vector< unsigned > & getData () const &
 
ext::vector< unsigned > && getData () &&
 
const string::LinearString< SymbolType > & getString () const &
 
string::LinearString< SymbolType > && getString () &&
 
const ext::set< SymbolType > & getAlphabet () const &
 
ext::set< SymbolType > && getAlphabet () &&
 
void setData (ext::vector< unsigned > data)
 
bool removeSymbolFromAlphabet (const SymbolType &symbol)
 
auto operator<=> (const SuffixArray &other) const
 
bool operator== (const SuffixArray &other) const
 

Friends

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

Detailed Description

template<class SymbolType = DefaultSymbolType>
class indexes::stringology::SuffixArray< SymbolType >

Suffix array string index. Linear representation of all suffixes ordered lexicographically. Suffixes are represented as indexes to the indexed string and alphabet is stored within the string as well. Therefore the string is stored allong with Tree like representation of all suffixes. The class does not checks whether the suffixes order is correct.

Template Parameters
SymbolTypetype of symbols of indexed string

Constructor & Destructor Documentation

◆ SuffixArray()

template<class SymbolType >
indexes::stringology::SuffixArray< SymbolType >::SuffixArray ( ext::vector< unsigned >  data,
string::LinearString< SymbolType >  string 
)
explicit

Creates a new instance of the index with concrete sorted indexes and indexed string.

Parameters
datathe sorted indexes to the indexed string
stringthe indexed string

Member Function Documentation

◆ getAlphabet() [1/2]

template<class SymbolType = DefaultSymbolType>
ext::set< SymbolType > && indexes::stringology::SuffixArray< SymbolType >::getAlphabet ( ) &&
inline

Getter of the alphabet of the indexed string.

Returns
the alphabet of the indexed string

◆ getAlphabet() [2/2]

template<class SymbolType = DefaultSymbolType>
const ext::set< SymbolType > & indexes::stringology::SuffixArray< SymbolType >::getAlphabet ( ) const &
inline

Getter of the alphabet of the indexed string.

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

◆ getData() [1/2]

template<class SymbolType = DefaultSymbolType>
ext::vector< unsigned > && indexes::stringology::SuffixArray< SymbolType >::getData ( ) &&

Getter of the sorted indexes.

Returns
vector of indexes

◆ getData() [2/2]

template<class SymbolType = DefaultSymbolType>
const ext::vector< unsigned > & indexes::stringology::SuffixArray< SymbolType >::getData ( ) const &

Getter of the sorted indexes.

Returns
vector of indexes
Here is the caller graph for this function:

◆ getString() [1/2]

template<class SymbolType = DefaultSymbolType>
string::LinearString< SymbolType > && indexes::stringology::SuffixArray< SymbolType >::getString ( ) &&

Getter of the indexed string.

Returns
the indexed string

◆ getString() [2/2]

template<class SymbolType = DefaultSymbolType>
const string::LinearString< SymbolType > & indexes::stringology::SuffixArray< SymbolType >::getString ( ) const &

Getter of the indexed string.

Returns
the indexed string
Here is the caller graph for this function:

◆ operator<=>()

template<class SymbolType = DefaultSymbolType>
auto indexes::stringology::SuffixArray< SymbolType >::operator<=> ( const SuffixArray< 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 indexes::stringology::SuffixArray< SymbolType >::operator== ( const SuffixArray< 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:

◆ removeSymbolFromAlphabet()

template<class SymbolType = DefaultSymbolType>
bool indexes::stringology::SuffixArray< SymbolType >::removeSymbolFromAlphabet ( const SymbolType &  symbol)
inline

Remover of a symbol from the alphabet of indexed string.

Parameters
symbola symbol to remove.

◆ setData()

template<class SymbolType >
void indexes::stringology::SuffixArray< SymbolType >::setData ( ext::vector< unsigned >  data)

Sets the vector of sorted indexes to the indexed string.

Parameters
datanew vector of indexes

Friends And Related Function Documentation

◆ operator<<

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