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

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

#include <Bpp/Numeric/Range.h>

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

Public Member Functions

 MultiRange ()
 
 MultiRange (const MultiRange< T > &mr)
 
MultiRangeoperator= (const MultiRange< T > &mr)
 
virtual ~MultiRange ()
 
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
 
std::vector< T > getBounds () const
 
bool isEmpty () const
 
size_t size () const
 
size_t totalLength () const
 
const Range< T > & getRange (size_t i) const
 
void clear ()
 Clear the collection. More...
 

Private Member Functions

void clean_ ()
 
void clear_ ()
 

Private Attributes

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

Detailed Description

template<class T>
class bpp::MultiRange< T >

This class implements a data structure describing a set of non-overlapping intervals.

Definition at line 392 of file Range.h.

Constructor & Destructor Documentation

◆ MultiRange() [1/2]

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

Definition at line 399 of file Range.h.

◆ MultiRange() [2/2]

template<class T>
bpp::MultiRange< T >::MultiRange ( const MultiRange< T > &  mr)
inline

Definition at line 401 of file Range.h.

References bpp::MultiRange< T >::ranges_.

◆ ~MultiRange()

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

Definition at line 419 of file Range.h.

Member Function Documentation

◆ addRange()

template<class T>
void bpp::MultiRange< 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 425 of file Range.h.

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

◆ clean_()

template<class T>
void bpp::MultiRange< T >::clean_ ( )
inlineprivate

Definition at line 536 of file Range.h.

References comp().

◆ clear()

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

Clear the collection.

Implements bpp::RangeCollection< T >.

Definition at line 530 of file Range.h.

◆ clear_()

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

Definition at line 558 of file Range.h.

◆ filterWithin()

template<class T>
void bpp::MultiRange< 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 466 of file Range.h.

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

◆ getBounds()

template<class T>
std::vector<T> bpp::MultiRange< T >::getBounds ( ) const
inline
Returns
A vector with all interval bounds.

Definition at line 500 of file Range.h.

◆ getRange()

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

Implements bpp::RangeCollection< T >.

Definition at line 528 of file Range.h.

◆ isEmpty()

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

Implements bpp::RangeCollection< T >.

Definition at line 514 of file Range.h.

◆ operator=()

template<class T>
MultiRange& bpp::MultiRange< T >::operator= ( const MultiRange< T > &  mr)
inline

Definition at line 409 of file Range.h.

References bpp::MultiRange< T >::ranges_.

◆ restrictTo()

template<class T>
void bpp::MultiRange< 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 457 of file Range.h.

◆ size()

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

Implements bpp::RangeCollection< T >.

Definition at line 516 of file Range.h.

◆ toString()

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

Implements bpp::RangeCollection< T >.

Definition at line 486 of file Range.h.

◆ totalLength()

template<class T>
size_t bpp::MultiRange< T >::totalLength ( ) const
inlinevirtual
Returns
The number of positions in the collection.

Implements bpp::RangeCollection< T >.

Definition at line 518 of file Range.h.

Member Data Documentation

◆ ranges_

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

Definition at line 396 of file Range.h.

Referenced by bpp::MultiRange< T >::MultiRange(), and bpp::MultiRange< T >::operator=().


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