deferred class C_ARRAY [ITEM_ -> C_STRUCT]
Summary
Class invariant
Overview
Exported features
Writing:
Adding:
  • add_first (element: ITEM_)
    Performance: O(count), not counting the eventual reallocation.
  • add_last (element: ITEM_)
    Performance: O(1), not counting the eventual reallocation.
  • add (element: ITEM_, index: INTEGER_32)
    Performance: O(count-index), not counting the eventual reallocation
Modification:
  • copy (other: C_ARRAY [ITEM_ -> C_STRUCT])
    Reinitialize by copying all the items of other.
  • force (element: ITEM_, index: INTEGER_32)
    Make element the item at index, enlarging the collection if necessary (new bounds except index are initialized with default values).
  • from_collection (model: COLLECTION[ITEM_])
    Initialize the current object with the contents of model.
Removing:
Looking and Searching:
Looking and comparison:
Other features:
  • replace_all (old_value: ITEM_, new_value: ITEM_)
    Replace all occurrences of the element old_value by new_value using is_equal for comparison.
  • fast_replace_all (old_value: ITEM_, new_value: ITEM_)
    Replace all occurrences of the element old_value by new_value using basic = for comparison.
  • slice (min: INTEGER_32, max: INTEGER_32): C_ARRAY [ITEM_ -> C_STRUCT]
    New collection consisting of items at indexes in [min..max].
  • reverse
    Reverse the order of the elements.
struct_size: INTEGER
Implementation
TODO: unimplemented
Implementation
Accessing:
Writing:
Adding:
Looking and Searching:
Looking and comparison:
Other features:
Other features:
Agent-based features:
Printing:
Agent-based features:
Indexing:
Implementation
  • wrapper_or_void (a_pointer: POINTER): ITEM_
    A wrapper for a_pointer or Void if a_pointer default_pointer (NULL in C).
Various exceptions codes:
Status report:
Basic operations:
  • die (code: INTEGER_32)
    Terminate execution with exit status code, without triggering an exception.
  • raise (name: STRING)
    Raise a developer exception of name name.
  • throw (a_exception: EXCEPTION)
Non-Standard Extensions:
item (i: INTEGER_32): ITEM_
effective function
Item at the corresponding index i.
first: ITEM_
effective function
The very first item.
last: ITEM_
effective function
The last item.
put (element: ITEM_, i: INTEGER_32)
effective procedure
Make element the item at index i.
set_all_with (v: ITEM_)
effective procedure
Set all items with value v.
add_first (element: ITEM_)
effective procedure
Performance: O(count), not counting the eventual reallocation.
add_last (element: ITEM_)
effective procedure
Performance: O(1), not counting the eventual reallocation.
add (element: ITEM_, index: INTEGER_32)
effective procedure
Performance: O(count-index), not counting the eventual reallocation
copy (other: C_ARRAY [ITEM_ -> C_STRUCT])
effective procedure
Reinitialize by copying all the items of other.
force (element: ITEM_, 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).
from_collection (model: COLLECTION[ITEM_])
effective procedure
Initialize the current object with the contents of model.
remove_first
effective procedure
Performance: O(count)
remove_head (n: INTEGER_32)
effective procedure
Performance: O(upper-n)
remove (index: INTEGER_32)
effective procedure
Performance: O(count)
remove_last
effective procedure
Performance: O(1)
remove_tail (n: INTEGER_32)
effective procedure
Performance: O(n)
clear_count
effective procedure
Discard all items (is_empty is True after that call).
clear_count_and_capacity
effective procedure
Instead of releasing the memory, it is reallocated with with 2 elements.
first_index_of (element: ITEM_): INTEGER_32
effective function
Give the index of the first occurrence of element using is_equal for comparison.
index_of (element: ITEM_, 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: ITEM_, 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: ITEM_): INTEGER_32
effective function
Note: comparison is done using the address of the wrapped structure.
fast_index_of (element: ITEM_, start_index: INTEGER_32): INTEGER_32
effective function
Note: comparison is done using the address of the wrapped structure.
fast_reverse_index_of (element: ITEM_, start_index: INTEGER_32): INTEGER_32
effective function
Note: comparison is done using the address of the wrapped structure
is_equal (other: C_ARRAY [ITEM_ -> C_STRUCT]): BOOLEAN
effective function
Do both collections have the same lower, upper, and items?
all_default: BOOLEAN
effective function
Do all items have their type's default value?
occurrences (element: ITEM_): INTEGER_32
effective function
Number of occurrences of element using is_equal for comparison.
fast_occurrences (element: ITEM_): INTEGER_32
effective function
Number of occurrences of element using basic its handle (or default_pointer) for comparison.
replace_all (old_value: ITEM_, new_value: ITEM_)
effective procedure
Replace all occurrences of the element old_value by new_value using is_equal for comparison.
fast_replace_all (old_value: ITEM_, new_value: ITEM_)
effective procedure
Replace all occurrences of the element old_value by new_value using basic = for comparison.
slice (min: INTEGER_32, max: INTEGER_32): C_ARRAY [ITEM_ -> C_STRUCT]
effective function
New collection consisting of items at indexes in [min..max].
reverse
effective procedure
Reverse the order of the elements.
count: INTEGER_32
effective function
Number of available items in the hoard.
upper: INTEGER_32
writable attribute
Maximum index.
lower: INTEGER_32
is 0
constant attribute
Minimum index.
is_empty: BOOLEAN
effective function
Is the hoard empty ?
See also count.
new_iterator: ITERATOR[ITEM_]
effective function
as_c_array: NATIVE_ARRAY[POINTER]
effective function
Current collection as a C array meant to be passed to C functions expectiong an array of wrapped items.
writable attribute
capacity: INTEGER_32
writable attribute
clear_all
effective procedure
fast_has (an_item: ITEM_): BOOLEAN
effective function
has (an_item: ITEM_): BOOLEAN
effective function
swap (i1: INTEGER_32, i2: INTEGER_32)
effective procedure
append_collection (another: COLLECTION[ITEM_])
effective procedure
wrapper (a_pointer: POINTER): ITEM_
deferred function
The wrapper for a_pointer.
infix "@" (i: INTEGER_32): E_
frozen
effective function
The infix notation which is actually just a synonym for item.
set_slice_with (v: ANY, lower_index: INTEGER_32, upper_index: INTEGER_32)
effective procedure
Set all items in range [lower_index .. upper_index] with v.
append_traversable (other: TRAVERSABLE[E_])
effective procedure
Append other to Current.
last_index_of (element: ANY): 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: ANY): INTEGER_32
effective function
Using basic = for comparison, gives the index of the last occurrence of element at or before upper.
fast_is_equal (other: C_ARRAY [ITEM_ -> C_STRUCT]): BOOLEAN
deferred function
Do both collections have the same lower, upper, and items?
is_equal_map (other: C_ARRAY [ITEM_ -> C_STRUCT]): BOOLEAN
effective function
Do both collections have the same lower, upper, and items?
same_items (other: COLLECTION[E_]): BOOLEAN
effective function
Do both collections have the same items?
move (lower_index: INTEGER_32, upper_index: INTEGER_32, distance: INTEGER_32)
effective procedure
Move range lower_index ..
enumerate: ENUMERATE[E_]
effective function
get_new_iterator: ITERATOR[E_]
frozen
effective function
for_each (action: PROCEDURE[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?
aggregate (action: FUNCTION[TUPLE[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
Aggregate all the elements starting from the initial value.
out_in_tagged_out_memory
effective procedure
Append terse printable representation of current object in tagged_out_memory.
generation: INTEGER_32
writable attribute
do_all (action: ROUTINE[TUPLE[TUPLE 1[E_]]])
frozen
effective procedure
Apply action to every item of Current.
valid_index (i: INTEGER_32): BOOLEAN
effective function
True when i is valid (i.e., inside actual bounds).
wrapper_or_void (a_pointer: POINTER): ITEM_
effective function
A wrapper for a_pointer or Void if a_pointer default_pointer (NULL in C).
Check_instruction: INTEGER_32
is 1
constant attribute
Exception code for violated check.
Class_invariant: INTEGER_32
is 2
constant attribute
Exception code for violated class invariant.
Developer_exception: INTEGER_32
is 3
constant attribute
Exception code for developer exception.
Incorrect_inspect_value: INTEGER_32
is 4
constant attribute
Exception code for inspect statement.
Loop_invariant: INTEGER_32
is 5
constant attribute
Exception code for violated loop invariant
Loop_variant: INTEGER_32
is 6
constant attribute
Exception code for non-decreased loop variant
No_more_memory: INTEGER_32
is 7
constant attribute
Exception code for failed memory allocation
Postcondition: INTEGER_32
is 8
constant attribute
Exception code for violated postcondition.
Precondition: INTEGER_32
is 9
constant attribute
Exception code for violated precondition.
Routine_failure: INTEGER_32
is 10
constant attribute
Exception code for failed routine.
Os_signal: INTEGER_32
is 11
constant attribute
Exception code for a signal received from the OS.
Void_attached_to_expanded: INTEGER_32
is 12
constant attribute
Exception code for attachment of Void value to expanded entity.
Void_call_target: INTEGER_32
is 13
constant attribute
Exception code for feature applied to Void reference
System_level_type_error: INTEGER_32
is 14
constant attribute
Exception code for the system-level type error (this kind of error mostly arise with covariant redefinition).
exception_name: STRING
effective function
name_of_exception (a_exception: INTEGER_32): STRING
effective function
developer_exception: EXCEPTION
effective function
The last developer-thrown exception.
developer_exception_name: STRING
effective function
Name of last developer-raised exception.
is_developer_exception: BOOLEAN
effective function
Is the last exception originally due to a developer exception?
is_developer_named_exception: BOOLEAN
effective function
Is the last exception originally due to a developer exception?
is_developer_exception_of_name (name: STRING): BOOLEAN
effective function
Is the last exception originally due to a developer exception of name name?
assertion_violation: BOOLEAN
effective function
Is last exception originally due to a violated assertion or non-decreasing variant?
exception: INTEGER_32
Code of last exception that occurred.
is_signal: BOOLEAN
effective function
Is last exception originally due to an external event (operating system signal) ?
die (code: INTEGER_32)
effective procedure
Terminate execution with exit status code, without triggering an exception.
raise (name: STRING)
effective procedure
Raise a developer exception of name name.
throw (a_exception: EXCEPTION)
effective procedure
signal_number: INTEGER_32
Signal Number received from OS.