INTERVAL Class Reference

This class represents a closed interval object. An interval is a pair of double values [x,y], representing all values (of type double) starting from x to y. We name them the left and the right of the interval. Also, we ca associate a cost (weight) to an interval. More...

#include <interval.h>

List of all members.

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)
INTERVALoperator= (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)


Detailed Description

This class represents a closed interval object. An interval is a pair of double values [x,y], representing all values (of type double) starting from x to y. We name them the left and the right of the interval. Also, we ca associate a cost (weight) to an interval.

Author:
Sid Touati


Constructor & Destructor Documentation

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.

Parameters:
x the left value
y the right value
Exceptions:
INVALID_INTERVAL if x>y

INTERVAL::INTERVAL ( double  x,
double  y,
double  w 
)

Constructor with three arguments.

Parameters:
x the left value
y the right value
w the weight
Exceptions:
INVALID_INTERVAL if x>y


Member Function Documentation

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.


Friends And Related Function Documentation

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.


September 2007, by Sid Touati (Copyright University of Versailles)