bpp-seq3  3.0.0
bpp::EdSymbolList< T > Class Template Reference

#include <Bpp/Seq/SymbolList.h>

+ Inheritance diagram for bpp::EdSymbolList< T >:
+ Collaboration diagram for bpp::EdSymbolList< T >:

Public Member Functions

virtual void setContent (const std::vector< T > &list)
 Set the whole content of the list. More...
 
void deleteElement (size_t pos)
 Remove the element at position 'pos'. More...
 
void deleteElements (size_t pos, size_t len)
 Remove the elements at position 'pos'. More...
 
virtual void addElement (const T &v)
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, const T &v)
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, const T &v)
 Set the element at position 'pos' to character 'c'. More...
 
const AlphabetgetAlphabet () const
 Get the alphabet associated to the list. More...
 
size_t size () const
 Get the number of elements in the list. More...
 
virtual const std::vector< T > & getContent () const
 
virtual std::string toString () const
 Convert the list as a string. More...
 
virtual const T & getElement (size_t pos) const
 Get the element at position 'pos' as a character. More...
 
virtual const T & getValue (size_t pos) const
 checked access to a character in list. More...
 
virtual const T & operator[] (size_t pos) const
 Operator [] overloaded for quick access to a character in list. More...
 
virtual T & operator[] (size_t pos)
 Operator [] overloaded for quick access to a character in list. More...
 
virtual void shuffle ()
 Randomly shuffle the content of the list, with linear complexity. More...
 
virtual double getStateValueAt (size_t siteIndex, int state) const
 
virtual double operator() (size_t siteIndex, int state) const
 
virtual double getStateValueAt (size_t siteIndex, int state) const
 From CruxSymbolList. More...
 
virtual double operator() (size_t siteIndex, int state) const
 

Protected Member Functions

 EdSymbolList (const Alphabet *alpha)
 Build a new void CoreSymbolList object with the specified alphabet. More...
 
 EdSymbolList (const std::vector< T > &list, const Alphabet *alpha)
 Build a new CoreSymbolList object with the specified alphabet. The content of the site is initialized from a vector of integers. More...
 
 EdSymbolList (const CoreSymbolList< T > &list)
 The generic copy constructor. More...
 
 EdSymbolList (const EdSymbolList< T > &list)
 The copy constructor. More...
 
EdSymbolList< T > & operator= (const CoreSymbolList< T > &list)
 The generic assignment operator. More...
 
EdSymbolList< T > & operator= (const EdSymbolList &list)
 The assignment operator. More...
 
virtual ~EdSymbolList ()
 
void propagateEvents (bool yn)
 
bool propagateEvents () const
 
The Clonable interface
EdSymbolListclone () const
 

Protected Attributes

std::vector< CoreSymbolListListener< T > * > listeners_
 Contains the listeners. More...
 
std::vector< T > content_
 The list content. More...
 

Private Attributes

bool propagateEvents_
 
const Alphabetalphabet_
 The Alphabet attribute must be initialized in constructor and then can never be changed. More...
 

Events handling

virtual void beforeSequenceChanged (const CoreSymbolListEditionEvent< T > &event)
 
virtual void afterSequenceChanged (const CoreSymbolListEditionEvent< T > &event)
 
virtual void beforeSequenceInserted (const CoreSymbolListInsertionEvent< T > &event)
 
virtual void afterSequenceInserted (const CoreSymbolListInsertionEvent< T > &event)
 
virtual void beforeSequenceDeleted (const CoreSymbolListDeletionEvent< T > &event)
 
virtual void afterSequenceDeleted (const CoreSymbolListDeletionEvent< T > &event)
 
virtual void beforeSequenceSubstituted (const CoreSymbolListSubstitutionEvent< T > &event)
 
virtual void afterSequenceSubstituted (const CoreSymbolListSubstitutionEvent< T > &event)
 
void fireBeforeSequenceChanged (const CoreSymbolListEditionEvent< T > &event)
 
void fireAfterSequenceChanged (const CoreSymbolListEditionEvent< T > &event)
 
void fireBeforeSequenceInserted (const CoreSymbolListInsertionEvent< T > &event)
 
void fireAfterSequenceInserted (const CoreSymbolListInsertionEvent< T > &event)
 
void fireBeforeSequenceDeleted (const CoreSymbolListDeletionEvent< T > &event)
 
void fireAfterSequenceDeleted (const CoreSymbolListDeletionEvent< T > &event)
 
void fireBeforeSequenceSubstituted (const CoreSymbolListSubstitutionEvent< T > &event)
 
void fireAfterSequenceSubstituted (const CoreSymbolListSubstitutionEvent< T > &event)
 
virtual size_t getNumberOfListeners () const
 
virtual const CoreSymbolListListener< T > & getListener (size_t i) const
 
virtual CoreSymbolListListener< T > & getListener (size_t i)
 
virtual void addCoreSymbolListListener (CoreSymbolListListener< T > *listener)
 
virtual void removeCoreSymbolListListener (CoreSymbolListListener< T > *listener)
 

Detailed Description

template<class T>
class bpp::EdSymbolList< T >

Definition at line 246 of file SymbolList.h.

Constructor & Destructor Documentation

◆ EdSymbolList() [1/4]

template<class T >
bpp::EdSymbolList< T >::EdSymbolList ( const Alphabet alpha)
inlineprotected

Build a new void CoreSymbolList object with the specified alphabet.

Parameters
alphaThe alphabet to use.

Definition at line 265 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::clone().

◆ EdSymbolList() [2/4]

template<class T >
bpp::EdSymbolList< T >::EdSymbolList ( const std::vector< T > &  list,
const Alphabet alpha 
)
inlineprotected

Build a new CoreSymbolList object with the specified alphabet. The content of the site is initialized from a vector of integers.

Parameters
listThe content of the site.
alphaThe alphabet to use.
Exceptions
BadIntExceptionIf the content does not match the specified alphabet.

Definition at line 276 of file SymbolList.h.

◆ EdSymbolList() [3/4]

template<class T >
bpp::EdSymbolList< T >::EdSymbolList ( const CoreSymbolList< T > &  list)
inlineprotected

The generic copy constructor.

Definition at line 283 of file SymbolList.h.

◆ EdSymbolList() [4/4]

template<class T >
bpp::EdSymbolList< T >::EdSymbolList ( const EdSymbolList< T > &  list)
inlineprotected

The copy constructor.

Definition at line 291 of file SymbolList.h.

References bpp::EdSymbolList< T >::listeners_.

◆ ~EdSymbolList()

template<class T >
virtual bpp::EdSymbolList< T >::~EdSymbolList ( )
inlineprotectedvirtual

Definition at line 355 of file SymbolList.h.

References bpp::EdSymbolList< T >::listeners_.

Member Function Documentation

◆ addCoreSymbolListListener()

template<class T >
virtual void bpp::EdSymbolList< T >::addCoreSymbolListListener ( CoreSymbolListListener< T > *  listener)
inlinevirtual

Implements bpp::EdCoreSymbolList< T >.

Definition at line 439 of file SymbolList.h.

References bpp::EdSymbolList< T >::listeners_.

◆ addElement() [1/2]

template<class T >
virtual void bpp::EdSymbolList< T >::addElement ( const T &  c)
inlinevirtual

Add a character to the end of the list.

Parameters
cThe character to add.

Reimplemented from bpp::SymbolList< T >.

Definition at line 394 of file SymbolList.h.

References bpp::SymbolList< T >::addElement(), bpp::EdSymbolList< T >::fireAfterSequenceInserted(), and bpp::EdSymbolList< T >::fireBeforeSequenceInserted().

Referenced by bpp::EdIntSymbolList::addElement(), and bpp::SequenceWithQuality::addElement().

◆ addElement() [2/2]

template<class T >
virtual void bpp::EdSymbolList< T >::addElement ( size_t  pos,
const T &  c 
)
inlinevirtual

Add a character at a certain position in the list.

Parameters
posThe postion where to insert the element.
cThe character to add.

Reimplemented from bpp::SymbolList< T >.

Definition at line 402 of file SymbolList.h.

References bpp::SymbolList< T >::addElement(), bpp::EdSymbolList< T >::fireAfterSequenceInserted(), and bpp::EdSymbolList< T >::fireBeforeSequenceInserted().

◆ afterSequenceChanged()

template<class T >
virtual void bpp::EdSymbolList< T >::afterSequenceChanged ( const CoreSymbolListEditionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 454 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireAfterSequenceChanged().

◆ afterSequenceDeleted()

template<class T >
virtual void bpp::EdSymbolList< T >::afterSequenceDeleted ( const CoreSymbolListDeletionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 458 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireAfterSequenceDeleted().

◆ afterSequenceInserted()

template<class T >
virtual void bpp::EdSymbolList< T >::afterSequenceInserted ( const CoreSymbolListInsertionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 456 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireAfterSequenceInserted().

◆ afterSequenceSubstituted()

template<class T >
virtual void bpp::EdSymbolList< T >::afterSequenceSubstituted ( const CoreSymbolListSubstitutionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 460 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireAfterSequenceSubstituted().

◆ beforeSequenceChanged()

template<class T >
virtual void bpp::EdSymbolList< T >::beforeSequenceChanged ( const CoreSymbolListEditionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 453 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireBeforeSequenceChanged().

◆ beforeSequenceDeleted()

template<class T >
virtual void bpp::EdSymbolList< T >::beforeSequenceDeleted ( const CoreSymbolListDeletionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 457 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireBeforeSequenceDeleted().

◆ beforeSequenceInserted()

template<class T >
virtual void bpp::EdSymbolList< T >::beforeSequenceInserted ( const CoreSymbolListInsertionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 455 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireBeforeSequenceInserted().

◆ beforeSequenceSubstituted()

template<class T >
virtual void bpp::EdSymbolList< T >::beforeSequenceSubstituted ( const CoreSymbolListSubstitutionEvent< T > &  event)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Reimplemented in bpp::EdIntSymbolList.

Definition at line 459 of file SymbolList.h.

Referenced by bpp::EdSymbolList< T >::fireBeforeSequenceSubstituted().

◆ clone()

template<class T >
EdSymbolList* bpp::EdSymbolList< T >::clone ( ) const
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Definition at line 351 of file SymbolList.h.

References bpp::EdSymbolList< T >::EdSymbolList().

◆ deleteElement()

template<class T >
void bpp::EdSymbolList< T >::deleteElement ( size_t  pos)
inlinevirtual

Remove the element at position 'pos'.

Parameters
posThe position of the element to remove.

Reimplemented from bpp::SymbolList< T >.

Definition at line 377 of file SymbolList.h.

References bpp::SymbolList< T >::deleteElement(), bpp::EdSymbolList< T >::fireAfterSequenceDeleted(), and bpp::EdSymbolList< T >::fireBeforeSequenceDeleted().

◆ deleteElements()

template<class T >
void bpp::EdSymbolList< T >::deleteElements ( size_t  pos,
size_t  len 
)
inlinevirtual

Remove the elements at position 'pos'.

Parameters
posThe position of the first element to remove.
lenThe length of the region to remove.

Reimplemented from bpp::SymbolList< T >.

Definition at line 386 of file SymbolList.h.

References bpp::SymbolList< T >::deleteElements(), bpp::EdSymbolList< T >::fireAfterSequenceDeleted(), and bpp::EdSymbolList< T >::fireBeforeSequenceDeleted().

◆ fireAfterSequenceChanged()

template<class T >
void bpp::EdSymbolList< T >::fireAfterSequenceChanged ( const CoreSymbolListEditionEvent< T > &  event)
inlineprotectedvirtual

◆ fireAfterSequenceDeleted()

template<class T >
void bpp::EdSymbolList< T >::fireAfterSequenceDeleted ( const CoreSymbolListDeletionEvent< T > &  event)
inlineprotectedvirtual

◆ fireAfterSequenceInserted()

template<class T >
void bpp::EdSymbolList< T >::fireAfterSequenceInserted ( const CoreSymbolListInsertionEvent< T > &  event)
inlineprotectedvirtual

◆ fireAfterSequenceSubstituted()

template<class T >
void bpp::EdSymbolList< T >::fireAfterSequenceSubstituted ( const CoreSymbolListSubstitutionEvent< T > &  event)
inlineprotectedvirtual

◆ fireBeforeSequenceChanged()

template<class T >
void bpp::EdSymbolList< T >::fireBeforeSequenceChanged ( const CoreSymbolListEditionEvent< T > &  event)
inlineprotectedvirtual

◆ fireBeforeSequenceDeleted()

template<class T >
void bpp::EdSymbolList< T >::fireBeforeSequenceDeleted ( const CoreSymbolListDeletionEvent< T > &  event)
inlineprotectedvirtual

◆ fireBeforeSequenceInserted()

template<class T >
void bpp::EdSymbolList< T >::fireBeforeSequenceInserted ( const CoreSymbolListInsertionEvent< T > &  event)
inlineprotectedvirtual

◆ fireBeforeSequenceSubstituted()

template<class T >
void bpp::EdSymbolList< T >::fireBeforeSequenceSubstituted ( const CoreSymbolListSubstitutionEvent< T > &  event)
inlineprotectedvirtual

◆ getAlphabet()

template<class T >
const Alphabet* bpp::SymbolList< T >::getAlphabet ( ) const
inlinevirtualinherited

◆ getContent()

template<class T >
virtual const std::vector<T>& bpp::SymbolList< T >::getContent ( ) const
inlinevirtualinherited

Implements bpp::CoreSymbolList< T >.

Definition at line 178 of file SymbolList.h.

References bpp::SymbolList< T >::content_.

◆ getElement()

template<class T >
virtual const T& bpp::SymbolList< T >::getElement ( size_t  pos) const
inlinevirtualinherited

Get the element at position 'pos' as a character.

Parameters
posThe position of the character to retrieve.

Implements bpp::CoreSymbolList< T >.

Definition at line 220 of file SymbolList.h.

References bpp::SymbolList< T >::content_, and bpp::SymbolList< T >::size().

◆ getListener() [1/2]

template<class T >
virtual CoreSymbolListListener<T>& bpp::EdSymbolList< T >::getListener ( size_t  i)
inlinevirtual

Implements bpp::EdCoreSymbolList< T >.

Definition at line 432 of file SymbolList.h.

References bpp::EdSymbolList< T >::listeners_.

◆ getListener() [2/2]

template<class T >
virtual const CoreSymbolListListener<T>& bpp::EdSymbolList< T >::getListener ( size_t  i) const
inlinevirtual

Implements bpp::EdCoreSymbolList< T >.

Definition at line 425 of file SymbolList.h.

References bpp::EdSymbolList< T >::listeners_.

◆ getNumberOfListeners()

template<class T >
virtual size_t bpp::EdSymbolList< T >::getNumberOfListeners ( ) const
inlinevirtual

Implements bpp::EdCoreSymbolList< T >.

Definition at line 423 of file SymbolList.h.

References bpp::EdSymbolList< T >::listeners_.

◆ getStateValueAt() [1/2]

◆ getStateValueAt() [2/2]

template<class T >
virtual double bpp::EdCoreSymbolList< T >::getStateValueAt ( size_t  siteIndex,
int  state 
) const
inlinevirtualinherited

From CruxSymbolList.

Reimplemented from bpp::CruxSymbolList.

Definition at line 416 of file CoreSymbolList.h.

References bpp::CruxSymbolList::getStateValueAt().

◆ getValue()

template<class T >
virtual const T& bpp::SymbolList< T >::getValue ( size_t  pos) const
inlinevirtualinherited

checked access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implements bpp::CoreSymbolList< T >.

Definition at line 227 of file SymbolList.h.

References bpp::SymbolList< T >::content_, and bpp::SymbolList< T >::size().

Referenced by bpp::CodonSiteTools::generateCodonSiteWithoutRareVariant(), bpp::CodonSiteTools::isFourFoldDegenerated(), and bpp::CodonSiteTools::numberOfSubstitutions().

◆ operator()() [1/2]

virtual double bpp::CruxSymbolList::operator() ( size_t  siteIndex,
int  state 
) const
inlinevirtualinherited

◆ operator()() [2/2]

template<class T >
virtual double bpp::EdCoreSymbolList< T >::operator() ( size_t  siteIndex,
int  state 
) const
inlinevirtualinherited

Reimplemented from bpp::CruxSymbolList.

Definition at line 421 of file CoreSymbolList.h.

References bpp::CruxSymbolList::operator()().

◆ operator=() [1/2]

template<class T >
EdSymbolList<T>& bpp::EdSymbolList< T >::operator= ( const CoreSymbolList< T > &  list)
inlineprotected

◆ operator=() [2/2]

template<class T >
EdSymbolList<T>& bpp::EdSymbolList< T >::operator= ( const EdSymbolList< T > &  list)
inlineprotected

◆ operator[]() [1/2]

template<class T >
virtual T& bpp::SymbolList< T >::operator[] ( size_t  pos)
inlinevirtualinherited

Operator [] overloaded for quick access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implements bpp::CoreSymbolList< T >.

Definition at line 236 of file SymbolList.h.

References bpp::SymbolList< T >::content_.

◆ operator[]() [2/2]

template<class T >
virtual const T& bpp::SymbolList< T >::operator[] ( size_t  pos) const
inlinevirtualinherited

Operator [] overloaded for quick access to a character in list.

Parameters
posThe position to retrieve.
Returns
The T value of character at position pos.

Implements bpp::CoreSymbolList< T >.

Definition at line 234 of file SymbolList.h.

References bpp::SymbolList< T >::content_.

◆ propagateEvents() [1/2]

template<class T >
bool bpp::EdSymbolList< T >::propagateEvents ( ) const
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Definition at line 545 of file SymbolList.h.

References bpp::EdSymbolList< T >::propagateEvents_.

◆ propagateEvents() [2/2]

template<class T >
void bpp::EdSymbolList< T >::propagateEvents ( bool  yn)
inlineprotectedvirtual

Implements bpp::EdCoreSymbolList< T >.

Definition at line 544 of file SymbolList.h.

References bpp::EdSymbolList< T >::propagateEvents_.

◆ removeCoreSymbolListListener()

template<class T >
virtual void bpp::EdSymbolList< T >::removeCoreSymbolListListener ( CoreSymbolListListener< T > *  listener)
inlinevirtual

◆ setContent()

template<class T >
virtual void bpp::EdSymbolList< T >::setContent ( const std::vector< T > &  list)
inlinevirtual

Set the whole content of the list.

Parameters
listThe new content of the list.
See also
The list constructor for information about the way lists are internaly stored.

Reimplemented from bpp::SymbolList< T >.

Reimplemented in bpp::SequenceWithAnnotation, and bpp::EdIntSymbolList.

Definition at line 367 of file SymbolList.h.

References bpp::EdSymbolList< T >::fireAfterSequenceChanged(), bpp::EdSymbolList< T >::fireBeforeSequenceChanged(), and bpp::SymbolList< T >::setContent().

Referenced by bpp::EdIntSymbolList::setContent().

◆ setElement()

template<class T >
virtual void bpp::EdSymbolList< T >::setElement ( size_t  pos,
const T &  c 
)
inlinevirtual

Set the element at position 'pos' to character 'c'.

Parameters
posThe position of the character to set.
cThe value of the element.

Reimplemented from bpp::SymbolList< T >.

Definition at line 410 of file SymbolList.h.

References bpp::EdSymbolList< T >::fireAfterSequenceSubstituted(), bpp::EdSymbolList< T >::fireBeforeSequenceSubstituted(), and bpp::SymbolList< T >::setElement().

Referenced by bpp::EdIntSymbolList::setElement().

◆ shuffle()

template<class T >
virtual void bpp::SymbolList< T >::shuffle ( )
inlinevirtualinherited

Randomly shuffle the content of the list, with linear complexity.

Implements bpp::CruxSymbolList.

Definition at line 238 of file SymbolList.h.

References bpp::SymbolList< T >::content_.

◆ size()

◆ toString()

template<class T >
virtual std::string bpp::SymbolList< T >::toString ( ) const
inlinevirtualinherited

Convert the list as a string.

This method is useful for dumping a list to a file or to the screen for display.

Returns
The whole list as a string.

Implements bpp::CruxSymbolList.

Reimplemented in bpp::BasicSequence, bpp::EdIntSymbolList, and bpp::BasicIntSymbolList.

Definition at line 180 of file SymbolList.h.

Member Data Documentation

◆ alphabet_

template<class T >
const Alphabet* bpp::SymbolList< T >::alphabet_
privateinherited

The Alphabet attribute must be initialized in constructor and then can never be changed.

To apply another alphabet to a list you'll have to create a new list.

Definition at line 79 of file SymbolList.h.

Referenced by bpp::SymbolList< T >::getAlphabet(), and bpp::SymbolList< T >::operator=().

◆ content_

◆ listeners_

◆ propagateEvents_


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