lib/storage |
|
COLLECTION2 | Abstract definition of a 2 dimensional collection of elements of type E. The SmartEiffel standard library (SmartEiffel/lib/base) provides two implementations of COLLECTION2[E]: ARRAY2[E] and FIXED_ARRAY2[E]. All implementations have exactly the same behavior. Switching from one implementation to another only change the memory used and the execution time. |
COLLECTION3 | Abstract definition of a 3 dimensional collection of elements of type E. The SmartEiffel standard library (SmartEiffel/lib/base) provides two implementations of COLLECTION3[E]: ARRAY3[E] and FIXED_ARRAY3[E]. All implementations have exactly the same behavior. Switching from one implementation to another only change the memory used and the execution time. |
COLLECTION | Common abstract definition of a sequenceable collection of objects. Such a collection is traversable using a simple INTEGER index from `lower' to `upper' using `item'. All COLLECTIONs are resizable thanks to `add_last' / `remove_last' and `add_first' / `remove_first'. This abstraction provides feature to view a COLLECTION as a stack (as an example by using `add_last', `last', and `remove_last'). One can also use a COLLECTION as a queue (as an example, by using `add_last', `first' and `remove_first'). The SmartEiffel standard library provides five implementations of COLLECTION[E]: ARRAY[E], FAST_ARRAY[E], RING_ARRAY[E], LINKED_LIST[E] and TWO_WAY_LINKED_LIST[E]. Except for creations all implementations have exactly the same behavior. Switching from one implementation to another only change the memory used and the execution time (see header comment of ARRAY[E], FAST_ARRAY[E], RING_ARRAY[E], LINKED_LIST[E] and TWO_WAY_LINKED_LIST[E] for more details). |
DICTIONARY | Associative memory. Values of type `V' are stored using Keys of type `K'. |
DOUBLE_DICTIONARY | Double dictionaries (symmetry value / key) (class akin to SIMPLE_DICTIONARY) |
SET | Definition of a mathematical set of objects. All common operations on mathematical sets are available. |
SIMPLE_DICTIONARY | Basic dictionaries (assymmetry value / key) (class akin to DOUBLE_DICTIONARY) |
Provides storage classes of all kind. We call "storage objects" instances of classes that can store many objects of the same kind.
There are three kinds of storage classes:
Storage objects all provide the same kind of features regarding to the access to elements (iteration). In fact, they provide two iteration patterns:
This cluster also provides natural differenciation between abstractions and their implementations. All the
abstractions are in the lib/storage
cluster, while the implementations reside each in a
sub-cluster reflecting to which abstraction their classes refer to.
Collections are sequences of object than can be directly accessed by their index. That's what is called "lists" in other libraries. See also collection2 (indexed matrices) and collection3 (indexed 3D matrices)
On the implementation side, we have the classical ARRAY
s, but also lists (single- or double-linked). There is also the FAST_ARRAY
, a zero-bound array, and the RING_ARRAY
which is a ring buffer.
Dictionaries are sets of couples (key, value). Each key is unique in the dictionany. Double-dictionaries have a stronger constraint: each value is also unique.
There are two families of implementation: hashed-based dictionaries (using hashable objects, see the abilities cluster) and AVL-based dictionaries (using comparable objects in a balanced tree, and ensuring the iteration order to be growing).
Sets are groups of objects. Each object can only be once in a set; all that can be known about an object is, is it in the set or not. Multi-sets allow objects to be several times in the group, associationg a counter with each object (note: multi-sets are not yet available).
The implementations are quite similar to the dictionaries: there are hashed-based and AVL-based sets, with the same constraints and properties than the dictionaries.