Modular Megafauna Model 1.1.5
A physiological, dynamic herbivore simulator in C++.
Loading...
Searching...
No Matches
Fauna::DateInterval Class Reference

Two dates framing a time interval. More...

#include <date_interval.h>

Public Member Functions

 DateInterval (const Date first, const Date last)
 Constructor. More...
 
void extend (const Date &new_date)
 Expand the time interval just enough to include a new date. More...
 
const Dateget_first () const
 First day of the interval. More...
 
const Dateget_last () const
 Last day of the interval. More...
 
bool matches_output_interval (const OutputInterval &) const
 

Private Attributes

Date first_day
 
Date last_day
 

Detailed Description

Two dates framing a time interval.

The first date must not be after the last date, but they can be the same: that is a one-day interval.

Constructor & Destructor Documentation

◆ DateInterval()

DateInterval::DateInterval ( const Date  first,
const Date  last 
)

Constructor.

Parameters
firstFirst day of the interval.
lastLast day of the interval.
Exceptions
std::invalid_argumentIf first day is after last day.

Member Function Documentation

◆ extend()

void DateInterval::extend ( const Date new_date)

Expand the time interval just enough to include a new date.

If the new date is already covered by the interval, nothing is changed.

Parameters
new_dateThe new day to be included in the interval.

◆ get_first()

const Date & Fauna::DateInterval::get_first ( ) const
inline

First day of the interval.

◆ get_last()

const Date & Fauna::DateInterval::get_last ( ) const
inline

Last day of the interval.

◆ matches_output_interval()

bool DateInterval::matches_output_interval ( const OutputInterval output_interval) const

Check whether last and first day have the distance of given output interval.

Member Data Documentation

◆ first_day

Date Fauna::DateInterval::first_day
private

◆ last_day

Date Fauna::DateInterval::last_day
private

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