The main purpose of the RING_ARRAY implementation is to allow efficient manipulation of the queue
concept (i.e. using for example add_last / first / remove_first). Actually, the RING_ARRAY
implementation provides very good performance for all of the following features: add_last, last,
remove_last, add_first, first, remove_first.
Furthermore, the RING_ARRAY implementation also has a common point with traditional ARRAY: the lower
bound can be any arbitrary value, even a negative one.
As ARRAY or FAST_ARRAY, the RING_ARRAY uses only one chunk of memory, the storage area which is a
NATIVE_ARRAY. This internal storage area is used in a circular way (no left- or right-alignment),
hence the very good performances for using it as a queue. Finally, if you have to perform many insertions
in the middle of your COLLECTION, do not expect good performance with a RING_ARRAY, but consider
LINKED_LIST or TWO_WAY_LINKED_LIST.
Index in Current (seen as a COLLECTION) such that for any
valid_indexes i and j, if i < wrap_point and j >=
wrap_point then storage_index(i) > storage_index(j)
This can happen because of the circular nature of the
array.
Do not lose any
item whose index is in both [lower .. upper] and
[min_index .. max_index]. New positions if any are
initialized with the appropriate default value.
NOTE: do not free/realloc the Result. Any operation that changes
lower or upper can make this pointer useless (because the
array has wrapped or its beginning in the storage has moved),
and operations that change capacity can make it invalid
(because new memory has been allocated and the old memory has
been freed)
Index in Current (seen as a COLLECTION) such that for any
valid_indexes i and j, if i < wrap_point and j >=
wrap_point then storage_index(i) > storage_index(j)
This can happen because of the circular nature of the
array.
wrap_point is not a valid_index if and only if
there is no such point (i.e. the array doesn't wrap).
The basic = is used
for comparison of items and indices are not considered (for
example this routine may yeld True with Current indexed in
range [1..2] and other indexed in range [2..3]).