bpp-seq  2.2.0
bpp::SimpleIndexDistance Class Reference

Simple dissimilarity distance. More...

#include <Bpp/Seq/AlphabetIndex/SimpleIndexDistance.h>

+ Inheritance diagram for bpp::SimpleIndexDistance:
+ Collaboration diagram for bpp::SimpleIndexDistance:

Public Member Functions

 SimpleIndexDistance (AlphabetIndex1 *index)
 
 SimpleIndexDistance (const SimpleIndexDistance &sid)
 
SimpleIndexDistanceoperator= (const SimpleIndexDistance &sid)
 
virtual ~SimpleIndexDistance ()
 
double getIndex (int state1, int state2) const throw (BadIntException)
 Get the index associated to a pair of states. More...
 
double getIndex (const std::string &state1, const std::string &state2) const throw (BadCharException)
 Get the index associated to a pair of states. More...
 
const AlphabetgetAlphabet () const
 Get the alphabet associated to this index. More...
 
SimpleIndexDistanceclone () const
 
Matrix< double > * getIndexMatrix () const
 
void setSymmetric (bool yn)
 
bool isSymmetric () const
 
const AlphabetIndex1getAlphabetIndex1 () const
 
AlphabetIndex1getAlphabetIndex1 ()
 

Private Attributes

std::auto_ptr< AlphabetIndex1index_
 
bool sym_
 

Detailed Description

Simple dissimilarity distance.

Take a one-dimensional index end return the difference between the indexes of two states.

Definition at line 61 of file SimpleIndexDistance.h.

Constructor & Destructor Documentation

◆ SimpleIndexDistance() [1/2]

bpp::SimpleIndexDistance::SimpleIndexDistance ( AlphabetIndex1 index)
inline

Definition at line 69 of file SimpleIndexDistance.h.

Referenced by clone().

◆ SimpleIndexDistance() [2/2]

bpp::SimpleIndexDistance::SimpleIndexDistance ( const SimpleIndexDistance sid)
inline

Definition at line 74 of file SimpleIndexDistance.h.

◆ ~SimpleIndexDistance()

virtual bpp::SimpleIndexDistance::~SimpleIndexDistance ( )
inlinevirtual

Definition at line 86 of file SimpleIndexDistance.h.

Member Function Documentation

◆ clone()

SimpleIndexDistance* bpp::SimpleIndexDistance::clone ( ) const
inlinevirtual

Implements bpp::AlphabetIndex2.

Definition at line 103 of file SimpleIndexDistance.h.

References SimpleIndexDistance().

◆ getAlphabet()

const Alphabet* bpp::SimpleIndexDistance::getAlphabet ( ) const
inlinevirtual

Get the alphabet associated to this index.

Returns
Alphabet The alphabet associated to this index.

Implements bpp::AlphabetIndex2.

Definition at line 101 of file SimpleIndexDistance.h.

References index_.

◆ getAlphabetIndex1() [1/2]

const AlphabetIndex1& bpp::SimpleIndexDistance::getAlphabetIndex1 ( ) const
inline
Returns
The AlphabetIndex1 object associated to this object.

Definition at line 125 of file SimpleIndexDistance.h.

References index_.

◆ getAlphabetIndex1() [2/2]

AlphabetIndex1& bpp::SimpleIndexDistance::getAlphabetIndex1 ( )
inline
Returns
The AlphabetIndex1 object associated to this object.

Definition at line 129 of file SimpleIndexDistance.h.

References index_.

◆ getIndex() [1/2]

double bpp::SimpleIndexDistance::getIndex ( int  state1,
int  state2 
) const
throw (BadIntException
)
inlinevirtual

Get the index associated to a pair of states.

Parameters
state1First state to consider, as a int value.
state2Second state to consider, as a int value.
Returns
The index associated to the pair of states.

Implements bpp::AlphabetIndex2.

Definition at line 89 of file SimpleIndexDistance.h.

References index_, and sym_.

Referenced by getIndexMatrix().

◆ getIndex() [2/2]

double bpp::SimpleIndexDistance::getIndex ( const std::string &  state1,
const std::string &  state2 
) const
throw (BadCharException
)
inlinevirtual

Get the index associated to a pair of states.

Parameters
state1First state to consider, as a string value.
state2Second state to consider, as a string value.
Returns
The index associated to the pair of states.

Implements bpp::AlphabetIndex2.

Definition at line 95 of file SimpleIndexDistance.h.

References index_, and sym_.

◆ getIndexMatrix()

Matrix<double>* bpp::SimpleIndexDistance::getIndexMatrix ( ) const
inlinevirtual
Returns
A matrix object with all indices.

Implements bpp::AlphabetIndex2.

Definition at line 105 of file SimpleIndexDistance.h.

References getIndex(), and index_.

◆ isSymmetric()

bool bpp::SimpleIndexDistance::isSymmetric ( ) const
inlinevirtual
Returns
True if the index is symatric (that is, index(i,j) == index(j, i)).

Implements bpp::AlphabetIndex2.

Definition at line 121 of file SimpleIndexDistance.h.

References sym_.

◆ operator=()

SimpleIndexDistance& bpp::SimpleIndexDistance::operator= ( const SimpleIndexDistance sid)
inline

Definition at line 79 of file SimpleIndexDistance.h.

References index_, and sym_.

◆ setSymmetric()

void bpp::SimpleIndexDistance::setSymmetric ( bool  yn)
inline

Definition at line 120 of file SimpleIndexDistance.h.

References sym_.

Referenced by bpp::BppOAlphabetIndex2Format::read().

Member Data Documentation

◆ index_

std::auto_ptr<AlphabetIndex1> bpp::SimpleIndexDistance::index_
private

◆ sym_

bool bpp::SimpleIndexDistance::sym_
private

Definition at line 66 of file SimpleIndexDistance.h.

Referenced by getIndex(), isSymmetric(), operator=(), and setSymmetric().


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