40 inline size_t lookup_lcp_index(
size_t lcp)
const {
42 DCHECK_LE(lcp, m_lcp_index.
size());
44 size_t result = m_undef;
45 while(lcp > 0 && result == m_undef) {
46 result = m_lcp_index[--lcp];
55 : m_lcp(&lcp), m_undef(m_lcp->
size())
57 const size_t& n = lcp.size();
71 for (
size_t i = 1; i < n; i++) {
72 if (lcp[i] >= min_lcp) {
80 inline void insert(
size_t i) {
81 DCHECK(i < m_undef && !m_suffix_contained[i]);
83 size_t lcp = (*m_lcp)[i];
84 size_t pos = lookup_lcp_index(lcp);
87 if(m_last != m_undef) {
97 size_t prev = m_prev[
pos];
102 if(prev != m_undef) {
105 DCHECK(pos == m_first);
113 m_lcp_index[lcp-1] = i;
116 if(m_first == m_undef) {
121 m_suffix_contained[i] = 1;
127 inline void remove(
size_t i) {
128 DCHECK(i < m_undef && m_suffix_contained[i]);
131 if(m_prev[i] != m_undef) {
132 m_next[m_prev[i]] = m_next[i];
134 DCHECK(i == m_first);
138 if(m_next[i] != m_undef) {
139 m_prev[m_next[i]] = m_prev[i];
146 size_t lcp = (*m_lcp)[i];
147 if(m_lcp_index[lcp-1] == i) {
148 size_t k = m_next[i];
149 if (k != m_undef && (*m_lcp)[k] == lcp) {
150 m_lcp_index[lcp-1] = k;
152 m_lcp_index[lcp-1] = m_undef;
157 m_suffix_contained[i] = 0;
171 return m_suffix_contained[i];
181 return (m_size == 0);
Contains the text compression and encoding framework.
constexpr uint_fast8_t bits_for(size_t n)
Computes the number of bits required to store the given integer value.
A vector over arbitrary unsigned integer types.
Provides constant-time access to the suffix in a suffix array with the longest correspondig lcp table...
MaxLCPSuffixList(lcp_t &lcp, size_t min_lcp, size_t max_lcp)
Constructor.
IntVector< uint_t< 1 > > BitVector
Represents a bit vector, alias for IntVector with a fixed bit width of 1.
void decrease_key(len_t i, T value)
Decrease key on array item with index i.
bool empty() const
Test if list is empty.
size_t size() const
Get number of contained entries.
fast_t< len_compact_t > len_t
Type to represent an length value.
IntVector< dynamic_t > DynamicIntVector
Represents an integer vector with unspecified (dynamic) bit width.
bool contains(size_t i) const
Checks whether or not suffix array entry i is contained in this list.
size_t get_max() const
Get first item (suffix array index with highest LCP)