frepple::utils::DateRange Class Reference

This class defines a date-range, i.e. a start-date and end-date pair. More...

#include <utils.h>

List of all members.

Public Member Functions

 DateRange (const Date &st, const Date &nd)
 DateRange ()
 DateRange (const DateRange &n)
TimePeriod getDuration () const
const DategetEnd () const
const DategetStart () const
bool intersect (const DateRange &dr) const
 operator string () const
bool operator!= (const DateRange &b) const
void operator+= (const TimePeriod &l)
void operator-= (const TimePeriod &l)
void operator= (const DateRange &dr)
bool operator== (const DateRange &b) const
TimePeriod overlap (const DateRange &dr) const
void setEnd (const Date &d)
void setStart (const Date &d)
void setStartAndEnd (const Date &st, const Date &nd)
bool within (const Date &d) const

Static Public Member Functions

static const string & getSeparator ()
static void setSeparator (const string &n)

Detailed Description

This class defines a date-range, i.e. a start-date and end-date pair.

The behavior is such that the start date is considered as included in it, but the end date is excluded from it. In other words, a daterange is a halfopen date interval: [start,end[
The start and end dates are always such that the start date is less than or equal to the end date.

Definition at line 1680 of file utils.h.


Constructor & Destructor Documentation

frepple::utils::DateRange::DateRange ( const Date st,
const Date nd 
) [inline]

Constructor with specified start and end dates.
If the start date is later than the end date parameter, the parameters will be swapped.

Definition at line 1686 of file utils.h.

frepple::utils::DateRange::DateRange ( ) [inline]

Default constructor.
This will create a daterange covering the complete horizon.

Definition at line 1692 of file utils.h.

frepple::utils::DateRange::DateRange ( const DateRange n) [inline]

Copy constructor.

Definition at line 1695 of file utils.h.


Member Function Documentation

TimePeriod frepple::utils::DateRange::getDuration ( ) const [inline]

Returns the duration of the interval. Note that this number will always be greater than or equal to 0, since the end date is always later than the start date.

Definition at line 1723 of file utils.h.

const Date& frepple::utils::DateRange::getEnd ( ) const [inline]

Returns the end date.

Definition at line 1707 of file utils.h.

static const string& frepple::utils::DateRange::getSeparator ( ) [inline, static]

Retrieves the default seperator.

Definition at line 1774 of file utils.h.

const Date& frepple::utils::DateRange::getStart ( ) const [inline]

Returns the start date.

Definition at line 1698 of file utils.h.

bool frepple::utils::DateRange::intersect ( const DateRange dr) const [inline]

Return true if two date ranges are overlapping.
The start point of the first interval is included in the comparison, whereas the end point isn't. As a result this method is not symmetrical, ie when a.intersect(b) returns true b.intersect(a) is not nessarily true.

Definition at line 1748 of file utils.h.

frepple::utils::DateRange::operator string ( ) const

Convert the daterange to a string.

Definition at line 108 of file date.cpp.

bool frepple::utils::DateRange::operator!= ( const DateRange b) const [inline]

Inequality of date ranges.

Definition at line 1730 of file utils.h.

void frepple::utils::DateRange::operator+= ( const TimePeriod l) [inline]

Move the daterange later in time.

Definition at line 1734 of file utils.h.

void frepple::utils::DateRange::operator-= ( const TimePeriod l) [inline]

Move the daterange earlier in time.

Definition at line 1737 of file utils.h.

void frepple::utils::DateRange::operator= ( const DateRange dr) [inline]

Assignment operator.

Definition at line 1740 of file utils.h.

bool frepple::utils::DateRange::operator== ( const DateRange b) const [inline]

Equality of date ranges.

Definition at line 1726 of file utils.h.

TimePeriod frepple::utils::DateRange::overlap ( const DateRange dr) const [inline]

Returns the number of seconds the two dateranges overlap.

Definition at line 1752 of file utils.h.

void frepple::utils::DateRange::setEnd ( const Date d) [inline]

Updates the end date.
If the new end date is earlier than the start date, the start date will be set equal to the new end date.

Definition at line 1713 of file utils.h.

static void frepple::utils::DateRange::setSeparator ( const string &  n) [inline, static]

Updates the default seperator.

Definition at line 1767 of file utils.h.

void frepple::utils::DateRange::setStart ( const Date d) [inline]

Updates the start date.
If the new start date is later than the end date, the end date will be set equal to the new start date.

Definition at line 1704 of file utils.h.

void frepple::utils::DateRange::setStartAndEnd ( const Date st,
const Date nd 
) [inline]

Updates the start and end dates simultaneously.

Definition at line 1716 of file utils.h.

bool frepple::utils::DateRange::within ( const Date d) const [inline]

Returns true if the date passed as argument does fall within the daterange.

Definition at line 1761 of file utils.h.


The documentation for this class was generated from the following files:

Documentation generated for frePPLe by  doxygen