bpp-seq
2.2.0
|
A event-driven SymbolList object. More...
#include <Bpp/Seq/SymbolList.h>
Public Member Functions | |
EdSymbolList (const Alphabet *alpha) | |
Build a new void BasicSymbolList object with the specified alphabet. More... | |
EdSymbolList (const std::vector< std::string > &list, const Alphabet *alpha) throw (BadCharException) | |
Build a new BasicSymbolList object with the specified alphabet. The content of the site is initialized from a vector of characters. More... | |
EdSymbolList (const std::vector< int > &list, const Alphabet *alpha) throw (BadIntException) | |
Build a new BasicSymbolList object with the specified alphabet. The content of the site is initialized from a vector of integers. More... | |
EdSymbolList (const SymbolList &list) | |
The generic copy constructor. More... | |
EdSymbolList (const EdSymbolList &list) | |
The copy constructor. More... | |
EdSymbolList & | operator= (const SymbolList &list) |
The generic assignment operator. More... | |
EdSymbolList & | operator= (const EdSymbolList &list) |
The assignment operator. More... | |
virtual | ~EdSymbolList () |
virtual const Alphabet * | getAlphabet () const |
Get the alphabet associated to the list. More... | |
virtual size_t | size () const |
Get the number of elements in the list. More... | |
virtual const std::vector< int > & | getContent () const |
Get the whole content of the list as a vector of int. More... | |
virtual void | setContent (const std::vector< int > &list) throw (BadIntException) |
Set the whole content of the list. More... | |
virtual void | setContent (const std::vector< std::string > &list) throw (BadCharException) |
Set the whole content of the list. More... | |
virtual std::string | toString () const |
Convert the list as a string. More... | |
virtual void | addElement (const std::string &c) throw (BadCharException) |
Add a character to the end of the list. More... | |
virtual void | addElement (size_t pos, const std::string &c) throw (BadCharException, IndexOutOfBoundsException) |
Add a character at a certain position in the list. More... | |
virtual void | setElement (size_t pos, const std::string &c) throw (BadCharException, IndexOutOfBoundsException) |
Set the element at position 'pos' to character 'c'. More... | |
virtual void | deleteElement (size_t pos) throw (IndexOutOfBoundsException) |
Delete the element at position 'pos'. More... | |
virtual void | deleteElements (size_t pos, size_t len) throw (IndexOutOfBoundsException) |
Delete the elements at position 'pos'. More... | |
virtual std::string | getChar (size_t pos) const throw (IndexOutOfBoundsException) |
Get the element at position 'pos' as a character. More... | |
virtual void | addElement (int v) throw (BadIntException) |
Add a character to the end of the list. More... | |
virtual void | addElement (size_t pos, int v) throw (BadIntException, IndexOutOfBoundsException) |
Add a character at a certain position in the list. More... | |
virtual void | setElement (size_t pos, int v) throw (BadIntException, IndexOutOfBoundsException) |
Set the element at position 'pos' to character 'v'. More... | |
virtual int | getValue (size_t pos) const throw (IndexOutOfBoundsException) |
Get the element at position 'pos' as an int. More... | |
virtual const int & | operator[] (size_t i) const |
Operator [] overloaded for quick access to a character in list. More... | |
virtual int & | operator[] (size_t i) |
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... | |
The Clonable interface | |
EdSymbolList * | clone () const |
Protected Member Functions | |
void | propagateEvents (bool yn) |
bool | propagateEvents () const |
Protected Attributes | |
std::vector< int > | content_ |
The list content. More... | |
std::vector< SymbolListListener * > | listeners_ |
Contains the listeners. More... | |
Private Attributes | |
const Alphabet * | alphabet_ |
The Alphabet attribute must be initialized in constructor and then can never be changed. More... | |
bool | propagateEvents_ |
A event-driven SymbolList object.
This is a general purpose container, containing an ordered list of states(= letters). The states that allowed to be present in the list are defined by an alphabet object, which is passed to the list constructor by a pointer.
For programming convenience, the states are stored as integers, but the translation toward and from a char description is easily performed with the Alphabet classes.
Definition at line 500 of file SymbolList.h.
|
inline |
Build a new void BasicSymbolList object with the specified alphabet.
alpha | The alphabet to use. |
Definition at line 532 of file SymbolList.h.
Referenced by clone().
EdSymbolList::EdSymbolList | ( | const std::vector< std::string > & | list, |
const Alphabet * | alpha | ||
) | |||
throw | ( | BadCharException | |
) |
Build a new BasicSymbolList object with the specified alphabet. The content of the site is initialized from a vector of characters.
list | The content of the site. |
alpha | The alphabet to use. |
BadCharException | If the content does not match the specified alphabet. |
Definition at line 224 of file SymbolList.cpp.
EdSymbolList::EdSymbolList | ( | const std::vector< int > & | list, |
const Alphabet * | alpha | ||
) | |||
throw | ( | BadIntException | |
) |
Build a new BasicSymbolList object with the specified alphabet. The content of the site is initialized from a vector of integers.
list | The content of the site. |
alpha | The alphabet to use. |
BadIntException | If the content does not match the specified alphabet. |
Definition at line 230 of file SymbolList.cpp.
EdSymbolList::EdSymbolList | ( | const SymbolList & | list | ) |
The generic copy constructor.
Definition at line 238 of file SymbolList.cpp.
EdSymbolList::EdSymbolList | ( | const EdSymbolList & | list | ) |
|
inlinevirtual |
Definition at line 588 of file SymbolList.h.
References listeners_.
|
virtual |
Add a character to the end of the list.
c | The character to add, given as a string. |
Implements bpp::SymbolList.
Reimplemented in bpp::SequenceWithQuality.
Definition at line 321 of file SymbolList.cpp.
Referenced by bpp::SequenceWithQuality::addElement().
|
virtual |
Add a character at a certain position in the list.
pos | The postion where to insert the element. |
c | The character to add, given as a string. |
Implements bpp::SymbolList.
Reimplemented in bpp::SequenceWithQuality.
Definition at line 331 of file SymbolList.cpp.
|
virtual |
Add a character to the end of the list.
v | The character to add, given as an int. |
Implements bpp::SymbolList.
Reimplemented in bpp::SequenceWithQuality.
Definition at line 394 of file SymbolList.cpp.
|
virtual |
Add a character at a certain position in the list.
pos | The postion where to insert the element. |
v | The character to add, given as an int. |
Implements bpp::SymbolList.
Reimplemented in bpp::SequenceWithQuality.
Definition at line 406 of file SymbolList.cpp.
|
inlinevirtual |
Definition at line 657 of file SymbolList.h.
References listeners_.
Referenced by bpp::SequenceWithAnnotation::addAnnotation().
|
inlineprotectedvirtual |
Definition at line 670 of file SymbolList.h.
Referenced by fireAfterSequenceChanged().
|
inlineprotectedvirtual |
Definition at line 674 of file SymbolList.h.
Referenced by fireAfterSequenceDeleted().
|
inlineprotectedvirtual |
Definition at line 672 of file SymbolList.h.
Referenced by fireAfterSequenceInserted().
|
inlineprotectedvirtual |
Definition at line 676 of file SymbolList.h.
Referenced by fireAfterSequenceSubstituted().
|
inlineprotectedvirtual |
Definition at line 669 of file SymbolList.h.
Referenced by fireBeforeSequenceChanged().
|
inlineprotectedvirtual |
Definition at line 673 of file SymbolList.h.
Referenced by fireBeforeSequenceDeleted().
|
inlineprotectedvirtual |
Definition at line 671 of file SymbolList.h.
Referenced by fireBeforeSequenceInserted().
|
inlineprotectedvirtual |
Definition at line 675 of file SymbolList.h.
Referenced by fireBeforeSequenceSubstituted().
|
inlinevirtual |
|
virtual |
Delete the element at position 'pos'.
pos | The position of the element to delete. |
Implements bpp::SymbolList.
Definition at line 369 of file SymbolList.cpp.
|
virtual |
Delete the elements at position 'pos'.
pos | The position of the first element to delete. |
len | The length of the region to delete. |
Implements bpp::SymbolList.
Definition at line 381 of file SymbolList.cpp.
|
inlineprotected |
Definition at line 685 of file SymbolList.h.
References afterSequenceChanged(), listeners_, and propagateEvents_.
|
inlineprotected |
Definition at line 713 of file SymbolList.h.
References afterSequenceDeleted(), listeners_, and propagateEvents_.
Referenced by bpp::SequenceWithAnnotation::setToSizeL(), and bpp::SequenceWithAnnotation::setToSizeR().
|
inlineprotected |
Definition at line 699 of file SymbolList.h.
References afterSequenceInserted(), listeners_, and propagateEvents_.
Referenced by bpp::SequenceWithAnnotation::setToSizeL(), and bpp::SequenceWithAnnotation::setToSizeR().
|
inlineprotected |
Definition at line 727 of file SymbolList.h.
References afterSequenceSubstituted(), listeners_, and propagateEvents_.
|
inlineprotected |
Definition at line 678 of file SymbolList.h.
References beforeSequenceChanged(), listeners_, and propagateEvents_.
|
inlineprotected |
Definition at line 706 of file SymbolList.h.
References beforeSequenceDeleted(), listeners_, and propagateEvents_.
Referenced by bpp::SequenceWithAnnotation::setToSizeL(), and bpp::SequenceWithAnnotation::setToSizeR().
|
inlineprotected |
Definition at line 692 of file SymbolList.h.
References beforeSequenceInserted(), listeners_, and propagateEvents_.
Referenced by bpp::SequenceWithAnnotation::setToSizeL(), and bpp::SequenceWithAnnotation::setToSizeR().
|
inlineprotected |
Definition at line 720 of file SymbolList.h.
References beforeSequenceSubstituted(), listeners_, and propagateEvents_.
|
inlinevirtual |
Get the alphabet associated to the list.
Implements bpp::SymbolList.
Definition at line 599 of file SymbolList.h.
References alphabet_.
Referenced by bpp::SequenceWithQuality::append(), operator=(), bpp::SequenceWithQualityTools::removeGaps(), bpp::SequenceWithAnnotation::setToSizeL(), and bpp::SequenceWithAnnotation::setToSizeR().
|
virtual |
Get the element at position 'pos' as a character.
pos | The position of the character to retrieve. |
Implements bpp::SymbolList.
Definition at line 354 of file SymbolList.cpp.
|
inlinevirtual |
Get the whole content of the list as a vector of int.
Implements bpp::SymbolList.
Definition at line 603 of file SymbolList.h.
References content_.
Referenced by bpp::SequenceWithQualityTools::invert(), and operator=().
|
inlinevirtual |
Definition at line 647 of file SymbolList.h.
References listeners_.
Referenced by bpp::SequenceWithAnnotation::getAnnotation(), bpp::SequenceWithAnnotation::getAnnotationTypes(), and bpp::SequenceWithAnnotation::hasAnnotation().
|
inlinevirtual |
Definition at line 652 of file SymbolList.h.
References listeners_.
|
inlinevirtual |
Definition at line 645 of file SymbolList.h.
References listeners_.
Referenced by bpp::SequenceWithAnnotation::getAnnotation(), bpp::SequenceWithAnnotation::getAnnotationTypes(), and bpp::SequenceWithAnnotation::hasAnnotation().
|
virtual |
Get the element at position 'pos' as an int.
pos | The position of the character to retrieve. |
Implements bpp::SymbolList.
Definition at line 434 of file SymbolList.cpp.
EdSymbolList & EdSymbolList::operator= | ( | const SymbolList & | list | ) |
The generic assignment operator.
Definition at line 249 of file SymbolList.cpp.
References alphabet_, content_, bpp::SymbolList::getAlphabet(), bpp::SymbolList::getContent(), listeners_, and propagateEvents_.
Referenced by bpp::SequenceWithAnnotation::operator=().
EdSymbolList & EdSymbolList::operator= | ( | const EdSymbolList & | list | ) |
The assignment operator.
Definition at line 261 of file SymbolList.cpp.
References alphabet_, content_, getAlphabet(), getContent(), listeners_, and propagateEvents_.
|
inlinevirtual |
Operator [] overloaded for quick access to a character in list.
i | The position to retrieve. |
Implements bpp::SymbolList.
Definition at line 631 of file SymbolList.h.
References content_.
|
inlinevirtual |
Operator [] overloaded for quick access to a character in list.
i | The position to retrieve. |
Implements bpp::SymbolList.
Definition at line 633 of file SymbolList.h.
References content_.
|
inlineprotected |
Definition at line 736 of file SymbolList.h.
References propagateEvents_.
|
inlineprotected |
Definition at line 737 of file SymbolList.h.
References propagateEvents_.
|
inlinevirtual |
Definition at line 661 of file SymbolList.h.
References bpp::SymbolListListener::isRemovable(), and listeners_.
|
virtual |
Set the whole content of the list.
list | The new content of the list. |
Implements bpp::SymbolList.
Reimplemented in bpp::SequenceWithAnnotation.
Definition at line 297 of file SymbolList.cpp.
Referenced by bpp::SequenceWithAnnotation::setContent().
|
virtual |
Set the whole content of the list.
list | The new content of the list. |
Implements bpp::SymbolList.
Reimplemented in bpp::SequenceWithAnnotation.
Definition at line 277 of file SymbolList.cpp.
|
virtual |
Set the element at position 'pos' to character 'c'.
pos | The position of the character to set. |
c | The value of the element, given as a string. |
Implements bpp::SymbolList.
Definition at line 342 of file SymbolList.cpp.
|
virtual |
Set the element at position 'pos' to character 'v'.
pos | The position of the character to set. |
v | The value of the element, given as an int. |
Implements bpp::SymbolList.
Definition at line 420 of file SymbolList.cpp.
|
inlinevirtual |
Randomly shuffle the content of the list, with linear complexity.
Implements bpp::SymbolList.
Definition at line 635 of file SymbolList.h.
References content_.
|
inlinevirtual |
Get the number of elements in the list.
Implements bpp::SymbolList.
Definition at line 601 of file SymbolList.h.
References content_.
Referenced by bpp::SequenceWithQuality::addElement(), bpp::SequenceMask::isValidWith(), bpp::SequenceQuality::isValidWith(), and bpp::SequenceWithQualityTools::removeGaps().
|
virtual |
Convert the list as a string.
This method is useful for dumping a list to a file or to the screen for display.
Implements bpp::SymbolList.
Definition at line 314 of file SymbolList.cpp.
References alphabet_, content_, and bpp::StringSequenceTools::decodeSequence().
|
private |
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 510 of file SymbolList.h.
Referenced by getAlphabet(), operator=(), and toString().
|
protected |
The list content.
Definition at line 518 of file SymbolList.h.
Referenced by getContent(), operator=(), operator[](), bpp::SequenceWithAnnotation::setToSizeL(), bpp::SequenceWithAnnotation::setToSizeR(), shuffle(), size(), and toString().
|
protected |
Contains the listeners.
Definition at line 523 of file SymbolList.h.
Referenced by addSymbolListListener(), EdSymbolList(), fireAfterSequenceChanged(), fireAfterSequenceDeleted(), fireAfterSequenceInserted(), fireAfterSequenceSubstituted(), fireBeforeSequenceChanged(), fireBeforeSequenceDeleted(), fireBeforeSequenceInserted(), fireBeforeSequenceSubstituted(), getListener(), getNumberOfListeners(), operator=(), removeSymbolListListener(), and ~EdSymbolList().
|
private |
Definition at line 512 of file SymbolList.h.
Referenced by fireAfterSequenceChanged(), fireAfterSequenceDeleted(), fireAfterSequenceInserted(), fireAfterSequenceSubstituted(), fireBeforeSequenceChanged(), fireBeforeSequenceDeleted(), fireBeforeSequenceInserted(), fireBeforeSequenceSubstituted(), operator=(), and propagateEvents().