Macaulay2 Engine
Loading...
Searching...
No Matches

◆ overlaps()

void WordWithDataTable::overlaps ( WordWithData word1,
WordWithData word2,
std::vector< int > & result_overlaps )
staticprivate

Definition at line 477 of file WordTable.cpp.

480{
481 if (word1.size() <= 1) return;
482 for (int i = word1.size() - 1; i > 0 and i + word2.size() > word1.size(); --i)
483 {
484 // below, we are disregarding ecart degree for overlap detection/generation
485 Word suffix(word1.begin() + i, word1.end());
486 Word prefix(word2.begin(), word2.begin() + word1.size() - i); // indices should be in range.
487 if (suffix == prefix)
488 result_overlaps.push_back(i);
489 }
490}
Word prefix(const Word vec, int lengthOfPrefix)
Word suffix(const Word vec, int indexOfSuffix)
const int * end() const
Definition Word.hpp:141
size_t size() const
Definition Word.hpp:148
const int * begin() const
Definition Word.hpp:140

References WordWithData::begin(), WordWithData::end(), prefix(), WordWithData::size(), and suffix().

Referenced by leftOverlaps(), and rightOverlaps().