40 #ifndef _SYMBOLLIST_H_ 41 #define _SYMBOLLIST_H_ 44 #include <Bpp/Clonable.h> 61 public virtual Clonable
70 #ifndef NO_VIRTUAL_COV 93 virtual size_t size()
const = 0;
106 virtual const std::vector<int>&
getContent()
const = 0;
133 virtual std::string
toString()
const = 0;
169 virtual void deleteElement(
size_t pos)
throw (IndexOutOfBoundsException) = 0;
177 virtual void deleteElements(
size_t pos,
size_t len)
throw (IndexOutOfBoundsException) = 0;
185 virtual std::string
getChar(
size_t pos)
const throw (IndexOutOfBoundsException) = 0;
215 virtual int getValue(
size_t pos)
const throw (IndexOutOfBoundsException) = 0;
235 virtual const int&
operator[](
size_t i)
const = 0;
335 #ifdef NO_VIRTUAL_COV 350 virtual size_t size()
const {
return static_cast<size_t>(
content_.size()); }
358 virtual std::string
toString()
const;
366 virtual void deleteElement(
size_t pos)
throw (IndexOutOfBoundsException);
368 virtual void deleteElements(
size_t pos,
size_t len)
throw (IndexOutOfBoundsException);
370 virtual std::string
getChar(
size_t pos)
const throw (IndexOutOfBoundsException);
378 virtual int getValue(
size_t pos)
const throw (IndexOutOfBoundsException);
465 public virtual Clonable
470 #ifndef NO_VIRTUAL_COV 579 #ifdef NO_VIRTUAL_COV 590 for (
size_t i = 0; i <
listeners_.size(); ++i) {
601 virtual size_t size()
const {
return static_cast<size_t>(
content_.size()); }
609 virtual std::string
toString()
const;
617 virtual void deleteElement(
size_t pos)
throw (IndexOutOfBoundsException);
619 virtual void deleteElements(
size_t pos,
size_t len)
throw (IndexOutOfBoundsException);
621 virtual std::string
getChar(
size_t pos)
const throw (IndexOutOfBoundsException);
629 virtual int getValue(
size_t pos)
const throw (IndexOutOfBoundsException);
648 if (
listeners_[i] == 0) std::cout <<
"aie!!!" << std::endl;
653 if (
listeners_[i] == 0) std::cout <<
"aie!!!" << std::endl;
665 throw Exception(
"EdSymbolList::removeSymbolListListener. Listener is not removable.");
681 for (
size_t i = 0; i <
listeners_.size(); ++i)
688 for (
size_t i = 0; i <
listeners_.size(); ++i)
695 for (
size_t i = 0; i <
listeners_.size(); ++i)
702 for (
size_t i = 0; i <
listeners_.size(); ++i)
709 for (
size_t i = 0; i <
listeners_.size(); ++i)
716 for (
size_t i = 0; i <
listeners_.size(); ++i)
723 for (
size_t i = 0; i <
listeners_.size(); ++i)
730 for (
size_t i = 0; i <
listeners_.size(); ++i)
744 #endif // _SYMBOLLIST_H_ void fireAfterSequenceSubstituted(const SymbolListSubstitutionEvent &event)
virtual void shuffle()
Randomly shuffle the content of the list, with linear complexity.
virtual ~SymbolListListener()
virtual size_t getEnd() const
virtual void beforeSequenceSubstituted(const SymbolListSubstitutionEvent &event)=0
virtual void afterSequenceInserted(const SymbolListInsertionEvent &event)=0
std::vector< int > content_
The list content.
virtual const std::vector< int > & getContent() const
Get the whole content of the list as a vector of int.
virtual size_t getBegin() const
An alphabet exception thrown when trying to specify a bad char to the alphabet.
virtual void beforeSequenceChanged(const SymbolListEditionEvent &event)
EdSymbolList * clone() const
virtual const int & operator[](size_t i) const =0
Operator [] overloaded for quick access to a character in list.
virtual SymbolList * getSymbolList()
EdSymbolList(const Alphabet *alpha)
Build a new void BasicSymbolList object with the specified alphabet.
The SymbolList interface.
SymbolListEditionEvent(SymbolList *list)
SymbolListDeletionEvent(SymbolList *list, size_t pos, size_t len)
virtual const Alphabet * getAlphabet() const
Get the alphabet associated to the list.
const Alphabet * alphabet_
The Alphabet attribute must be initialized in constructor and then can never be changed.
virtual size_t getLength() const
BasicSymbolList & operator=(const SymbolList &list)
The generic assignment operator.
virtual size_t getNumberOfListeners() const
This alphabet is used to deal NumericAlphabet.
virtual void afterSequenceChanged(const SymbolListEditionEvent &event)
virtual void setContent(const std::vector< int > &list)
Set the whole content of the list.
virtual void deleteElements(size_t pos, size_t len)=0
Delete the elements at position 'pos'.
virtual SymbolListListener * clone() const =0
virtual std::string getChar(size_t pos) const
Get the element at position 'pos' as a character.
virtual std::string toString() const
Convert the list as a string.
void fireAfterSequenceChanged(const SymbolListEditionEvent &event)
virtual int & operator[](size_t i)
Operator [] overloaded for quick access to a character in list.
SymbolList * clone() const =0
virtual void afterSequenceSubstituted(const SymbolListSubstitutionEvent &event)
virtual void afterSequenceInserted(const SymbolListInsertionEvent &event)
bool propagateEvents() const
virtual const SymbolList * getSymbolList() const
SymbolListInsertionEvent(SymbolList *list, size_t pos, size_t len)
virtual void deleteElement(size_t pos)
Delete the element at position 'pos'.
std::vector< SymbolListListener * > listeners_
Contains the listeners.
virtual void afterSequenceChanged(const SymbolListEditionEvent &event)=0
SymbolListEditionEvent(const SymbolListEditionEvent &slee)
virtual void deleteElements(size_t pos, size_t len)
Delete the elements at position 'pos'.
virtual void beforeSequenceDeleted(const SymbolListDeletionEvent &event)
virtual ~BasicSymbolList()
virtual ~SymbolListEditionEvent()
virtual size_t getLength() const
virtual void setContent(const std::vector< int > &list)=0
Set the whole content of the list.
virtual void addElement(const std::string &c)=0
Add a character to the end of the list.
virtual void beforeSequenceSubstituted(const SymbolListSubstitutionEvent &event)
virtual void afterSequenceDeleted(const SymbolListDeletionEvent &event)
virtual bool isShared() const =0
virtual int getValue(size_t pos) const
Get the element at position 'pos' as an int.
virtual size_t getPosition() const
virtual const int & operator[](size_t i) const
Operator [] overloaded for quick access to a character in list.
virtual void afterSequenceDeleted(const SymbolListDeletionEvent &event)=0
virtual const std::vector< int > & getContent() const
Get the whole content of the list as a vector of int.
virtual void setElement(size_t pos, const std::string &c)
Set the element at position 'pos' to character 'c'.
virtual void deleteElement(size_t pos)=0
Delete the element at position 'pos'.
virtual std::string getChar(size_t pos) const
Get the element at position 'pos' as a character.
virtual void setContent(const std::vector< int > &list)
Set the whole content of the list.
virtual void beforeSequenceInserted(const SymbolListInsertionEvent &event)=0
virtual void addElement(const std::string &c)
Add a character to the end of the list.
virtual void beforeSequenceInserted(const SymbolListInsertionEvent &event)
virtual SymbolListListener & getListener(size_t i)
virtual int getValue(size_t pos) const
Get the element at position 'pos' as an int.
A basic SymbolList object.
virtual void shuffle()=0
Randomly shuffle the content of the list, with linear complexity.
virtual std::string getChar(size_t pos) const =0
Get the element at position 'pos' as a character.
SymbolListEditionEvent & operator=(const SymbolListEditionEvent &slee)
virtual void shuffle()
Randomly shuffle the content of the list, with linear complexity.
virtual void addSymbolListListener(SymbolListListener *listener)
virtual int getValue(size_t pos) const =0
Get the element at position 'pos' as an int.
virtual void deleteElements(size_t pos, size_t len)
Delete the elements at position 'pos'.
virtual void setElement(size_t pos, const std::string &c)=0
Set the element at position 'pos' to character 'c'.
std::vector< int > content_
The list content.
EdSymbolList & operator=(const SymbolList &list)
The generic assignment operator.
virtual size_t size() const
Get the number of elements in the list.
virtual void removeSymbolListListener(SymbolListListener *listener)
virtual const Alphabet * getAlphabet() const =0
Get the alphabet associated to the list.
virtual int & operator[](size_t i)
Operator [] overloaded for quick access to a character in list.
void fireBeforeSequenceDeleted(const SymbolListDeletionEvent &event)
void fireBeforeSequenceChanged(const SymbolListEditionEvent &event)
virtual bool isRemovable() const =0
virtual size_t size() const =0
Get the number of elements in the list.
virtual const std::vector< int > & getContent() const =0
Get the whole content of the list as a vector of int.
void fireBeforeSequenceSubstituted(const SymbolListSubstitutionEvent &event)
void fireBeforeSequenceInserted(const SymbolListInsertionEvent &event)
virtual std::string toString() const
Convert the list as a string.
virtual void beforeSequenceDeleted(const SymbolListDeletionEvent &event)=0
virtual std::string toString() const =0
Convert the list as a string.
An alphabet exception thrown when trying to specify a bad int to the alphabet.
virtual const Alphabet * getAlphabet() const
Get the alphabet associated to the list.
virtual void afterSequenceSubstituted(const SymbolListSubstitutionEvent &event)=0
A event-driven SymbolList object.
BasicSymbolList * clone() const
virtual const SymbolListListener & getListener(size_t i) const
virtual size_t size() const
Get the number of elements in the list.
virtual void beforeSequenceChanged(const SymbolListEditionEvent &event)=0
const Alphabet * alphabet_
The Alphabet attribute must be initialized in constructor and then can never be changed.
void fireAfterSequenceDeleted(const SymbolListDeletionEvent &event)
virtual void setElement(size_t pos, const std::string &c)
Set the element at position 'pos' to character 'c'.
virtual void deleteElement(size_t pos)
Delete the element at position 'pos'.
virtual const int & operator[](size_t i) const
Operator [] overloaded for quick access to a character in list.
virtual void addElement(const std::string &c)
Add a character to the end of the list.
SymbolListSubstitutionEvent(SymbolList *list, size_t begin, size_t end)
void propagateEvents(bool yn)
virtual size_t getPosition() const
void fireAfterSequenceInserted(const SymbolListInsertionEvent &event)
BasicSymbolList(const Alphabet *alpha)
Build a new void BasicSymbolList object with the specified alphabet.