thepeg is hosted by Hepforge, IPPP Durham
 ThePEG  2.2.1
ThePEG::Interval< T, CMP > Class Template Reference

An `Interval` object is used to represent an interval `[ lower(), upper() )` where the ordering is defined by the `bool operator()(const T &, const T &) const` member of the CMP class (by defaut less<T>). More...

`#include <Interval.h>`

Inheritance diagram for ThePEG::Interval< T, CMP >:

## Public Member Functions

Interval ()
Construct an empty interval.

Interval (T dn, T up)
Construct interval [dn,up).

bool operator== (const Interval &i) const
Test for equality.

bool operator< (const Interval &i) const
Test for ordering. More...

bool check () const
Check consistency ie. More...

bool operator() (T x) const
Returns true if x is within the interval.

bool includes (T x) const
Returns true if x is within the interval.

bool includes (const Interval< T, CMP > &i) const
Returns true if the whole of i is within the interval.

Interval< T, CMP > chopUpper (T x)
If x is in the interval return the interval [x,upper()) and change this interval to [lower(),x). More...

Interval< T, CMP > chopLower (T x)
If x is in the interval return the interval [lower(),x) and change this interval to [x,upper()). More...

Interval< T, CMP > overlap (const Interval &i) const
If this interval operlaps with i return the overlapping interval.

Interval< T, CMP > sum (const Interval &i) const
If this interval operlaps with i return the union of the two intervals.

upper () const
Return the upper limit of the interval.

lower () const
Return the lower limit of the interval.

void upper (T up)
Set the upper limit of the interval.

void lower (T dn)
Set the lower limit of the interval.

template<typename Iterator >
bool check (Iterator first, Iterator last)
Check if any of the values in the iterator given range is included in this interval.

template<typename Iterator >
bool checkAll (Iterator first, Iterator last)
Check if all of the values in the given iterator range is included in this interval.

std::vector< Interval< T, CMP > > split (Interval< T, CMP >, T x)
If x is in the given interval, split the given interval in two, otherwise return an empty list.

template<typename Iterator >
std::vector< Interval< T, CMP > > split (Interval< T, CMP >, Iterator first, Iterator last)
For each value in the given range is in the given interval, split the interval in two, otherwise return an empty list.

## Private Attributes

std::pair< T, T > theLimits
The lower and upper limit of this interval.

## Static Private Attributes

static CMP cmp
The object used for comparisons. More...

## Detailed Description

### template<typename T, typename CMP> class ThePEG::Interval< T, CMP >

An `Interval` object is used to represent an interval `[ lower(), upper() )` where the ordering is defined by the `bool operator()(const T &, const T &) const` member of the CMP class (by defaut less<T>).

Definition at line 27 of file Interval.h.

## ◆ check()

template<typename T, typename CMP>
 bool ThePEG::Interval< T, CMP >::check ( ) const
inline

Check consistency ie.

that lower() < upper().

Definition at line 61 of file Interval.h.

Referenced by ThePEG::Interval< Energy2 >::lower().

## ◆ chopLower()

template<typename T, typename CMP>
 Interval ThePEG::Interval< T, CMP >::chopLower ( T x )
inline

If x is in the interval return the interval [lower(),x) and change this interval to [x,upper()).

If x is not within the interval, return [0,0) and leave this interval as it is.

Definition at line 100 of file Interval.h.

## ◆ chopUpper()

template<typename T, typename CMP>
 Interval ThePEG::Interval< T, CMP >::chopUpper ( T x )
inline

If x is in the interval return the interval [x,upper()) and change this interval to [lower(),x).

If x is not within the interval, return [0,0) and leave this interval as it is.

Definition at line 85 of file Interval.h.

## ◆ operator<()

template<typename T, typename CMP>
 bool ThePEG::Interval< T, CMP >::operator< ( const Interval< T, CMP > & i ) const
inline

Test for ordering.

Returns
true if `lower() < i.lower()` or `lower() == i.lower()` and `upper() < i.upper()`.

Definition at line 53 of file Interval.h.

## ◆ cmp

template<typename T, typename CMP>
 CMP ThePEG::Interval< T, CMP >::cmp
staticprivate

The object used for comparisons.

Definition at line 187 of file Interval.h.

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