ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
larcfm::Interval Class Reference

#include <Interval.h>

Public Types

typedef std::vector< Interval >::size_type nat
 

Public Member Functions

 Interval (double lb, double ub)
 
 Interval ()
 
 Interval (const Interval &i)
 
int operator== (const Interval &p) const
 
bool isEmpty () const
 
std::string toString () const
 
std::string toString (int precision) const
 
std::string toStringUnits (const std::string &unit) const
 
bool isSingle () const
 
bool isSingle (double width) const
 
bool in (double x) const
 
bool inCC (double x) const
 
bool inCO (double x) const
 
bool inOC (double x) const
 
bool inOO (double x) const
 
bool almost_in (double x, bool lb_close, bool ub_close) const
 
bool almost_in (double x, bool lb_close, bool ub_close, INT64FM maxUlps) const
 
bool overlap (const Interval &r) const
 
Interval intersect (const Interval &r) const
 
std::string toPVS () const
 
std::string toPVS (int precision) const
 

Public Attributes

double low
 
double up
 

Static Public Attributes

static const Interval EMPTY
 

Detailed Description

Interval represents a interval of double's from a lower bound to an upper bound. This class is immutable.

Whether the interval is interpreted as open or closed is context-dependent. There are various membership tests allowing for the different interpretations.

Constructor & Destructor Documentation

◆ Interval() [1/3]

Interval::Interval ( double  lb,
double  ub 
)

Construct an Interval

Parameters
lblower bound of the region
ubupper bound of the region

◆ Interval() [2/3]

Interval::Interval ( )

Construct an empty interval

◆ Interval() [3/3]

Interval::Interval ( const Interval i)

Construct a new Interval which is a copy of the given Interval.

Parameters
iinterval

Member Function Documentation

◆ almost_in() [1/2]

bool Interval::almost_in ( double  x,
bool  lb_close,
bool  ub_close 
) const

Is the element (almost) in this interval, where close/open conditions are given as parameters

Parameters
xvalue
lb_closelower bound
ub_closeupper bound
Returns
true if in interval

Is the element (almost) in this interval, where close/open conditions are given as parameters

◆ almost_in() [2/2]

bool Interval::almost_in ( double  x,
bool  lb_close,
bool  ub_close,
INT64FM  maxUlps 
) const

Is the element (almost) in this interval, where close/open conditions are given as parameters

Parameters
xvalue
lb_closelower bound
ub_closeupper bound
maxUlpstolerance
Returns
true if value in interval

Is the element (almost) in this interval, where close/open conditions are given as parameters

◆ in()

bool Interval::in ( double  x) const

Is the element in this closed/closed interval?

Parameters
xvalue
Returns
true if value in interval

◆ inCC()

bool Interval::inCC ( double  x) const

Is the element in this closed/closed interval?

Parameters
xvalue
Returns
true if value in interval

◆ inCO()

bool Interval::inCO ( double  x) const

Is the element in this closed/open interval?

Parameters
xvalue
Returns
true if value in interval

◆ inOC()

bool Interval::inOC ( double  x) const

Is the element in this open/closed interval?

Parameters
xvalue
Returns
true if value in interval

◆ inOO()

bool Interval::inOO ( double  x) const

Is the element in this open/open interval?

Parameters
xvalue
Returns
true if value in interval

◆ intersect()

Interval Interval::intersect ( const Interval r) const

Returns a new interval which is the intersection of the current Interval and the given Interval. If the two regions do not overlap, then an empty region is returned.

Parameters
rinterval
Returns
intersection or empty

◆ isEmpty()

bool Interval::isEmpty ( ) const

Return true if the interval is empty, or otherwise ill-formed.

Returns
true if empty

◆ isSingle() [1/2]

bool Interval::isSingle ( ) const

Is this interval a single value?

Returns
true if single value

◆ isSingle() [2/2]

bool Interval::isSingle ( double  width) const

Is this interval a single value? (with intervals of the indicated width or smaller counting)

Parameters
widthwidth of interval
Returns
true if single

◆ operator==()

int Interval::operator== ( const Interval p) const

Returns true if the bounds of the intervals are equal.

◆ overlap()

bool Interval::overlap ( const Interval r) const

Does the given Interval overlap with this Interval. Intervals that only share an endpoint do not overlap, for example, (1.0,2.0) and (2.0,3.0) do not overlap.

Parameters
rinterval
Returns
true if overlap

◆ toString()

std::string Interval::toString ( ) const

String representation (as a closed interval)

Member Data Documentation

◆ EMPTY

const Interval Interval::EMPTY
static

An empty interval.

◆ low

double larcfm::Interval::low

The lower bound of this interval

◆ up

double larcfm::Interval::up

The upper bound of this interval


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