concordia-library/concordia/interval.cpp
2018-12-12 21:45:07 +01:00

26 lines
607 B
C++

#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);
}
bool Interval::contains(Interval & interval) {
return (_start <= interval.getStart() && _end >= interval.getEnd());
}
SUFFIX_MARKER_TYPE Interval::getLength() {
return _end - _start;
}