contains method
checks if the given cell (line / col) is contained in this hit
Implementation
bool contains(int line, int col) {
if (line < startLineIndex || line > endLineIndex) {
return false;
}
if (line == startLineIndex && startLineIndex == endLineIndex) {
return col >= startIndex && col < endIndex;
}
if (line == startLineIndex) {
return col >= startIndex;
}
if (line == endLineIndex) {
return col < endIndex;
}
// here we are sure that the given point is inside a full line match
return true;
}