72#ifndef __ADS_PatriciaTrie
73 #define __ADS_PatriciaTrie
167 [[nodiscard]] std::size_t
prefixEnd( std::string_view P )
const;
171 [[nodiscard]] std::pair< std::size_t , std::size_t >
177 [[nodiscard]] std::size_t
blindLeaf( std::string_view P )
const;
180 [[nodiscard]]
bool contains( std::string_view P )
const;
183 [[nodiscard]] std::size_t
size(
void )
const;
186 [[nodiscard]] std::size_t
nodes(
void )
const;
190 [[nodiscard]]
const std::string &
string( std::size_t i )
const;
194 [[nodiscard]] std::vector< std::pair< std::size_t , int > >
233 std::vector< std::pair< int , std::size_t > > child;
237 [[nodiscard]]
static int at( std::string_view s , std::size_t i );
240 [[nodiscard]] std::size_t childOf( std::size_t x ,
int c )
const;
244 void descend( std::string_view P ,
int term ,
245 std::vector< std::size_t > &
path )
const;
249 [[nodiscard]] std::size_t blind( std::string_view P ,
int term ,
250 std::vector< std::size_t > &
path )
const;
254 [[nodiscard]]
bool wellFormed(
void )
const;
256 static constexpr std::size_t kNone = ~std::size_t( 0 );
258 std::vector< std::string > f_D;
259 std::vector< Node > f_N;
271#include "ADS/dictionary/impl/PatriciaTrie.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The search by prefix in a sorted dictionary of strings, beyond the book: the strings prefixed by ar...
const_iterator cend(void) const
the constant iterator past the last item
Definition PatriciaTrie.h:223
std::size_t size_type
the type of the sizes
Definition PatriciaTrie.h:204
std::ptrdiff_t difference_type
the type of the distances between two iterators
Definition PatriciaTrie.h:206
const std::string & const_reference
a constant reference to an item
Definition PatriciaTrie.h:210
bool contains(std::string_view P) const
true if is one of the strings
PatriciaTrie(std::vector< std::string > D)
the trie of , built in time
std::size_t lexicographicPosition(std::string_view P) const
the number of strings smaller than , by the blind search
const_iterator cbegin(void) const
the constant iterator on the first item
Definition PatriciaTrie.h:221
std::pair< std::size_t, std::size_t > prefixRange(std::string_view P) const
the range of the strings prefixed by , i.e., lexicographicPosition( P ) and prefixEnd( P )
std::size_t prefixEnd(std::string_view P) const
the number of strings smaller than , i.e., smaller than or prefixed by , by the blind search of blin...
std::size_t blindLeaf(std::string_view P) const
the leaf of the first stage of the blind search of , the only string that the search reads
std::vector< std::string >::const_iterator const_iterator
the iterator on the items, constant
Definition PatriciaTrie.h:212
const_iterator end(void) const
the iterator past the last item
Definition PatriciaTrie.h:219
std::size_t nodes(void) const
the number of nodes, the root and the leaves included
const_iterator begin(void) const
the iterator on the first item
Definition PatriciaTrie.h:217
const std::string & string(std::size_t i) const
the string
const_iterator iterator
the iterator on the items
Definition PatriciaTrie.h:214
std::size_t size(void) const
the number of strings
const std::string & reference
a reference to an item
Definition PatriciaTrie.h:208
std::vector< std::pair< std::size_t, int > > shape(void) const
the length of the prefix of each node and its branching character, in preorder (-1 for the end of a s...
std::string value_type
the type of the items, for the standard library
Definition PatriciaTrie.h:202
std::vector< int > path(int r, int s, const std::vector< int > &p)
the path from to in the tree of the parents , empty if there is none (the procedure printPath of th...