Section Header

    + name := FAST_ARRAY3[E];

    - comment :="Resizable three dimensional array.\ \Unlike ARRAY3, the `lower1', `lower2' and `lower3' bounds \ \are frozen to 0. Thus, one can expect better performances. .";

Section Inherit

    + parent_collection3:Expanded COLLECTION3[E];

Section Public

    + upper1:INTEGER;

    + count1:INTEGER;

    + upper2:INTEGER;

    + count2:INTEGER;

    + upper3:INTEGER;

    + count3:INTEGER;

    + count:INTEGER;

Section FAST_ARRAY3

    + storage:NATIVE_ARRAY[E];

    + capacity:INTEGER;
        of `storage'.

Section Public

    - lower1:INTEGER :=

    - lower2:INTEGER :=

    - lower3:INTEGER :=

    - create (new_count1, new_count2, new_count3:INTEGER) :SELF<-
        Create or reset `Current' with new dimensions.
        All elements are set to the default value of type E.

    - make (new_count1, new_count2, new_count3 :INTEGER) <-
        Create or reset `self' with new dimensions.
        All elements are set to the default value of type E.

    - from_collection3 model:COLLECTION3[E] <-
        Uses the `model' to update self.

    - from_collection contents:COLLECTION[E] size (new_count1, new_count2, new_count3:INTEGER) <-
        Reset all bounds using `new_count#i'.
        Copy all elements of `contents', line by line into self.

    - from_model model:COLLECTION[COLLECTION[COLLECTION[E]]] <-
        The `model' is used to fill line by line the COLLECTION3.
        Assume all sub-collections of have the same indexing.

Implementation of others feature from COLLECTION3:


    - item (line, column, depth:INTEGER) :E <-

    - put element:E to (line, column, depth:INTEGER) <-

    - force element:E to (line, column, depth :INTEGER) <-

    - copy other:SELF <-

    - sub_collection3 (line_min,column_min,depth_min:INTEGER) to (line_max,column_max,depth_max:INTEGER) :SELF <-

Writing:


    - set_all_with x:E <-
        All element are set with the value x.

    - all_default:BOOLEAN <-

    - slice (l1,up1:INTEGER) to (l2,up2:INTEGER) to (l3,up3:INTEGER) :SELF <-
        Create a new collection initialized with elements of
        range `low'..`up'. result has the same dynamic type
        as self collection.

    - set_slice (l1,up1:INTEGER) to (l2,up2:INTEGER) to (l3,up3:INTEGER) with element:E <-
        Set all the elements in the
        range [(l1,up1),(l2,up2),(l3,up3)] of
        self with the element 'element'.

    - swap (line1, column1, depth1:INTEGER) with (line2, column2, depth2:INTEGER) <-

Looking and comparison:


    - occurrences elt:E :INTEGER <-

    - fast_occurrences elt:E :INTEGER <-

Resizing:


    - resize (new_count1,new_count2,new_count3:INTEGER) <-

Looking and Searching:


    - has x:E :BOOLEAN <-
        Look for `x' using `equal' for comparison.

    - fast_has x:E :BOOLEAN <-
        Same as `has' but use `=' for comparison

Other features:


    - replace_all old_value:E with new_value:E <-

    - fast_replace_all old_value:E with new_value:E <-

Invariant.

[ ...
-? {count1 = upper1 + 1};
-? {count2 = upper2 + 1};
-? {count3 = upper3 + 1};
-? {count = count1 * count2 * count3};
-? {count2x3 = count2 * count3};
-? {capacity >= count};
];