5 #ifndef BPP_SEQ_SYMBOLLIST_H
6 #define BPP_SEQ_SYMBOLLIST_H
85 for (
size_t i = 0; i < list.
size(); ++i)
98 for (
size_t i = 0; i < list.
size(); ++i)
149 content_.erase(
content_.begin() +
static_cast<std::ptrdiff_t
>(pos),
content_.begin() +
static_cast<std::ptrdiff_t
>(pos + len));
218 std::vector<std::shared_ptr<CoreSymbolListListener<T>>>
listeners_;
258 for (
size_t i = 0; i < list.
listeners_.size(); ++i)
291 for (
size_t i = 0; i <
listeners_.size(); ++i)
370 throw Exception(
"EventDrivenSymbolList::listener. The specified listener is missing.");
374 virtual std::shared_ptr<const CoreSymbolListListener<T>>
getListener(
size_t i)
const override
382 throw Exception(
"EventDrivenSymbolList::listener. The specified listener is missing.");
386 virtual std::shared_ptr<CoreSymbolListListener<T>>
getListener(
size_t i)
override
401 throw Exception(
"EventDrivenSymbolList::removeCoreSymbolListListener. Listener is not removable.");
418 for (
size_t i = 0; i <
listeners_.size(); ++i)
428 for (
size_t i = 0; i <
listeners_.size(); ++i)
438 for (
size_t i = 0; i <
listeners_.size(); ++i)
448 for (
size_t i = 0; i <
listeners_.size(); ++i)
458 for (
size_t i = 0; i <
listeners_.size(); ++i)
468 for (
size_t i = 0; i <
listeners_.size(); ++i)
478 for (
size_t i = 0; i <
listeners_.size(); ++i)
480 listeners_[i]->beforeSequenceSubstituted(event);
488 for (
size_t i = 0; i <
listeners_.size(); ++i)
490 listeners_[i]->afterSequenceSubstituted(event);
A partial implementation of a EventDrivenSymbolList object.
virtual void setContent(const std::vector< T > &list) override
Set the whole content of the list.
void fireAfterSequenceDeleted(const CoreSymbolListDeletionEvent< T > &event) override
void deleteElements(size_t pos, size_t len) override
Remove the elements at position 'pos'.
virtual CoreSymbolListListener< T > & listener(size_t i) override
AbstractTemplateEventDrivenSymbolList< T > & operator=(const TemplateCoreSymbolListInterface< T > &list)
The generic assignment operator.
std::vector< std::shared_ptr< CoreSymbolListListener< T > > > listeners_
Contains the listeners.
virtual void beforeSequenceChanged(const CoreSymbolListEditionEvent< T > &event) override
AbstractTemplateEventDrivenSymbolList(const AbstractTemplateEventDrivenSymbolList< T > &list)
The copy constructor.
AbstractTemplateEventDrivenSymbolList(const TemplateCoreSymbolListInterface< T > &list)
The generic copy constructor.
void fireBeforeSequenceInserted(const CoreSymbolListInsertionEvent< T > &event) override
virtual std::shared_ptr< const CoreSymbolListListener< T > > getListener(size_t i) const override
virtual void beforeSequenceSubstituted(const CoreSymbolListSubstitutionEvent< T > &event) override
void fireAfterSequenceSubstituted(const CoreSymbolListSubstitutionEvent< T > &event) override
void fireBeforeSequenceChanged(const CoreSymbolListEditionEvent< T > &event) override
virtual void addElement(size_t pos, const T &c) override
Add a character at a certain position in the list.
virtual ~AbstractTemplateEventDrivenSymbolList()=default
virtual void afterSequenceSubstituted(const CoreSymbolListSubstitutionEvent< T > &event) override
virtual size_t getNumberOfListeners() const override
virtual void addElement(const T &c) override
Add a character to the end of the list.
AbstractTemplateEventDrivenSymbolList< T > & operator=(const AbstractTemplateEventDrivenSymbolList &list)
The assignment operator.
virtual void beforeSequenceDeleted(const CoreSymbolListDeletionEvent< T > &event) override
virtual void afterSequenceDeleted(const CoreSymbolListDeletionEvent< T > &event) override
virtual void beforeSequenceInserted(const CoreSymbolListInsertionEvent< T > &event) override
void fireAfterSequenceInserted(const CoreSymbolListInsertionEvent< T > &event) override
virtual std::shared_ptr< CoreSymbolListListener< T > > getListener(size_t i) override
virtual void afterSequenceInserted(const CoreSymbolListInsertionEvent< T > &event) override
virtual const CoreSymbolListListener< T > & listener(size_t i) const override
virtual void removeCoreSymbolListListener(std::shared_ptr< CoreSymbolListListener< T >> listener) override
bool propagateEvents() const override
void fireAfterSequenceChanged(const CoreSymbolListEditionEvent< T > &event) override
void fireBeforeSequenceSubstituted(const CoreSymbolListSubstitutionEvent< T > &event) override
virtual void afterSequenceChanged(const CoreSymbolListEditionEvent< T > &event) override
AbstractTemplateEventDrivenSymbolList(std::shared_ptr< const Alphabet > alpha)
Build a new void EventDrivenSymbolList object with the specified alphabet.
void fireBeforeSequenceDeleted(const CoreSymbolListDeletionEvent< T > &event) override
AbstractTemplateEventDrivenSymbolList(const std::vector< T > &list, std::shared_ptr< const Alphabet > alpha)
Build a new EventDrivenSymbolList object with the specified alphabet. The content of the site is init...
virtual void addCoreSymbolListListener(std::shared_ptr< CoreSymbolListListener< T >> listener) override
virtual void setElement(size_t pos, const T &c) override
Set the element at position 'pos' to character 'c'.
void propagateEvents(bool yn) override
void deleteElement(size_t pos) override
Remove the element at position 'pos'.
A partial implementation of a SymbolList object.
const T & getElement(size_t pos) const override
Get the element at position 'pos' as a character.
void addElement(const T &c) override
Add a character to the end of the list.
virtual void setContent(const std::vector< T > &list) override
Set the whole content of the list.
std::shared_ptr< const Alphabet > alphabet_
The Alphabet attribute must be initialized in constructor and then can never be changed.
virtual std::string toString() const override
Convert the list as a string.
AbstractTemplateSymbolList< T > & operator=(const AbstractTemplateSymbolList< T > &list)
The assignment operator.
void deleteElements(size_t pos, size_t len) override
Remove the elements at position 'pos'.
T & operator[](size_t pos) override
Operator [] overloaded for quick access to a character in list.
AbstractTemplateSymbolList(const std::vector< T > &list, std::shared_ptr< const Alphabet > alpha)
Build a new SymbolList object with the specified alphabet. The content of the site is initialized fro...
virtual ~AbstractTemplateSymbolList()
void shuffle() override
Randomly shuffle the content of the list, with linear complexity.
const Alphabet & alphabet() const override
Get the alphabet associated to the list.
void deleteElement(size_t pos) override
Remove the element at position 'pos'.
void setElement(size_t pos, const T &c) override
Set the element at position 'pos' to character 'c'.
virtual const std::vector< T > & getContent() const override
const T & getValue(size_t pos) const override
checked access to a character in list.
std::shared_ptr< const Alphabet > getAlphabet() const override
Get the alphabet associated to the list.
AbstractTemplateSymbolList(const TemplateCoreSymbolListInterface< T > &list)
The copy constructor.
size_t size() const override
Get the number of elements in the list.
AbstractTemplateSymbolList(const AbstractTemplateSymbolList< T > &list)
The generic copy constructor.
void addElement(size_t pos, const T &c) override
Add a character at a certain position in the list.
AbstractTemplateSymbolList(std::shared_ptr< const Alphabet > alpha)
Build a new void SymbolList object with the specified alphabet.
const T & operator[](size_t pos) const override
Operator [] overloaded for quick access to a character in list.
std::vector< T > content_
The list content.
AbstractTemplateSymbolList< T > & operator=(const TemplateCoreSymbolListInterface< T > &list)
The generic assignment operator.
virtual std::shared_ptr< const Alphabet > getAlphabet() const =0
Get the alphabet associated to the list.
virtual size_t size() const =0
Get the number of elements in the list.
The CoreSymbolList interface.
Interface for event-driven CoreSymbolList objects.
This alphabet is used to deal NumericAlphabet.