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 296 of file Range.h.

Constructor & Destructor Documentation

◆ RangeSet() [1/2]

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

Definition at line 305 of file Range.h.

◆ RangeSet() [2/2]

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

Definition at line 307 of file Range.h.

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

◆ ~RangeSet()

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

Definition at line 325 of file Range.h.

References bpp::RangeSet< T >::clear_().

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 331 of file Range.h.

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

◆ clear()

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

Clear the collection.

Implements bpp::RangeCollection< T >.

Definition at line 409 of file Range.h.

References bpp::RangeSet< T >::clear_().

◆ clear_()

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

◆ 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 355 of file Range.h.

References bpp::Range< T >::contains(), and bpp::RangeSet< T >::ranges_.

◆ 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 400 of file Range.h.

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

◆ getSet() [1/2]

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

Definition at line 407 of file Range.h.

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

◆ getSet() [2/2]

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

Definition at line 405 of file Range.h.

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

◆ 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 383 of file Range.h.

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

◆ operator=()

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

Definition at line 315 of file Range.h.

References bpp::RangeSet< T >::clear_(), and bpp::RangeSet< T >::ranges_.

◆ 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 337 of file Range.h.

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

◆ 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 385 of file Range.h.

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

◆ 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 372 of file Range.h.

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

◆ 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 390 of file Range.h.

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

Member Data Documentation

◆ ranges_


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