RWSequenceableRWCollectionRWCollectable
#include <rw/seqcltn.h> typedef RWSequenceable SequenceableCollection; // Smalltalk typedef
Class RWSequenceable is an abstract base class for collections that can be accessed by an index. It inherits class RWCollection as a public base class and adds a few extra virtual functions. This documentation only describes these extra functions.
Polymorphic
RWCollectable* append(RWCollectable*) = 0;
Adds the item to the end of the collection and returns it. Returns nil if the insertion was unsuccessful.
virtual RWCollectable*& at(size_t i); virtual const RWCollectable* at(size_t i) const;
Allows access to the ith element of the collection. The first variant can be used as an lvalue, the second cannot. The index i must be between zero and the number of items in the collection less one, or an exception of type RWBoundsErr will be thrown.
virtual RWCollectable* first() const = 0;
Returns the first item in the collection.
virtual size_t index(const RWCollectable* c) const = 0;
Returns the index number of the first item that "matches" the item pointed to by c. If there is no such item, returns RW_NPOS. For most collections, an item "matches" the target if either isEqual() or compareTo() find equivalence, whichever is appropriate for the actual collection type.
void insertAt(size_t indx, RWCollectable* e);
Adds a new item to the collection at position indx. The item previously at position i is moved to i+1, etc. The index indx must be between 0 and the number of items in the collection, or an exception of type RWBoundsErr will be thrown.
virtual RWCollectable* last() const = 0;
Returns the last item in the collection.
RWCollectable* prepend(RWCollectable*) = 0;
Adds the item to the beginning of the collection and returns it. Returns nil if the insertion was unsuccessful.