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>
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. | |
bool | check () const |
Check consistency ie. | |
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). | |
Interval< T, CMP > | chopLower (T x) |
If x is in the interval return the interval [lower(),x) and change this interval to [x,upper()). | |
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. | |
T | upper () const |
Return the upper limit of the interval. | |
T | 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. | |
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.
|
inline |
Construct an empty interval.
Definition at line 34 of file Interval.h.
|
inline |
Construct interval [dn,up).
Definition at line 39 of file Interval.h.
|
inline |
Check consistency ie.
Definition at line 61 of file Interval.h.
References ThePEG::Interval< T, CMP >::cmp, ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
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.
References ThePEG::Interval< T, CMP >::includes(), ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
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.
References ThePEG::Interval< T, CMP >::includes(), ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
inline |
Returns true if the whole of i is within the interval.
Definition at line 76 of file Interval.h.
References ThePEG::Interval< T, CMP >::cmp, ThePEG::Interval< T, CMP >::includes(), ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
inline |
Returns true if x is within the interval.
Definition at line 71 of file Interval.h.
References ThePEG::Interval< T, CMP >::cmp, ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
Referenced by ThePEG::Interval< T, CMP >::chopLower(), ThePEG::Interval< T, CMP >::chopUpper(), ThePEG::Interval< T, CMP >::includes(), ThePEG::Interval< T, CMP >::operator()(), ThePEG::Interval< T, CMP >::overlap(), and ThePEG::Interval< T, CMP >::sum().
|
inline |
Return the lower limit of the interval.
Definition at line 141 of file Interval.h.
References ThePEG::Interval< T, CMP >::theLimits.
Referenced by ThePEG::Interval< T, CMP >::check(), ThePEG::Interval< T, CMP >::chopLower(), ThePEG::Interval< T, CMP >::chopUpper(), ThePEG::Interval< T, CMP >::includes(), ThePEG::PDFCuts::lMin(), ThePEG::Interval< T, CMP >::operator<(), ThePEG::operator<<(), ThePEG::Interval< T, CMP >::operator==(), ThePEG::operator>>(), ThePEG::ounitstream(), ThePEG::Interval< T, CMP >::overlap(), ThePEG::PDFCuts::scaleMin(), and ThePEG::Interval< T, CMP >::sum().
|
inline |
Set the lower limit of the interval.
Definition at line 151 of file Interval.h.
References ThePEG::Interval< T, CMP >::theLimits.
|
inline |
Returns true if x is within the interval.
Definition at line 66 of file Interval.h.
References ThePEG::Interval< T, CMP >::includes().
|
inline |
Test for ordering.
Definition at line 53 of file Interval.h.
References ThePEG::Interval< T, CMP >::cmp, ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
inline |
Test for equality.
Definition at line 44 of file Interval.h.
References ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
inline |
If this interval operlaps with i return the overlapping interval.
Definition at line 113 of file Interval.h.
References ThePEG::Interval< T, CMP >::includes(), ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
inline |
If this interval operlaps with i return the union of the two intervals.
Definition at line 125 of file Interval.h.
References ThePEG::Interval< T, CMP >::includes(), ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().
|
inline |
Return the upper limit of the interval.
Definition at line 136 of file Interval.h.
References ThePEG::Interval< T, CMP >::theLimits.
Referenced by ThePEG::Interval< T, CMP >::check(), ThePEG::Interval< T, CMP >::chopLower(), ThePEG::Interval< T, CMP >::chopUpper(), ThePEG::Interval< T, CMP >::includes(), ThePEG::PDFCuts::lMax(), ThePEG::Interval< T, CMP >::operator<(), ThePEG::operator<<(), ThePEG::Interval< T, CMP >::operator==(), ThePEG::operator>>(), ThePEG::ounitstream(), ThePEG::Interval< T, CMP >::overlap(), ThePEG::PDFCuts::scaleMax(), and ThePEG::Interval< T, CMP >::sum().
|
inline |
Set the upper limit of the interval.
Definition at line 146 of file Interval.h.
References ThePEG::Interval< T, CMP >::theLimits.
|
staticprivate |
The object used for comparisons.
Definition at line 187 of file Interval.h.
Referenced by ThePEG::Interval< T, CMP >::check(), ThePEG::Interval< T, CMP >::includes(), and ThePEG::Interval< T, CMP >::operator<().
|
private |
The lower and upper limit of this interval.
Definition at line 184 of file Interval.h.
Referenced by ThePEG::Interval< T, CMP >::lower(), and ThePEG::Interval< T, CMP >::upper().