Section Header

    + name := ARRAY2[E];

    - comment :=" General prurpose, resizable, two dimensional array.";

Section Inherit

    + parent_collection2:Expanded COLLECTION2[E];

Section Public

    + lower1:INTEGER;

    + lower2:INTEGER;

    + upper1:INTEGER;

    + upper2:INTEGER;

Section ARRAY2

    + storage:NATIVE_ARRAY[E];
        To store elements line by line.

    + capacity:INTEGER;
        Number of elements in `storage'.

Section Public

Creation / modification:


    - create (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) :SELF <-
        Reset all bounds `line_minimum' / `line_maximum' / `column_minimum' and
        `column_maximum' using arguments as new values.
        All elements are set to the default value of type E.

    - make (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) <-
        Reset all bounds `line_minimum' / `line_maximum' / `column_minimum' and
        `column_maximum' using arguments as new values.
        All elements are set to the default value of type E.

    - from_collection2 model:COLLECTION2[E] <-

    - from_collection contents:COLLECTION[E] size (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) <-
        Reset all bounds using `line_min', `line_max', `column_min',
        and `column_max' .
        Copy all elements of `contents', line by line into Current.

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

Resizing:


    - resize (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) <-
        Resize bounds of the Current array

Implementation of others feature from COLLECTION2:


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

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

    - count1:INTEGER <-

    - count2:INTEGER <-

    - count:INTEGER <-

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

    - set_all_with element:E <-

    - replace_all old_value:E with new_value:E <-

    - fast_replace_all old_value:E with new_value:E <-

    - sub_collection2 (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) :SELF <-

Looking and comparison:


    - occurrences elt:E :INTEGER <-

    - fast_occurrences elt:E :INTEGER <-

    - has x:E :BOOLEAN <-
        Search if a element x is in the array using `equal'.
        See also `fast_has' to chose the apropriate one.

    - fast_has x:E :BOOLEAN <-
        Search if a element x is in the array using `='.

    - all_default:BOOLEAN <-

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

    - copy other:SELF <-

    - '==' Right 60 other:SELF :BOOLEAN <-

Other features:


    - transpose <-
        Transpose the Current array

    - to_external:POINTER <-
        Gives C access to the internal `storage' (may be dangerous).

Invariant.

[ ...
-? { count2 = upper2 - lower2 + 1 };
-? { capacity >= count }
];