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

Position heap string index. Tree like representation of all suffixes. The suffixes are themselves represented by their prefixes. The prefix of each suffix needs to be unique from all representants (prefixes again) of shorter suffixes. Nodes of the trie contain index of the suffix. The parent child relationship of nodes is represented by single symbol. The class does not checks whether the trie structure actually is position heap. More...

#include <PositionHeap.h>

Public Member Functions

 PositionHeap (ext::trie< SymbolType, unsigned > trie, string::LinearString< SymbolType > string)
 
const ext::trie< SymbolType, unsigned > & getRoot () const &
 
ext::trie< SymbolType, unsigned > && getRoot () &&
 
const string::LinearString< SymbolType > & getString () const &
 
string::LinearString< SymbolType > && getString () &&
 
const ext::set< SymbolType > & getAlphabet () const &
 
ext::set< SymbolType > && getAlphabet () &&
 
void setTree (ext::trie< SymbolType, unsigned > trie)
 
bool removeSymbolFromEdgeAlphabet (const SymbolType &symbol)
 
auto operator<=> (const PositionHeap &other) const
 
bool operator== (const PositionHeap &other) const
 

Friends

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

Detailed Description

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

Position heap string index. Tree like representation of all suffixes. The suffixes are themselves represented by their prefixes. The prefix of each suffix needs to be unique from all representants (prefixes again) of shorter suffixes. Nodes of the trie contain index of the suffix. The parent child relationship of nodes is represented by single symbol. The class does not checks whether the trie structure actually is position heap.

Also the size of the structure is exactly linear.

Template Parameters
SymbolTypetype of symbols of indexed string

Constructor & Destructor Documentation

◆ PositionHeap()

template<class SymbolType >
indexes::stringology::PositionHeap< SymbolType >::PositionHeap ( ext::trie< SymbolType, unsigned >  trie,
string::LinearString< SymbolType >  string 
)
explicit

Creates a new instance of the index based on constructed position heap and original indexed string.

Parameters
triethe raw data of the index - the position heap
stringthe indexed string

Member Function Documentation

◆ getAlphabet() [1/2]

template<class SymbolType = DefaultSymbolType>
ext::set< SymbolType > && indexes::stringology::PositionHeap< 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::PositionHeap< 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:
Here is the caller graph for this function:

◆ getRoot() [1/2]

template<class SymbolType = DefaultSymbolType>
ext::trie< SymbolType, unsigned > && indexes::stringology::PositionHeap< SymbolType >::getRoot ( ) &&

Getter of the raw position heap.

Returns
root node of the position heap

◆ getRoot() [2/2]

template<class SymbolType = DefaultSymbolType>
const ext::trie< SymbolType, unsigned > & indexes::stringology::PositionHeap< SymbolType >::getRoot ( ) const &

Getter of the raw position heap.

Returns
root node of the position heap
Here is the caller graph for this function:

◆ getString() [1/2]

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

Getter of the indexed string.

Returns
the indexed string

◆ getString() [2/2]

template<class SymbolType = DefaultSymbolType>
const string::LinearString< SymbolType > & indexes::stringology::PositionHeap< 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::PositionHeap< SymbolType >::operator<=> ( const PositionHeap< 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::PositionHeap< SymbolType >::operator== ( const PositionHeap< 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:

◆ removeSymbolFromEdgeAlphabet()

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

Remover of a symbol from the alphabet.

Parameters
symbola symbol to remove.

◆ setTree()

template<class SymbolType >
void indexes::stringology::PositionHeap< SymbolType >::setTree ( ext::trie< SymbolType, unsigned >  trie)

Sets the root node of the suffix trie

Parameters
treeroot node to set

Friends And Related Function Documentation

◆ operator<<

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