Lisaac prototype interface

Section Header
+ name := FAST_ARRAY2[E];
- comment :="Resizable two dimensional array. \ \Unlike ARRAY2, the `lower1' bound and the `lower2' \ \bound are frozen to 0. Thus, one can expect better \ \performances.";
Section Inherit
+ parent_collection2:Expanded COLLECTION2[E];
Section Public
+ upper1:INTEGER;
+ count1:INTEGER;
+ upper2:INTEGER;
+ count2:INTEGER;
+ count:INTEGER;
Section FAST_ARRAY2
+ storage:NATIVE_ARRAY[E];
+ capacity :INTEGER;
of `storage'.
Section Public
- lower1:INTEGER :=
- lower2:INTEGER :=
- create (new_count1,new_count2:INTEGER) :SELF<-
Create with new dimensions.
All elements are set to the default value of type E.
- make (new_count1,new_count2:INTEGER) <-
Create or reset self with new dimensions.
All elements are set to the default value of type E.
- from_collection2 model:COLLECTION2[E] <-
Uses the `model' to update self.
- from_collection contents:COLLECTION[E] size (new_count1, new_count2:INTEGER) <-
Reset all bounds using `new_count#i'.
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 number of items.
- sub_collection2 (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) :SELF <-
Implementation of others feature from COLLECTION2:
- item (line, column:INTEGER) :E <-
- put element:E to (line, column:INTEGER) <-
- force element:E to (line , column :INTEGER) <-
- copy other:SELF <-
Writing.
- set_all_with v:E <-
All element are set with the value v.
- all_default:BOOLEAN <-
- slice (l1,up1:INTEGER) to (l2,up2: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) with element:E <-
Set all the elements in the range [(l1,up1),(l2,up2)] of
self with the element 'element'.
- swap (line1, column1:INTEGER) with (line2, column2:INTEGER) <-
Looking and comparison:
- occurrences elt:E :INTEGER <-
- fast_occurrences elt:E :INTEGER <-
Resizing:
- resize (new_count1,new_count2: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 <-
- transpose <-
Transpose the self array
- to_external:POINTER <-
Gives C access to the internal `storage' (may be dangerous).
Invariant.
[ ...
-? { count1 = upper1 + 1 };
-? { count2 = upper2 + 1 };
-? { count = count1 * count2};
-? { capacity >= count };
];