SciDAVis  1.D4
Public Member Functions | Static Public Member Functions | Protected Attributes
IntervalBase< T > Class Template Reference

#include <Interval.h>

Inheritance diagram for IntervalBase< T >:
Interval< T >

List of all members.

Public Member Functions

bool contains (const Interval< T > &other) const
bool contains (T value) const
end () const
bool intersects (const Interval< T > &other) const
 IntervalBase ()
 IntervalBase (const IntervalBase< T > &other)
 IntervalBase (T start, T end)
QList< Interval< T > > operator- (QList< Interval< T > > subtrahend)
Interval< T > & operator= (const Interval< T > &other)
bool operator== (const Interval< T > &other) const
void setEnd (T end)
void setStart (T start)
start () const
QString toString () const
 Return a string in the format '[start,end]'.
virtual bool touches (const Interval< T > &other) const =0
 Returns true if no gap is between two intervals.
void translate (T offset)
virtual ~IntervalBase ()

Static Public Member Functions

static Interval< T > intersection (const Interval< T > &first, const Interval< T > &second)
 Return the intersection of two intervals.
static Interval< T > merge (const Interval< T > &a, const Interval< T > &b)
 Merge two intervals that touch or intersect.
static void mergeIntervalIntoList (QList< Interval< T > > *list, Interval< T > i)
 Merge an interval into a list.
static void restrictList (QList< Interval< T > > *list, Interval< T > i)
 Restrict all intervals in the list to their intersection with a given interval.
static QList< Interval< T > > split (const Interval< T > &i, T before)
 Split an interval into two.
static QList< Interval< T > > subtract (const Interval< T > &src_iv, const Interval< T > &minus_iv)
 Subtract an interval from another.
static void subtractIntervalFromList (QList< Interval< T > > *list, Interval< T > i)
 Subtract an interval from all intervals in the list.

Protected Attributes

d_end
 Interval end.
d_start
 Interval start.

Constructor & Destructor Documentation

template<class T>
IntervalBase< T >::IntervalBase ( )
inline
template<class T>
IntervalBase< T >::IntervalBase ( const IntervalBase< T > &  other)
inline
template<class T>
IntervalBase< T >::IntervalBase ( start,
end 
)
inline
template<class T>
virtual IntervalBase< T >::~IntervalBase ( )
inlinevirtual

Member Function Documentation

template<class T>
bool IntervalBase< T >::contains ( const Interval< T > &  other) const
inline
template<class T>
bool IntervalBase< T >::contains ( value) const
inline
template<class T>
T IntervalBase< T >::end ( ) const
inline
template<class T>
static Interval<T> IntervalBase< T >::intersection ( const Interval< T > &  first,
const Interval< T > &  second 
)
inlinestatic

Return the intersection of two intervals.

This function returns an invalid interval if the two intervals do not intersect.

Referenced by IntervalBase< long double >::restrictList().

template<class T>
bool IntervalBase< T >::intersects ( const Interval< T > &  other) const
inline
template<class T>
static Interval<T> IntervalBase< T >::merge ( const Interval< T > &  a,
const Interval< T > &  b 
)
inlinestatic

Merge two intervals that touch or intersect.

Referenced by IntervalBase< long double >::mergeIntervalIntoList().

template<class T>
static void IntervalBase< T >::mergeIntervalIntoList ( QList< Interval< T > > *  list,
Interval< T >  i 
)
inlinestatic

Merge an interval into a list.

Referenced by IntervalBase< long double >::mergeIntervalIntoList().

template<class T>
QList< Interval<T> > IntervalBase< T >::operator- ( QList< Interval< T > >  subtrahend)
inline
template<class T>
Interval<T>& IntervalBase< T >::operator= ( const Interval< T > &  other)
inline
template<class T>
bool IntervalBase< T >::operator== ( const Interval< T > &  other) const
inline
template<class T>
static void IntervalBase< T >::restrictList ( QList< Interval< T > > *  list,
Interval< T >  i 
)
inlinestatic

Restrict all intervals in the list to their intersection with a given interval.

Remark: This may decrease the list size.

template<class T>
void IntervalBase< T >::setEnd ( end)
inline
template<class T>
void IntervalBase< T >::setStart ( start)
inline
template<class T>
static QList< Interval<T> > IntervalBase< T >::split ( const Interval< T > &  i,
before 
)
inlinestatic

Split an interval into two.

template<class T>
T IntervalBase< T >::start ( ) const
inline
template<class T>
static QList< Interval<T> > IntervalBase< T >::subtract ( const Interval< T > &  src_iv,
const Interval< T > &  minus_iv 
)
inlinestatic
template<class T>
static void IntervalBase< T >::subtractIntervalFromList ( QList< Interval< T > > *  list,
Interval< T >  i 
)
inlinestatic

Subtract an interval from all intervals in the list.

Remark: This may increase or decrease the list size.

template<class T>
QString IntervalBase< T >::toString ( ) const
inline

Return a string in the format '[start,end]'.

template<class T>
virtual bool IntervalBase< T >::touches ( const Interval< T > &  other) const
pure virtual

Returns true if no gap is between two intervals.

Implemented in Interval< long double >, Interval< double >, Interval< float >, Interval< T >, and Interval< int >.

template<class T>
void IntervalBase< T >::translate ( offset)
inline

Member Data Documentation

template<class T>
T IntervalBase< T >::d_end
protected
template<class T>
T IntervalBase< T >::d_start
protected

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