26 Range::Range() : empty_range(true) {}
28 Range::Range(
const int& lower_bound,
const int& upper_bound) : lower_bound(lower_bound), upper_bound(upper_bound), empty_range(lower_bound > upper_bound)
32 bool Range::empty()
const
37 const int& Range::lower()
const
42 const int& Range::upper()
const
47 bool Range::is_in_closed(
const Range& range)
const
49 return (this->empty() ?
false : (range.lower_bound >= lower_bound && range.upper_bound <= upper_bound));
52 bool Range::is_in_closed(
const int& value)
const
54 return (this->empty() ?
false : (value >= lower_bound && value <= upper_bound));
57 bool Range::is_in_open(
const int& value)
const
59 return (this->empty() ?
false : (value > lower_bound && value < upper_bound));
62 void Range::enlarge_to_include(
const int& value)
65 lower_bound = upper_bound = value;
69 if (lower_bound > value)
71 if (upper_bound < value)
76 Range Range::make_envelope(
const Range& a,
const Range& b)
83 return Range(std::min(a.lower(), b.lower()), std::max(a.upper(), b.upper()));
General namespace for the Hermes library.
File containing the class Range.