bpp-phyl  2.2.0
bpp::AbstractStateMap Class Referenceabstract

A convenience partial implementation of the StateMap interface. More...

#include <Bpp/Phyl/Model/StateMap.h>

+ Inheritance diagram for bpp::AbstractStateMap:
+ Collaboration diagram for bpp::AbstractStateMap:

Public Member Functions

 AbstractStateMap (const Alphabet *alphabet)
 
 AbstractStateMap (const AbstractStateMap &absm)
 
AbstractStateMapoperator= (const AbstractStateMap &absm)
 
virtual const Alphabet * getAlphabet () const
 
virtual size_t getNumberOfModelStates () const
 
virtual const std::vector< int > & getAlphabetStates () const
 
virtual int getAlphabetStateAsInt (size_t index) const
 
virtual std::string getAlphabetStateAsChar (size_t index) const
 
virtual std::vector< size_t > getModelStates (int code) const
 
virtual std::vector< size_t > getModelStates (const std::string &code) const
 
virtual StateMapclone () const =0
 

Protected Attributes

const Alphabet * alphabet_
 
std::vector< int > states_
 

Detailed Description

A convenience partial implementation of the StateMap interface.

Model states are stored as their corresponding int codes, stored in a vector 'states_'. This vector has to be initialized and filled by the derived class.

Definition at line 115 of file StateMap.h.

Constructor & Destructor Documentation

◆ AbstractStateMap() [1/2]

bpp::AbstractStateMap::AbstractStateMap ( const Alphabet *  alphabet)
inline

Definition at line 123 of file StateMap.h.

◆ AbstractStateMap() [2/2]

bpp::AbstractStateMap::AbstractStateMap ( const AbstractStateMap absm)
inline

Definition at line 128 of file StateMap.h.

Member Function Documentation

◆ clone()

◆ getAlphabet()

virtual const Alphabet* bpp::AbstractStateMap::getAlphabet ( ) const
inlinevirtual
Returns
The associated alphabet.

Implements bpp::StateMap.

Definition at line 141 of file StateMap.h.

References alphabet_.

◆ getAlphabetStateAsChar()

virtual std::string bpp::AbstractStateMap::getAlphabetStateAsChar ( size_t  index) const
inlinevirtual
Parameters
indexThe model state.
Returns
The corresponding alphabet state as character code.

Implements bpp::StateMap.

Definition at line 145 of file StateMap.h.

References alphabet_, and states_.

Referenced by bpp::MarkovModulatedSubstitutionModel::getAlphabetStateAsChar().

◆ getAlphabetStateAsInt()

virtual int bpp::AbstractStateMap::getAlphabetStateAsInt ( size_t  index) const
inlinevirtual
Parameters
indexThe model state.
Returns
The corresponding alphabet state as int code.

Implements bpp::StateMap.

Definition at line 144 of file StateMap.h.

References states_.

Referenced by bpp::MarkovModulatedSubstitutionModel::getAlphabetStateAsInt().

◆ getAlphabetStates()

virtual const std::vector<int>& bpp::AbstractStateMap::getAlphabetStates ( ) const
inlinevirtual
Returns
A vector with the corresponding alphabet states for each model state. the size of the vector is the number of model states, not the number of supported alphabet states, as distinct model states can correspond to a single alphabet state.

Implements bpp::StateMap.

Definition at line 143 of file StateMap.h.

References states_.

Referenced by bpp::MarkovModulatedSubstitutionModel::getAlphabetStates().

◆ getModelStates() [1/2]

virtual std::vector<size_t> bpp::AbstractStateMap::getModelStates ( int  code) const
inlinevirtual
Parameters
codeThe int code of the alphabet state to check.
Returns
The corresponding model states, is any.

Implements bpp::StateMap.

Definition at line 146 of file StateMap.h.

References states_.

Referenced by bpp::MarkovModulatedSubstitutionModel::getModelStates().

◆ getModelStates() [2/2]

virtual std::vector<size_t> bpp::AbstractStateMap::getModelStates ( const std::string &  code) const
inlinevirtual
Parameters
codeThe character code of the alphabet state to check.
Returns
The corresponding model states, is any.

Implements bpp::StateMap.

Definition at line 149 of file StateMap.h.

References alphabet_, and states_.

◆ getNumberOfModelStates()

virtual size_t bpp::AbstractStateMap::getNumberOfModelStates ( ) const
inlinevirtual
Returns
The number of states supported by the model.

Implements bpp::StateMap.

Definition at line 142 of file StateMap.h.

References states_.

◆ operator=()

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

Definition at line 133 of file StateMap.h.

References alphabet_, and states_.

Member Data Documentation

◆ alphabet_

const Alphabet* bpp::AbstractStateMap::alphabet_
protected

Definition at line 119 of file StateMap.h.

Referenced by getAlphabet(), getAlphabetStateAsChar(), getModelStates(), and operator=().

◆ states_


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