bpp-phyl3  3.0.0
bpp::LegacyAbstractRewardMapping Class Referenceabstract

Partial implementation of the reward mapping interface. More...

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

+ Inheritance diagram for bpp::LegacyAbstractRewardMapping:
+ Collaboration diagram for bpp::LegacyAbstractRewardMapping:

Public Member Functions

 LegacyAbstractRewardMapping (const Tree &tree)
 
 LegacyAbstractRewardMapping (const LegacyAbstractRewardMapping &arm)=default
 
LegacyAbstractRewardMappingclone () const override=0
 
LegacyAbstractRewardMappingoperator= (const LegacyAbstractRewardMapping &arm)=default
 
virtual ~LegacyAbstractRewardMapping ()
 
virtual double & operator() (size_t nodeIndex, size_t siteIndex)=0
 
virtual const double & operator() (size_t nodeIndex, size_t siteIndex) const =0
 
virtual const Treetree () const =0
 
virtual bool isEmpty () const =0
 
virtual size_t getNumberOfSites () const =0
 
virtual size_t getNumberOfBranches () const =0
 
virtual int getSitePosition (size_t index) const =0
 
virtual std::vector< double > getBranchLengths () const =0
 
virtual size_t getNodeIndex (int nodeId) const =0
 
virtual void setSitePosition (size_t index, int position)=0
 Set the position of a given site. More...
 
bool isEmpty () const override
 
const TreeTemplate< Node > & tree () const override
 
void setTree (const Tree &tree)
 
int getSitePosition (size_t index) const override
 
void setSitePosition (size_t index, int position) override
 Set the position of a given site. More...
 
size_t getNumberOfSites () const override
 
size_t getNumberOfBranches () const override
 
virtual const NodegetNode (size_t nodeIndex) const
 
virtual void setNumberOfSites (size_t numberOfSites)
 
virtual std::vector< double > getBranchLengths () const override
 
virtual size_t getNodeIndex (int nodeId) const override
 

Private Attributes

std::unique_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 reward mapping interface.

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

Definition at line 46 of file RewardMapping.h.

Constructor & Destructor Documentation

◆ LegacyAbstractRewardMapping() [1/2]

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

Definition at line 51 of file RewardMapping.h.

◆ LegacyAbstractRewardMapping() [2/2]

bpp::LegacyAbstractRewardMapping::LegacyAbstractRewardMapping ( const LegacyAbstractRewardMapping arm)
default

◆ ~LegacyAbstractRewardMapping()

virtual bpp::LegacyAbstractRewardMapping::~LegacyAbstractRewardMapping ( )
inlinevirtual

Definition at line 59 of file RewardMapping.h.

Member Function Documentation

◆ clone()

LegacyAbstractRewardMapping* bpp::LegacyAbstractRewardMapping::clone ( ) const
overridepure virtual

◆ getBranchLengths() [1/2]

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

Implemented in bpp::LegacyAbstractMapping.

◆ getBranchLengths() [2/2]

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

Implements bpp::LegacyMappingInterface.

Definition at line 174 of file Mapping.h.

References bpp::LegacyAbstractMapping::nbBranches_, and bpp::LegacyAbstractMapping::nodes_.

◆ getNode()

virtual const Node* bpp::LegacyAbstractMapping::getNode ( size_t  nodeIndex) const
inlinevirtualinherited

◆ getNodeIndex() [1/2]

virtual size_t bpp::LegacyMappingInterface::getNodeIndex ( int  nodeId) const
pure virtualinherited
Parameters
nodeIdAn id of the node to look for in the map.
Returns
The mapping index for the specified node id.

Implemented in bpp::LegacyAbstractMapping.

◆ getNodeIndex() [2/2]

virtual size_t bpp::LegacyAbstractMapping::getNodeIndex ( int  nodeId) const
inlineoverridevirtualinherited

◆ getNumberOfBranches() [1/2]

◆ getNumberOfBranches() [2/2]

◆ getNumberOfSites() [1/2]

virtual size_t bpp::LegacyMappingInterface::getNumberOfSites ( ) const
pure virtualinherited

◆ getNumberOfSites() [2/2]

size_t bpp::LegacyAbstractMapping::getNumberOfSites ( ) const
inlineoverridevirtualinherited

◆ getSitePosition() [1/2]

virtual int bpp::LegacyMappingInterface::getSitePosition ( size_t  index) const
pure virtualinherited
Parameters
indexThe site index.
Returns
The site position corresponding to the index.

Implemented in bpp::LegacyAbstractMapping.

◆ getSitePosition() [2/2]

int bpp::LegacyAbstractMapping::getSitePosition ( size_t  index) const
inlineoverridevirtualinherited
Parameters
indexThe site index.
Returns
The site position corresponding to the index.

Implements bpp::LegacyMappingInterface.

Definition at line 146 of file Mapping.h.

References bpp::LegacyAbstractMapping::isEmpty(), and bpp::LegacyAbstractMapping::sitesPositions_.

◆ isEmpty() [1/2]

virtual bool bpp::LegacyMappingInterface::isEmpty ( ) const
pure virtualinherited
Returns
True is the map is empty, that is, if no tree is associated to the map yet.

Implemented in bpp::LegacyAbstractMapping.

◆ isEmpty() [2/2]

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

Implements bpp::LegacyMappingInterface.

Definition at line 130 of file Mapping.h.

References bpp::LegacyAbstractMapping::tree_.

Referenced by bpp::LegacyAbstractMapping::getSitePosition(), bpp::LegacyAbstractMapping::setSitePosition(), and bpp::LegacyAbstractMapping::tree().

◆ operator()() [1/2]

virtual const double& bpp::LegacyRewardMappingInterface::operator() ( size_t  nodeIndex,
size_t  siteIndex 
) const
pure virtualinherited

◆ operator()() [2/2]

virtual double& bpp::LegacyRewardMappingInterface::operator() ( size_t  nodeIndex,
size_t  siteIndex 
)
pure virtualinherited

◆ operator=()

LegacyAbstractRewardMapping& bpp::LegacyAbstractRewardMapping::operator= ( const LegacyAbstractRewardMapping arm)
default

◆ setNumberOfSites()

virtual void bpp::LegacyAbstractMapping::setNumberOfSites ( size_t  numberOfSites)
inlinevirtualinherited

◆ setSitePosition() [1/2]

void bpp::LegacyAbstractMapping::setSitePosition ( size_t  index,
int  position 
)
inlineoverridevirtualinherited

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::LegacyMappingInterface.

Definition at line 152 of file Mapping.h.

References bpp::LegacyAbstractMapping::isEmpty(), and bpp::LegacyAbstractMapping::sitesPositions_.

Referenced by bpp::LegacyRewardMappingTools::readFromStream(), and bpp::LegacySubstitutionMappingTools::readFromStream().

◆ setSitePosition() [2/2]

virtual void bpp::LegacyMappingInterface::setSitePosition ( size_t  index,
int  position 
)
pure virtualinherited

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.

Implemented in bpp::LegacyAbstractMapping.

◆ setTree()

◆ tree() [1/2]

virtual const Tree& bpp::LegacyMappingInterface::tree ( ) const
pure virtualinherited
Returns
Get the phylogenetic tree associated to this mapping.

Implemented in bpp::LegacyAbstractMapping.

◆ tree() [2/2]

const TreeTemplate<Node>& bpp::LegacyAbstractMapping::tree ( ) const
inlineoverridevirtualinherited

Member Data Documentation

◆ nbBranches_

◆ nbSites_

size_t bpp::LegacyAbstractMapping::nbSites_
privateinherited

◆ nodes_

◆ sitesPositions_

std::vector<int> bpp::LegacyAbstractMapping::sitesPositions_
privateinherited

◆ tree_


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