Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::core::Interval< TYPE > Class Template Reference

Numeric interval representation data type. More...

#include <interval.h>

Public Member Functions

 Interval ()=default
 Initialises a new instance of the Interval class. More...
 
 Interval (TYPE lower_value, TYPE upper_value)
 Initialises a new instance of the Interval class. More...
 
TYPE lower () const noexcept
 Gets the interval lower bound. More...
 
TYPE upper () const noexcept
 Gets the interval upper bound. More...
 
TYPE length () const noexcept
 Gets the interval length. More...
 
bool contains (TYPE value) const noexcept
 Determines whether a value is in the Interval. More...
 
bool contains (Interval< TYPE > &other) const noexcept
 Determines whether an Interval is inside this instance interval. More...
 
std::string to_string () const noexcept
 Convert this instance to a string representation. More...
 
auto operator<=> (const Interval< TYPE > &rhs) const =default
 Compare two Interval instances. More...
 

Detailed Description

template<Numerical TYPE>
class hgps::core::Interval< TYPE >

Numeric interval representation data type.

Template Parameters
TYPEThe numerical type

Constructor & Destructor Documentation

◆ Interval() [1/2]

template<Numerical TYPE>
hgps::core::Interval< TYPE >::Interval ( )
default

Initialises a new instance of the Interval class.

◆ Interval() [2/2]

template<Numerical TYPE>
hgps::core::Interval< TYPE >::Interval ( TYPE  lower_value,
TYPE  upper_value 
)
inlineexplicit

Initialises a new instance of the Interval class.

Parameters
lower_valueLower bound value
upper_valueUpper bound value

Member Function Documentation

◆ contains() [1/2]

template<Numerical TYPE>
bool hgps::core::Interval< TYPE >::contains ( Interval< TYPE > &  other) const
inlinenoexcept

Determines whether an Interval is inside this instance interval.

Parameters
otherThe other Interval to check
Returns
true if the other Interval is inside this instance; otherwise, false.
Here is the call graph for this function:

◆ contains() [2/2]

template<Numerical TYPE>
bool hgps::core::Interval< TYPE >::contains ( TYPE  value) const
inlinenoexcept

Determines whether a value is in the Interval.

Parameters
valueThe value to check
Returns
true if the value is in the interval; otherwise, false.
Here is the caller graph for this function:

◆ length()

template<Numerical TYPE>
TYPE hgps::core::Interval< TYPE >::length ( ) const
inlinenoexcept

Gets the interval length.

Returns
Length of the interval
Here is the caller graph for this function:

◆ lower()

template<Numerical TYPE>
TYPE hgps::core::Interval< TYPE >::lower ( ) const
inlinenoexcept

Gets the interval lower bound.

Returns
The lower bound value
Here is the caller graph for this function:

◆ operator<=>()

template<Numerical TYPE>
auto hgps::core::Interval< TYPE >::operator<=> ( const Interval< TYPE > &  rhs) const
default

Compare two Interval instances.

Parameters
rhsThe Interval to compare to this instance.
Returns
The comparison result

◆ to_string()

template<Numerical TYPE>
std::string hgps::core::Interval< TYPE >::to_string ( ) const
inlinenoexcept

Convert this instance to a string representation.

Returns
The equivalent string representation

◆ upper()

template<Numerical TYPE>
TYPE hgps::core::Interval< TYPE >::upper ( ) const
inlinenoexcept

Gets the interval upper bound.

Returns
The upper bound value
Here is the caller graph for this function:

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