#include <interval.h>
Creation | |
INTERVAL () | |
INTERVAL (double x, double y) | |
INTERVAL (double x, double y, double w) | |
INTERVAL (ENDPOINT x, ENDPOINT y) | |
INTERVAL (ENDPOINT x, ENDPOINT y, double w) | |
INTERVAL & | operator= (const INTERVAL &) |
Public Member Functions | |
Access operations | |
double | weight () const |
ENDPOINT | left () const |
ENDPOINT | right () const |
double | left_value () |
double | right_value () |
Update operations | |
void | setWeight (double theValue) |
void | set_left (ENDPOINT theValue) |
void | set_right (ENDPOINT theValue) |
void | set_left_value (double theValue) |
void | set_right_value (double theValue) |
Friends | |
INPUT/OUTPUT | |
ostream & | operator<< (ostream &os, INTERVAL x) |
istream & | operator>> (istream &is, INTERVAL &x) |
INTERVAL::INTERVAL | ( | ) |
Constructor of an empty interval [0,0] with a unit cost.
INTERVAL::INTERVAL | ( | double | x, | |
double | y | |||
) |
Constructor with two arguments, the left and the right values of the interval.
x | the left value | |
y | the right value |
INVALID_INTERVAL | if x>y |
INTERVAL::INTERVAL | ( | double | x, | |
double | y, | |||
double | w | |||
) |
Constructor with three arguments.
x | the left value | |
y | the right value | |
w | the weight |
INVALID_INTERVAL | if x>y |
double INTERVAL::weight | ( | ) | const [inline] |
Returns the weight of the interval.
double INTERVAL::left_value | ( | ) | [inline] |
Returns the left value of the interval.
double INTERVAL::right_value | ( | ) | [inline] |
Returns the right value of the interval.
void INTERVAL::setWeight | ( | double | theValue | ) | [inline] |
Sets the weight of the interval.
void INTERVAL::set_left_value | ( | double | theValue | ) | [inline] |
Sets the left value of the interval.
void INTERVAL::set_right_value | ( | double | theValue | ) | [inline] |
Sets the right value of the interval.
ostream& operator<< | ( | ostream & | os, | |
INTERVAL | x | |||
) | [friend] |
Output stream. Prints left and right values in this order.
istream& operator>> | ( | istream & | is, | |
INTERVAL & | x | |||
) | [friend] |
Input stream. Reads left and right values in this order.