+
Point of view
All features
class FAST_ARRAY3 [E_]
Summary
Resizable three dimensional array. Unlike ARRAY3, the lower1, lower2 and lower3 bounds are frozen to 0. Thus, one can expect better performances.
Direct parents
Inherit list: COLLECTION3
Insert list: NATIVE_ARRAY_COLLECTOR
Class invariant
Overview
Creation features
{ANY}
Features
{ANY}
{}
{FAST_ARRAY3}
{ANY}
Implementation of others feature from COLLECTION3:
{ANY}
Writing:
{ANY}
Looking and comparison:
{ANY}
Resizing:
{ANY}
Looking and Searching:
{ANY}
Other features:
{ANY}
  • 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 operator = for comparison.
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.
Indexing:
{ANY}
Index validity:
{ANY}
Counting:
{ANY}
{ANY}
Looking and comparison:
{ANY}
Printing:
{ANY}
Miscellaneous features:
{ANY}
{ANY}
  • test (e1: E_, e2: E_): BOOLEAN
    In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
  • safe_equal (e1: E_, e2: E_): BOOLEAN
    In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
{}
upper1: INTEGER_32
writable attribute
{ANY}
Upper index bound for dimension 1.
count1: INTEGER_32
writable attribute
{ANY}
Size of the first dimension.
ensure
  • Result = upper1 - lower1 + 1
upper2: INTEGER_32
writable attribute
{ANY}
Upper index bound for dimension 2.
count2: INTEGER_32
writable attribute
{ANY}
Size of the second dimension.
ensure
  • Result = upper2 - lower2 + 1
upper3: INTEGER_32
writable attribute
{ANY}
Upper index bound for dimension 3.
count3: INTEGER_32
writable attribute
{ANY}
Size of the third dimension.
ensure
  • Result = upper3 - lower3 + 1
count: INTEGER_32
writable attribute
{ANY}
Total number of elements.
ensure
  • Result = line_count * column_count * depth_count
count2x3: INTEGER_32
writable attribute
{}
To speed up access, this value is always equal to count2 * count3
storage: NATIVE_ARRAY[E_]
writable attribute
capacity: INTEGER_32
writable attribute
of storage.
lower1: INTEGER_32
is 0
constant attribute
{ANY}
Lower index bound for dimension 1.
lower2: INTEGER_32
is 0
constant attribute
{ANY}
Lower index bound for dimension 2.
lower3: INTEGER_32
is 0
constant attribute
{ANY}
Lower index bound for dimension 3.
make (new_count1: INTEGER_32, new_count2: INTEGER_32, new_count3: INTEGER_32)
effective procedure
{ANY}
Create or reset Current with new dimensions.
All elements are set to the default value of type E_.
require
  • new_count1 > 0
  • new_count2 > 0
  • new_count3 > 0
ensure
from_collection3 (model: COLLECTION3[E_])
effective procedure
{ANY}
Uses the model to update Current.
require
  • model /= Void
ensure
  • count1 = model.count1
  • count2 = model.count2
  • count3 = model.count3
from_collection (contents: COLLECTION[E_], new_count1: INTEGER_32, new_count2: INTEGER_32, new_count3: INTEGER_32)
effective procedure
{ANY}
Reset all bounds using new_count#i.
Copy all elements of contents, line by line into Current.
require
  • new_count1 >= 0
  • new_count2 >= 0
  • new_count3 >= 0
  • contents.count = new_count1 * new_count2 * new_count3
ensure
from_model (model: COLLECTION[COLLECTION[COLLECTION[E_]]])
effective procedure
{ANY}
The model is used to fill line by line the COLLECTION3.
Assume all sub-collections of have the same indexing.
require
  • model /= Void
ensure
  • line_maximum = model.upper - model.lower
  • column_maximum = model.first.upper - model.first.lower
  • depth_maximum = model.first.first.upper - model.first.first.lower
  • count1 = model.count
  • count2 > 0 implies count2 = model.first.count
  • count3 > 0 implies count3 = model.first.first.count
item (line: INTEGER_32, column: INTEGER_32, depth: INTEGER_32): E_
effective function
{ANY}
require
  • valid_index(line, column, depth)
put (x: E_, line: INTEGER_32, column: INTEGER_32, depth: INTEGER_32)
effective procedure
{ANY}
require
  • valid_index(line, column, depth)
ensure
  • item(line, column, depth) = x
force (element: E_, line: INTEGER_32, column: INTEGER_32, depth: INTEGER_32)
effective procedure
{ANY}
Put element at position (line,column,depth).
Collection is resized first when (line,column,depth) is not inside current bounds. New bounds are initialized with default values.
require
  • line >= 0
  • column >= 0
  • depth >= 0
ensure
  • item(line, column, depth) = element
  • count >= old count
copy (other: FAST_ARRAY3 [E_])
effective procedure
{ANY}
require
    • not immutable
    • same_dynamic_type(other)
    • not immutable
    • same_dynamic_type(other)
ensure
  • is_equal(other)
sub_collection3 (line_min: INTEGER_32, line_max: INTEGER_32, column_min: INTEGER_32, column_max: INTEGER_32, depth_min: INTEGER_32, depth_max: INTEGER_32): FAST_ARRAY3 [E_]
effective function
{ANY}
Create a new object using selected area of Current.
require
  • valid_index(line_min, column_min, depth_min)
  • valid_index(line_max, column_max, depth_max)
ensure
  • Result.upper1 = line_max - line_min
  • Result.upper2 = column_max - column_min
  • Result.upper3 = depth_max - depth_min
  • Result /= Void
set_all_with (x: E_)
effective procedure
{ANY}
All element are set with the value x.
ensure
  • count = old count
all_default: BOOLEAN
effective function
{ANY}
Do all items have their type's default value?
slice (l1: INTEGER_32, up1: INTEGER_32, l2: INTEGER_32, up2: INTEGER_32, l3: INTEGER_32, up3: INTEGER_32): FAST_ARRAY3 [E_]
effective function
{ANY}
Create a new collection initialized with elements of range low..up.
Result has the same dynamic type as Current collection.
set_slice (element: E_, l1: INTEGER_32, up1: INTEGER_32, l2: INTEGER_32, up2: INTEGER_32, l3: INTEGER_32, up3: INTEGER_32)
effective procedure
{ANY}
Set all the elements in the range [(l1,up1),(l2,up2),(l3,up3)] of Current with the element 'element'.
swap (line1: INTEGER_32, column1: INTEGER_32, depth1: INTEGER_32, line2: INTEGER_32, column2: INTEGER_32, depth2: INTEGER_32)
effective procedure
{ANY}
Swap the element at index (line1,column1,depth1) with the element at index (line2,column2,depth2).
require
  • valid_index(line1, column1, depth1)
  • valid_index(line2, column2, depth2)
ensure
  • item(line1, column1, depth1) = old item(line2, column2, depth2)
  • item(line2, column2, depth2) = old item(line1, column1, depth1)
  • count = old count
occurrences (elt: E_): INTEGER_32
effective function
{ANY}
Number of occurrences using is_equal.
See also fast_occurrences to choose the appropriate one.
ensure
  • Result >= 0
fast_occurrences (elt: E_): INTEGER_32
effective function
{ANY}
Number of occurrences using =.
See also occurrences to choose the appropriate one.
ensure
  • Result >= 0
resize (new_count1: INTEGER_32, new_count2: INTEGER_32, new_count3: INTEGER_32)
effective procedure
{ANY}
require
  • new_count1 > 0
  • new_count2 > 0
  • new_count3 > 0
ensure
has (x: E_): BOOLEAN
effective function
{ANY}
Look for x using equal for comparison.
fast_has (x: E_): BOOLEAN
effective function
{ANY}
Same as has but use = for comparison
replace_all (old_value: E_, new_value: E_)
effective procedure
{ANY}
Replace all occurrences of the element old_value by new_value using is_equal for comparison.
See also fast_replace_all to choose the appropriate one.
ensure
  • count = old count
  • occurrences(old_value) = 0
fast_replace_all (old_value: E_, new_value: E_)
effective procedure
{ANY}
Replace all occurrences of the element old_value by new_value using operator = for comparison.
See also replace_all to choose the appropriate one.
ensure
  • count = old count
  • fast_occurrences(old_value) = 0
mark_native_arrays
effective procedure
{}
For performance reasons, the unused area of storage is always left as it is when some elements are removed.
No time is lost to clean the released area with a Void or a 0 value. Thus, the unused area of storage may contains references of actually unreachable objects. The following mark_native_arrays actually replace the default behavior (the call is automatic) in order to mark only reachable objects.
line_minimum: INTEGER_32
frozen
effective function
{ANY}
Equivalent of lower1.
column_minimum: INTEGER_32
frozen
effective function
{ANY}
Equivalent of lower2.
depth_minimum: INTEGER_32
frozen
effective function
{ANY}
Equivalent of lower3.
line_maximum: INTEGER_32
frozen
effective function
{ANY}
Equivalent of upper1.
column_maximum: INTEGER_32
frozen
effective function
{ANY}
Equivalent of upper2.
depth_maximum: INTEGER_32
frozen
effective function
{ANY}
Equivalent of upper3.
valid_line (line: INTEGER_32): BOOLEAN
frozen
effective function
{ANY}
ensure
valid_index1 (line: INTEGER_32): BOOLEAN
effective function
{ANY}
ensure
valid_column (column: INTEGER_32): BOOLEAN
frozen
effective function
{ANY}
ensure
valid_index2 (column: INTEGER_32): BOOLEAN
effective function
{ANY}
ensure
valid_depth (depth: INTEGER_32): BOOLEAN
frozen
effective function
{ANY}
ensure
valid_index3 (depth: INTEGER_32): BOOLEAN
effective function
{ANY}
ensure
valid_index (line: INTEGER_32, column: INTEGER_32, depth: INTEGER_32): BOOLEAN
frozen
effective function
{ANY}
ensure
line_count: INTEGER_32
frozen
effective function
{ANY}
Equivalent of count1.
column_count: INTEGER_32
frozen
effective function
{ANY}
depth_count: INTEGER_32
frozen
effective function
{ANY}
clear_all
frozen
effective procedure
{ANY}
Set all items to default values.
ensure
fast_is_equal (other: FAST_ARRAY3 [E_]): BOOLEAN
effective function
{ANY}
Do both collections have the same lower1, lower2, lower3, upper1, upper2 and upper3, and items?
The basic = is used for comparison of items. See also is_equal.
is_equal (other: FAST_ARRAY3 [E_]): BOOLEAN
effective function
{ANY}
Do both collections have the same lower1, lower2, lower3, upper1, upper2 and upper3, and items?
Feature is_equal is used for comparison of items. See also fast_is_equal.
require
  • other /= Void
ensure
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
is_equal_map (other: FAST_ARRAY3 [E_]): BOOLEAN
effective function
{ANY}
Do both collections have the same lower, upper, and items?
This feature is obsolete: Use `is_equal' instead.
fill_tagged_out_memory
frozen
effective procedure
{ANY}
Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.
require
  • locked: tagged_out_locked
ensure
  • still_locked: tagged_out_locked
set_area (element: E_, line_min: INTEGER_32, line_max: INTEGER_32, column_min: INTEGER_32, column_max: INTEGER_32, depth_min: INTEGER_32, depth_max: INTEGER_32)
effective procedure
{ANY}
Set all the elements of the selected area rectangle with element.
require ensure
test (e1: E_, e2: E_): BOOLEAN
effective function
{ANY}
In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
safe_equal (e1: E_, e2: E_): BOOLEAN
effective function
{ANY}
In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
mark_item (native_array: NATIVE_ARRAY[E_], index: INTEGER_32)
{}
To be used _only_ inside the definition of mark_native_arrays.
Forces the garbage collector to continue the marking process on the index-th element of the native_array. The element at index can be Void or not Void (the Void-ness test performed inside the mark_item itself).