bpp-seq  2.2.0
bpp::SymbolList Class Referenceabstract

The SymbolList interface. More...

#include <Bpp/Seq/SymbolList.h>

+ Inheritance diagram for bpp::SymbolList:
+ Collaboration diagram for bpp::SymbolList:

Public Member Functions

virtual ~SymbolList ()
 
virtual const AlphabetgetAlphabet () const =0
 Get the alphabet associated to the list. More...
 
virtual size_t size () const =0
 Get the number of elements in the list. More...
 
virtual std::string toString () const =0
 Convert the list as a string. More...
 
The Clonable interface
SymbolListclone () const =0
 
Acting on the content of the list.
virtual const std::vector< int > & getContent () const =0
 Get the whole content of the list as a vector of int. More...
 
virtual void setContent (const std::vector< int > &list)=0 throw (BadIntException)
 Set the whole content of the list. More...
 
virtual void setContent (const std::vector< std::string > &list)=0 throw (BadCharException)
 Set the whole content of the list. More...
 
Edition methods.
virtual void addElement (const std::string &c)=0 throw (BadCharException)
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, const std::string &c)=0 throw (BadCharException, IndexOutOfBoundsException)
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, const std::string &c)=0 throw (BadCharException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'c'. More...
 
virtual void deleteElement (size_t pos)=0 throw (IndexOutOfBoundsException)
 Delete the element at position 'pos'. More...
 
virtual void deleteElements (size_t pos, size_t len)=0 throw (IndexOutOfBoundsException)
 Delete the elements at position 'pos'. More...
 
virtual std::string getChar (size_t pos) const =0 throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as a character. More...
 
virtual void addElement (int v)=0 throw (BadIntException)
 Add a character to the end of the list. More...
 
virtual void addElement (size_t pos, int v)=0 throw (BadIntException, IndexOutOfBoundsException)
 Add a character at a certain position in the list. More...
 
virtual void setElement (size_t pos, int v)=0 throw (BadIntException, IndexOutOfBoundsException)
 Set the element at position 'pos' to character 'v'. More...
 
virtual int getValue (size_t pos) const =0 throw (IndexOutOfBoundsException)
 Get the element at position 'pos' as an int. More...
 
Provide direct access to the list content.
Warning
These operators allow you to modifiy the list content. No alphabet checking is performed for your modifications, so use with care, or consider using the setContent() method.
virtual const int & operator[] (size_t i) const =0
 Operator [] overloaded for quick access to a character in list. More...
 
virtual int & operator[] (size_t i)=0
 Operator [] overloaded for quick access to a character in list. More...
 
virtual void shuffle ()=0
 Randomly shuffle the content of the list, with linear complexity. More...
 

Detailed Description

The SymbolList interface.

See also
Alphabet

Definition at line 60 of file SymbolList.h.

Constructor & Destructor Documentation

◆ ~SymbolList()

virtual bpp::SymbolList::~SymbolList ( )
inlinevirtual

Definition at line 76 of file SymbolList.h.

Member Function Documentation

◆ addElement() [1/4]

virtual void bpp::SymbolList::addElement ( const std::string &  c)
throw (BadCharException
)
pure virtual

Add a character to the end of the list.

Parameters
cThe character to add, given as a string.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SequenceTools::getPutativeHaplotypes(), bpp::AbstractReverseTransliterator::reverse(), and bpp::AbstractTransliterator::translate().

◆ addElement() [2/4]

virtual void bpp::SymbolList::addElement ( size_t  pos,
const std::string &  c 
)
throw (BadCharException,
IndexOutOfBoundsException
)
pure virtual

Add a character at a certain position in the list.

Parameters
posThe postion where to insert the element.
cThe character to add, given as a string.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ addElement() [3/4]

virtual void bpp::SymbolList::addElement ( int  v)
throw (BadIntException
)
pure virtual

Add a character to the end of the list.

Parameters
vThe character to add, given as an int.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ addElement() [4/4]

virtual void bpp::SymbolList::addElement ( size_t  pos,
int  v 
)
throw (BadIntException,
IndexOutOfBoundsException
)
pure virtual

Add a character at a certain position in the list.

Parameters
posThe postion where to insert the element.
vThe character to add, given as an int.

Implemented in bpp::SequenceWithQuality, bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ clone()

◆ deleteElement()

virtual void bpp::SymbolList::deleteElement ( size_t  pos)
throw (IndexOutOfBoundsException
)
pure virtual

Delete the element at position 'pos'.

Parameters
posThe position of the element to delete.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SequenceTools::getCDS(), bpp::SequenceTools::removeGaps(), and bpp::VectorSiteContainer::removeSequence().

◆ deleteElements()

virtual void bpp::SymbolList::deleteElements ( size_t  pos,
size_t  len 
)
throw (IndexOutOfBoundsException
)
pure virtual

Delete the elements at position 'pos'.

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

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ getAlphabet()

◆ getChar()

virtual std::string bpp::SymbolList::getChar ( size_t  pos) const
throw (IndexOutOfBoundsException
)
pure virtual

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

Parameters
posThe position of the character to retrieve.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SiteContainerTools::resolveDottedAlignment().

◆ getContent()

virtual const std::vector<int>& bpp::SymbolList::getContent ( ) const
pure virtual

◆ getValue()

virtual int bpp::SymbolList::getValue ( size_t  pos) const
throw (IndexOutOfBoundsException
)
pure virtual

Get the element at position 'pos' as an int.

Parameters
posThe position of the character to retrieve.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SequenceTools::findFirstOf(), bpp::SequenceTools::invert(), and bpp::SequenceTools::invertComplement().

◆ operator[]() [1/2]

virtual const int& bpp::SymbolList::operator[] ( size_t  i) const
pure virtual

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

Parameters
iThe position to retrieve.
Returns
The integer value of character at position i.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ operator[]() [2/2]

virtual int& bpp::SymbolList::operator[] ( size_t  i)
pure virtual

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

Parameters
iThe position to retrieve.
Returns
The integer value of character at position i.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ setContent() [1/2]

virtual void bpp::SymbolList::setContent ( const std::vector< int > &  list)
throw (BadIntException
)
pure virtual

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.

Implemented in bpp::EdSymbolList, bpp::BasicSequence, bpp::BasicSymbolList, bpp::SequenceWithAnnotation, and bpp::Sequence.

◆ setContent() [2/2]

virtual void bpp::SymbolList::setContent ( const std::vector< std::string > &  list)
throw (BadCharException
)
pure virtual

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.

Implemented in bpp::EdSymbolList, bpp::BasicSequence, bpp::BasicSymbolList, bpp::SequenceWithAnnotation, and bpp::Sequence.

◆ setElement() [1/2]

virtual void bpp::SymbolList::setElement ( size_t  pos,
const std::string &  c 
)
throw (BadCharException,
IndexOutOfBoundsException
)
pure virtual

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

Parameters
posThe position of the character to set.
cThe value of the element, given as a string.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::SequenceTools::invert(), and bpp::SequenceTools::invertComplement().

◆ setElement() [2/2]

virtual void bpp::SymbolList::setElement ( size_t  pos,
int  v 
)
throw (BadIntException,
IndexOutOfBoundsException
)
pure virtual

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

Parameters
posThe position of the character to set.
vThe value of the element, given as an int.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ shuffle()

virtual void bpp::SymbolList::shuffle ( )
pure virtual

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

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

◆ size()

◆ toString()

virtual std::string bpp::SymbolList::toString ( ) const
pure virtual

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.

Implemented in bpp::EdSymbolList, and bpp::BasicSymbolList.

Referenced by bpp::AbstractSequenceContainer::toString().


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