bpp-core3  3.0.0
bpp::RangeSet< T > Class Template Reference

This class implements a data structure describing a set of intervals. More...

#include <Bpp/Numeric/Range.h>

+ Inheritance diagram for bpp::RangeSet< T >:
+ Collaboration diagram for bpp::RangeSet< T >:

Public Member Functions

 RangeSet ()
 
 RangeSet (const RangeSet< T > &set)
 
RangeSetoperator= (const RangeSet< T > &set)
 
virtual ~RangeSet ()
 
void addRange (const Range< T > &r)
 Add a new range to the collection. More...
 
void restrictTo (const Range< T > &r)
 Get the intersection with a given range. More...
 
void filterWithin (const Range< T > &r)
 Only keep the ranges that fall within the given range. More...
 
std::string toString () const
 
bool isEmpty () const
 
size_t size () const
 
size_t totalLength () const
 
const Range< T > & getRange (size_t i) const
 
const std::vector< Range< T > *> & getSet () const
 
std::vector< Range< T > *> & getSet ()
 
void clear ()
 Clear the collection. More...
 

Private Member Functions

void clear_ ()
 

Private Attributes

std::vector< Range< T > *> ranges_
 

Detailed Description

template<class T>
class bpp::RangeSet< T >

This class implements a data structure describing a set of intervals.

Intervals can be overlapping, but empty intervals will be ignored/removed.

Definition at line 260 of file Range.h.

Constructor & Destructor Documentation

◆ RangeSet() [1/2]

template<class T >
bpp::RangeSet< T >::RangeSet ( )
inline

Definition at line 269 of file Range.h.

◆ RangeSet() [2/2]

template<class T >
bpp::RangeSet< T >::RangeSet ( const RangeSet< T > &  set)
inline

Definition at line 271 of file Range.h.

◆ ~RangeSet()

template<class T >
virtual bpp::RangeSet< T >::~RangeSet ( )
inlinevirtual

Definition at line 289 of file Range.h.

Member Function Documentation

◆ addRange()

template<class T >
void bpp::RangeSet< T >::addRange ( const Range< T > &  r)
inlinevirtual

Add a new range to the collection.

Parameters
rThe range to add to the collection.

Implements bpp::RangeCollection< T >.

Definition at line 295 of file Range.h.

References bpp::Range< T >::clone(), and bpp::Range< T >::isEmpty().

◆ clear()

template<class T >
void bpp::RangeSet< T >::clear ( )
inlinevirtual

Clear the collection.

Implements bpp::RangeCollection< T >.

Definition at line 373 of file Range.h.

◆ clear_()

template<class T >
void bpp::RangeSet< T >::clear_ ( )
inlineprivate

Definition at line 379 of file Range.h.

◆ filterWithin()

template<class T >
void bpp::RangeSet< T >::filterWithin ( const Range< T > &  r)
inlinevirtual

Only keep the ranges that fall within the given range.

Parameters
rRestriction range.

Implements bpp::RangeCollection< T >.

Definition at line 319 of file Range.h.

References bpp::Range< T >::contains().

◆ getRange()

template<class T >
const Range<T>& bpp::RangeSet< T >::getRange ( size_t  i) const
inlinevirtual
Returns
The ith range in the collection.

Implements bpp::RangeCollection< T >.

Definition at line 364 of file Range.h.

◆ getSet() [1/2]

template<class T >
const std::vector< Range<T>* >& bpp::RangeSet< T >::getSet ( ) const
inline

Definition at line 369 of file Range.h.

◆ getSet() [2/2]

template<class T >
std::vector< Range<T>* >& bpp::RangeSet< T >::getSet ( )
inline

Definition at line 371 of file Range.h.

◆ isEmpty()

template<class T >
bool bpp::RangeSet< T >::isEmpty ( ) const
inlinevirtual
Returns
True if the set does not contain any range.

Implements bpp::RangeCollection< T >.

Definition at line 347 of file Range.h.

◆ operator=()

template<class T >
RangeSet& bpp::RangeSet< T >::operator= ( const RangeSet< T > &  set)
inline

Definition at line 279 of file Range.h.

◆ restrictTo()

template<class T >
void bpp::RangeSet< T >::restrictTo ( const Range< T > &  r)
inlinevirtual

Get the intersection with a given range.

The new multirange is the union of all ranges intersections with the given range.

Parameters
rRestriction range.

Implements bpp::RangeCollection< T >.

Definition at line 301 of file Range.h.

◆ size()

template<class T >
size_t bpp::RangeSet< T >::size ( ) const
inlinevirtual
Returns
The number of ranges in the collection.

Implements bpp::RangeCollection< T >.

Definition at line 349 of file Range.h.

◆ toString()

template<class T >
std::string bpp::RangeSet< T >::toString ( ) const
inlinevirtual
Returns
A string representation of the set of intervals.

Implements bpp::RangeCollection< T >.

Definition at line 336 of file Range.h.

◆ totalLength()

template<class T >
size_t bpp::RangeSet< T >::totalLength ( ) const
inlinevirtual
Returns
The total length of the range set. Overlapping positions will be counted several times.

Implements bpp::RangeCollection< T >.

Definition at line 354 of file Range.h.

Member Data Documentation

◆ ranges_

template<class T >
std::vector< Range<T>* > bpp::RangeSet< T >::ranges_
private

Definition at line 266 of file Range.h.


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