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

◆ subwordPosition()

bool WordWithDataTable::subwordPosition ( WordWithData word1,
WordWithData word2,
int & result_start_index )
staticprivate

Definition at line 316 of file WordTable.cpp.

323{
324 if (word2.size() < word1.size()) return false;
325 if (word2.ecartDegree() < word1.ecartDegree()) return false;
326 for (auto j = 0; j <= word2.size() - word1.size(); ++j)
327 {
328 bool match = true;
329 for (auto k = 0; k < word1.size(); ++k)
330 if (word1.begin()[k] != word2.begin()[j+k])
331 {
332 match = false;
333 break;
334 }
335 if (match)
336 {
337 result_start_index = j;
338 return true;
339 }
340 }
341 return false;
342}
size_t size() const
Definition Word.hpp:148
const int * begin() const
Definition Word.hpp:140
int ecartDegree() const
Definition Word.hpp:145

References WordWithData::begin(), WordWithData::ecartDegree(), and WordWithData::size().

Referenced by subword().