MCPcopy Create free account
hub / github.com/comaps/comaps / SubsumedBy

Method SubsumedBy

libs/base/levenshtein_dfa.cpp:128–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126{}
127
128bool LevenshteinDFA::Position::SubsumedBy(Position const & rhs) const
129{
130 if (m_errorsLeft >= rhs.m_errorsLeft)
131 return false;
132
133 auto const errorsAvail = rhs.m_errorsLeft - m_errorsLeft;
134
135 if (IsStandard() && rhs.IsStandard())
136 return AbsDiff(m_offset, rhs.m_offset) <= errorsAvail;
137
138 if (IsStandard() && rhs.IsTransposed())
139 return m_offset == rhs.m_offset && m_errorsLeft == 0;
140
141 if (IsTransposed() && rhs.IsStandard())
142 return AbsDiff(m_offset + 1, rhs.m_offset) <= errorsAvail;
143
144 ASSERT(IsTransposed(), ());
145 ASSERT(rhs.IsTransposed(), ());
146 return m_offset == rhs.m_offset;
147}
148
149bool LevenshteinDFA::Position::operator<(Position const & rhs) const
150{

Callers 1

NormalizeMethod · 0.80

Calls 4

AbsDiffFunction · 0.85
ASSERTFunction · 0.85
IsStandardMethod · 0.80
IsTransposedMethod · 0.80

Tested by

no test coverage detected