+
Point of view
All features
class QUEUE [E_]
Summary
Class invariant
Overview
creation features
  • make
    Create an empty array.
  • with_capacity (needed_capacity: INTEGER_32)
    Create an empty array with capacity initialized at least to needed_capacity
features
Modification:
Implementation of deferred:
  • count: INTEGER_32
    Number of available indices.
  • is_empty: BOOLEAN
    Is collection empty ?
    See also count.
  • subarray (min: INTEGER_32, max: INTEGER_32): QUEUE [E_]
    New collection consisting of items at indexes in [min .. max].
  • item (i: INTEGER_32): E_
    Item at the corresponding index i.
  • put (element: E_, i: INTEGER_32)
    Make element the item at index i.
  • force (element: E_, index: INTEGER_32)
    Make element the item at index, enlarging the collection if necessary (new bounds except index are initialized with default values).
  • copy (other: QUEUE [E_])
    Reinitialize by copying all the items of other.
  • set_all_with (v: E_)
    Set all items with value v.
  • remove_first
    Remove the first element of the collection.
  • remove_head (n: INTEGER_32)
    Remove the n elements of the collection.
  • remove (index: INTEGER_32)
    Remove the item at position index.
  • clear_count
    Discard all items (is_empty is True after that call).
  • clear_count_and_capacity
    Discard all items (is_empty is True after that call).
  • add_first (element: E_)
    Add a new item in first position : count is increased by one and all other items are shifted right.
  • add_last (element: E_)
    Add a new item at the end : count is increased by one.
  • from_collection (model: TRAVERSABLE[E_])
    Initialize the current object with the contents of model.
  • all_default: BOOLEAN
    Do all items have their type's default value?
  • occurrences (element: E_): INTEGER_32
    Number of occurrences of element using is_equal for comparison.
  • fast_occurrences (element: E_): INTEGER_32
    Number of occurrences of element using basic = for comparison.
  • first_index_of (element: E_): INTEGER_32
    Give the index of the first occurrence of element using is_equal for comparison.
  • index_of (element: E_, start_index: INTEGER_32): INTEGER_32
    Using is_equal for comparison, gives the index of the first occurrence of element at or after start_index.
  • reverse_index_of (element: E_, start_index: INTEGER_32): INTEGER_32
    Using is_equal for comparison, gives the index of the first occurrence of element at or before start_index.
  • fast_first_index_of (element: E_): INTEGER_32
    Give the index of the first occurrence of element using basic = for comparison.
  • fast_index_of (element: E_, start_index: INTEGER_32): INTEGER_32
    Using basic = for comparison, gives the index of the first occurrence of element at or after start_index.
  • fast_reverse_index_of (element: E_, start_index: INTEGER_32): INTEGER_32
    Using basic = comparison, gives the index of the first occurrence of element at or before start_index.
  • is_equal (other: QUEUE [E_]): BOOLEAN
    Do both collections have the same lower, upper, and items?
  • is_equal_map (other: QUEUE [E_]): BOOLEAN
    Do both collections have the same lower, upper, and items?
  • slice (min: INTEGER_32, max: INTEGER_32): QUEUE [E_]
    New collection consisting of items at indexes in [min..max].
  • first: E_
    The very first item.
Garbage collector tuning (very low-level):
  • mark_native_arrays
    For performance reasons, the unused area of storage is always left as it is when some elements are removed.
Implement manifest generic creation (very low-level):
Accessing:
Writing:
Adding:
  • add (element: E_, index: INTEGER_32)
    Add a new element at rank index : count is increased by one and range [index .. upper] is shifted right by one position.
  • append_collection (other: COLLECTION[E_])
    Append other to Current.
Removing:
Looking and Searching:
  • has (x: E_): BOOLEAN
    Look for x using is_equal for comparison.
  • fast_has (x: E_): BOOLEAN
    Look for x using basic = for comparison.
  • last_index_of (element: E_): INTEGER_32
    Using is_equal for comparison, gives the index of the last occurrence of element at or before upper.
  • fast_last_index_of (element: E_): INTEGER_32
    Using basic = for comparison, gives the index of the last occurrence of element at or before upper.
Looking and comparison:
Printing:
  • fill_tagged_out_memory
    Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.
Agents based features:
Other features:
  • replace_all (old_value: E_, new_value: E_)
    Replace all occurrences of the element old_value by new_value using is_equal for comparison.
  • fast_replace_all (old_value: E_, new_value: E_)
    Replace all occurrences of the element old_value by new_value using basic = for comparison.
  • move (lower_index: INTEGER_32, upper_index: INTEGER_32, distance: INTEGER_32)
    Move range lower_index ..
  • reverse
    Reverse the order of the elements.
Implement manifest generic creation:
Indexing:
Accessing:
  • last: E_
    The last item.
make
effective procedure
Create an empty array.
with_capacity (needed_capacity: INTEGER_32)
effective procedure
Create an empty array with capacity initialized at least to needed_capacity
get_new_iterator: ITERATOR[E_]
effective function
lower: INTEGER_32
writable attribute
Lower index bound
resize (min_index: INTEGER_32, max_index: INTEGER_32)
effective procedure
Resize to bounds min_index and max_index.
reindex (new_lower: INTEGER_32)
effective procedure
Change indexing to take in account the expected new_lower index.
count: INTEGER_32
effective function
Number of available indices.
is_empty: BOOLEAN
effective function
Is collection empty ?
See also count.
subarray (min: INTEGER_32, max: INTEGER_32): QUEUE [E_]
effective function
New collection consisting of items at indexes in [min .. max].
item (i: INTEGER_32): E_
effective function
Item at the corresponding index i.
put (element: E_, i: INTEGER_32)
effective procedure
Make element the item at index i.
force (element: E_, index: INTEGER_32)
effective procedure
Make element the item at index, enlarging the collection if necessary (new bounds except index are initialized with default values).
copy (other: QUEUE [E_])
effective procedure
Reinitialize by copying all the items of other.
set_all_with (v: E_)
effective procedure
Set all items with value v.
remove_first
effective procedure
Remove the first element of the collection.
remove_head (n: INTEGER_32)
effective procedure
Remove the n elements of the collection.
remove (index: INTEGER_32)
effective procedure
Remove the item at position index.
clear_count
effective procedure
Discard all items (is_empty is True after that call).
clear_count_and_capacity
effective procedure
Discard all items (is_empty is True after that call).
add_first (element: E_)
effective procedure
Add a new item in first position : count is increased by one and all other items are shifted right.
add_last (element: E_)
effective procedure
Add a new item at the end : count is increased by one.
from_collection (model: TRAVERSABLE[E_])
effective procedure
Initialize the current object with the contents of model.
all_default: BOOLEAN
effective function
Do all items have their type's default value?
occurrences (element: E_): INTEGER_32
effective function
Number of occurrences of element using is_equal for comparison.
fast_occurrences (element: E_): INTEGER_32
effective function
Number of occurrences of element using basic = for comparison.
first_index_of (element: E_): INTEGER_32
effective function
Give the index of the first occurrence of element using is_equal for comparison.
index_of (element: E_, start_index: INTEGER_32): INTEGER_32
effective function
Using is_equal for comparison, gives the index of the first occurrence of element at or after start_index.
reverse_index_of (element: E_, start_index: INTEGER_32): INTEGER_32
effective function
Using is_equal for comparison, gives the index of the first occurrence of element at or before start_index.
fast_first_index_of (element: E_): INTEGER_32
effective function
Give the index of the first occurrence of element using basic = for comparison.
fast_index_of (element: E_, start_index: INTEGER_32): INTEGER_32
effective function
Using basic = for comparison, gives the index of the first occurrence of element at or after start_index.
fast_reverse_index_of (element: E_, start_index: INTEGER_32): INTEGER_32
effective function
Using basic = comparison, gives the index of the first occurrence of element at or before start_index.
is_equal (other: QUEUE [E_]): BOOLEAN
effective function
Do both collections have the same lower, upper, and items?
is_equal_map (other: QUEUE [E_]): BOOLEAN
effective function
Do both collections have the same lower, upper, and items?
slice (min: INTEGER_32, max: INTEGER_32): QUEUE [E_]
effective function
New collection consisting of items at indexes in [min..max].
first: E_
effective function
The very first item.
make_space_for_one
effective procedure
Make sure storage is big enough to hold at least one more element.
clear_slice (min: INTEGER_32, max: INTEGER_32)
effective procedure
squeeze_bubble (min: INTEGER_32, max: INTEGER_32, pos: INTEGER_32, length: INTEGER_32)
effective procedure
unwrap
effective procedure
to_external: POINTER
effective function
Gives C access into the internal storage of the ARRAY.
is_wrapped: BOOLEAN
effective function
storage_lower: INTEGER_32
writable attribute
Index of first in storage This would always be 0 for regular arrays.
storage_upper: INTEGER_32
effective function
Index of last in storage
storage_index (i: INTEGER_32): INTEGER_32
effective function
Index in storage corresponding to index i in Current
in_storage (index: INTEGER_32): BOOLEAN
effective function
wrap_point: INTEGER_32
effective function
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.
slices_are_equal (other: QUEUE [E_], wp: INTEGER_32, owp: INTEGER_32): BOOLEAN
effective function
slices_are_equal_map (other: QUEUE [E_], wp: INTEGER_32, owp: INTEGER_32): BOOLEAN
effective function
mark_native_arrays
effective procedure
For performance reasons, the unused area of storage is always left as it is when some elements are removed.
manifest_make (needed_capacity: INTEGER_32, initial_lower: INTEGER_32)
effective procedure
Manifest creation of a RING_ARRAY lower set to initial_lower.
manifest_put (index: INTEGER_32, element: E_)
effective procedure
infix "@" (i: INTEGER_32): E_
frozen
effective function
The infix notation which is actually just a synonym for item.
swap (i1: INTEGER_32, i2: INTEGER_32)
effective procedure
Swap item at index i1 with item at index i2.
set_slice_with (v: E_, lower_index: INTEGER_32, upper_index: INTEGER_32)
effective procedure
Set all items in range [lower_index .. upper_index] with v.
clear_all
effective procedure
Set every item to its default value.
add (element: E_, index: INTEGER_32)
deferred procedure
Add a new element at rank index : count is increased by one and range [index .. upper] is shifted right by one position.
append_collection (other: COLLECTION[E_])
effective procedure
Append other to Current.
remove_last
deferred procedure
Remove the last item.
remove_tail (n: INTEGER_32)
deferred procedure
Remove the last n item(s).
has (x: E_): BOOLEAN
effective function
Look for x using is_equal for comparison.
fast_has (x: E_): BOOLEAN
effective function
Look for x using basic = for comparison.
last_index_of (element: E_): INTEGER_32
effective function
Using is_equal for comparison, gives the index of the last occurrence of element at or before upper.
fast_last_index_of (element: E_): INTEGER_32
effective function
Using basic = for comparison, gives the index of the last occurrence of element at or before upper.
same_items (other: COLLECTION[E_]): BOOLEAN
effective function
Do both collections have the same items?
fill_tagged_out_memory
frozen
effective procedure
Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.
do_all (action: ROUTINE[TUPLE[TUPLE 1[E_]]])
effective procedure
Apply action to every item of Current.
for_all (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
Do all items satisfy test?
exists (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
Does at least one item satisfy test?
replace_all (old_value: E_, new_value: E_)
deferred procedure
Replace all occurrences of the element old_value by new_value using is_equal for comparison.
fast_replace_all (old_value: E_, new_value: E_)
deferred procedure
Replace all occurrences of the element old_value by new_value using basic = for comparison.
move (lower_index: INTEGER_32, upper_index: INTEGER_32, distance: INTEGER_32)
effective procedure
Move range lower_index ..
reverse
deferred procedure
Reverse the order of the elements.
manifest_semicolon_check: BOOLEAN
constant attribute
upper: INTEGER_32
deferred function
Maximum index.
valid_index (i: INTEGER_32): BOOLEAN
effective function
True when i is valid (i.e., inside actual bounds).
last: E_
deferred function
The last item.
storage: NATIVE_ARRAY[E_]
writable attribute
Internal access to storage location.
capacity: INTEGER_32
writable attribute
Internal storage capacity in number of item.
set_upper (new_upper: INTEGER_32)
effective procedure
mark_item (native_array: NATIVE_ARRAY[E_], index: INTEGER_32)
To be used _only_ inside the definition of mark_native_arrays.