concordia-library/concordia/interval.cpp

26 lines
607 B
C++
Raw Permalink Normal View History

#include "concordia/interval.hpp"
Interval::Interval(const SUFFIX_MARKER_TYPE start,
const SUFFIX_MARKER_TYPE end):
_start(start),
_end(end) {
}
Interval::~Interval() {
}
bool Interval::intersects(Interval & interval) {
return !(_end - 1 < interval.getStart() ||
interval.getEnd() - 1 < _start);
}
2018-12-12 21:45:07 +01:00
bool Interval::contains(Interval & interval) {
return (_start <= interval.getStart() && _end >= interval.getEnd());
}
SUFFIX_MARKER_TYPE Interval::getLength() {
return _end - _start;
}