1 #ifndef __DIADES__UTILS__INTERVAL_HH_ 2 #define __DIADES__UTILS__INTERVAL_HH_ 23 IntervalInvalid(
const string& whatArg) : runtime_error(whatArg), domain_error(whatArg)
25 cerr <<
"EXCEPTION Interval -> " << whatArg << endl;
41 Interval(
const string & minusInfinity,
const string & plusInfinity);
42 Interval(
int min,
const string & plusInfinity,
bool open =
false);
43 Interval(
const string & minusInfinity,
int max,
bool open =
false);
47 Interval(
int min,
int max,
bool openMin,
bool openMax);
49 bool operator==(
const Interval & interval)
const;
51 void setMin(
int min,
bool open);
52 void setMinusInfinity();
53 void setPlusInfinity();
54 void setMax(
int max,
bool open);
55 bool isIn(
int x)
const;
56 string toTina()
const;
57 bool isValid()
const {
return _min <= _max; }
58 int lower()
const {
return _min; }
59 int upper()
const {
return _max; }
60 bool isOpen()
const {
return _minOpen && _maxOpen; }
62 bool isClosed()
const {
return !_maxOpen && !_minOpen; }
65 bool isBounded()
const {
return !_minInfinity && !_maxInfinity; }
68 bool isUnBounded()
const {
return _minInfinity || _maxInfinity; }
bool isUbUnBounded() const
IntervalInvalid(const string &whatArg)
IsIn< InputIterator > isIn(InputIterator first, InputIterator last)
Namespace of the Diades project.
bool isLbUnBounded() const
std::ostream & operator<<(std::ostream &os, const Identifier &identifier)