bpp-phyl  2.2.0
bpp::AbstractMapping Class Referenceabstract

Partial implementation of the mapping interface. More...

#include <Bpp/Phyl/Mapping/Mapping.h>

+ Inheritance diagram for bpp::AbstractMapping:
+ Collaboration diagram for bpp::AbstractMapping:

Public Member Functions

 AbstractMapping (const Tree &tree)
 
 AbstractMapping (const AbstractMapping &absm)
 
AbstractMappingoperator= (const AbstractMapping &absm)
 
AbstractMappingclone () const =0
 
virtual ~AbstractMapping ()
 
bool isEmpty () const
 
const TreeTemplate< Node > & getTree () const throw (Exception)
 
void setTree (const Tree &tree)
 
int getSitePosition (size_t index) const throw (Exception)
 
void setSitePosition (size_t index, int position) throw (Exception)
 Set the position of a given site. More...
 
size_t getNumberOfSites () const
 
size_t getNumberOfBranches () const
 
virtual const NodegetNode (size_t nodeIndex) const
 
virtual void setNumberOfSites (size_t numberOfSites)
 
virtual std::vector< double > getBranchLengths () const
 
virtual size_t getNodeIndex (int nodeId) const throw (NodeNotFoundException)
 

Private Attributes

std::auto_ptr< const TreeTemplate< Node > > tree_
 
std::vector< int > sitesPositions_
 
std::vector< const Node * > nodes_
 
size_t nbSites_
 
size_t nbBranches_
 

Detailed Description

Partial implementation of the mapping interface.

This implementation copies the input tree in a TreeTemplate<Node> object.

Definition at line 130 of file Mapping.h.

Constructor & Destructor Documentation

◆ AbstractMapping() [1/2]

bpp::AbstractMapping::AbstractMapping ( const Tree tree)
inline

Definition at line 143 of file Mapping.h.

References nbBranches_, nodes_, and tree_.

◆ AbstractMapping() [2/2]

bpp::AbstractMapping::AbstractMapping ( const AbstractMapping absm)
inline

Definition at line 150 of file Mapping.h.

References nodes_, and tree_.

◆ ~AbstractMapping()

virtual bpp::AbstractMapping::~AbstractMapping ( )
inlinevirtual

Definition at line 176 of file Mapping.h.

Member Function Documentation

◆ clone()

◆ getBranchLengths()

virtual std::vector<double> bpp::AbstractMapping::getBranchLengths ( ) const
inlinevirtual
Returns
A vector with all tree branch lengths.

Implements bpp::Mapping.

Definition at line 222 of file Mapping.h.

References nbBranches_, and nodes_.

◆ getNode()

virtual const Node* bpp::AbstractMapping::getNode ( size_t  nodeIndex) const
inlinevirtual

Definition at line 212 of file Mapping.h.

References nodes_.

◆ getNodeIndex()

virtual size_t bpp::AbstractMapping::getNodeIndex ( int  nodeId) const
throw (NodeNotFoundException
)
inlinevirtual

◆ getNumberOfBranches()

size_t bpp::AbstractMapping::getNumberOfBranches ( ) const
inlinevirtual

◆ getNumberOfSites()

◆ getSitePosition()

int bpp::AbstractMapping::getSitePosition ( size_t  index) const
throw (Exception
)
inlinevirtual
Parameters
indexThe site index.
Returns
The site position corresponding to the index.

Implements bpp::Mapping.

Definition at line 196 of file Mapping.h.

References isEmpty(), and sitesPositions_.

◆ getTree()

const TreeTemplate<Node>& bpp::AbstractMapping::getTree ( ) const
throw (Exception
)
inlinevirtual
Returns
Get the phylogenetic tree associated to this mapping.

Implements bpp::Mapping.

Definition at line 182 of file Mapping.h.

References isEmpty(), and tree_.

◆ isEmpty()

bool bpp::AbstractMapping::isEmpty ( ) const
inlinevirtual
Returns
True is the map is empty, that is, if no tree is associated to the map yet.

Implements bpp::Mapping.

Definition at line 180 of file Mapping.h.

References tree_.

Referenced by getSitePosition(), getTree(), and setSitePosition().

◆ operator=()

AbstractMapping& bpp::AbstractMapping::operator= ( const AbstractMapping absm)
inline

◆ setNumberOfSites()

virtual void bpp::AbstractMapping::setNumberOfSites ( size_t  numberOfSites)
inlinevirtual

◆ setSitePosition()

void bpp::AbstractMapping::setSitePosition ( size_t  index,
int  position 
)
throw (Exception
)
inlinevirtual

Set the position of a given site.

Warning
No index checking is performed, use with care!
Parameters
indexThe site index.
positionThe position of the site.

Implements bpp::Mapping.

Definition at line 202 of file Mapping.h.

References isEmpty(), and sitesPositions_.

◆ setTree()

void bpp::AbstractMapping::setTree ( const Tree tree)
inline

Member Data Documentation

◆ nbBranches_

size_t bpp::AbstractMapping::nbBranches_
private

◆ nbSites_

size_t bpp::AbstractMapping::nbSites_
private

Definition at line 137 of file Mapping.h.

Referenced by getNumberOfSites(), operator=(), and setNumberOfSites().

◆ nodes_

std::vector<const Node *> bpp::AbstractMapping::nodes_
private

Definition at line 136 of file Mapping.h.

Referenced by AbstractMapping(), getBranchLengths(), getNode(), getNodeIndex(), operator=(), and setTree().

◆ sitesPositions_

std::vector<int> bpp::AbstractMapping::sitesPositions_
private

Definition at line 135 of file Mapping.h.

Referenced by getSitePosition(), operator=(), setNumberOfSites(), and setSitePosition().

◆ tree_

std::auto_ptr<const TreeTemplate<Node> > bpp::AbstractMapping::tree_
private

Definition at line 134 of file Mapping.h.

Referenced by AbstractMapping(), getTree(), isEmpty(), operator=(), and setTree().


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