Section Header
  
  
    + name        := COLLECTION2[E];
  
  
    - comment     := "Abstract definition of a 2 dimensional collection of elements of type E.";
  
  
 The Lisaac standard library provides two implementations of COLLECTION2: 
  
 ARRAY2 and FAST_ARRAY2.
  
 All implementations have exactly the same behavior. Switching from one implementation to
  
 another only change the memory used and the execution time.
      
Section Inherit
  
  
    - parent_safe_equal:SAFE_EQUAL[E] := 
  
Section Public
  
  
  
 Indexing:
  
  
  
    - lower1:INTEGER <-
  
         First Lower index bounds.
      
  
    - lower2 :INTEGER <-
  
         Second Lower index bounds.
    
  
    - line_minimum:INTEGER <- 
  
         Equivalent of `lower1'.
  
    - column_minimum:INTEGER <- 
  
         Equivalent of `lower2'.
  
  
    - upper1:INTEGER <-
  
         First Upper index bounds.
      
  
    - upper2 :INTEGER <-
  
         Second Upper index bounds.
    
  
    - line_maximum:INTEGER <- 
  
         Equivalent of `upper1'.
  
    - column_maximum:INTEGER <- 
  
         Equivalent of `upper2'.
  
  
  
 Reading:
  
  
  
    - item (line, column:INTEGER) :E <-
    
  
  
 Writing:
  
  
  
    - put element:E to (line, column:INTEGER) <-
  
    
  
    - force element:E to (line, column:INTEGER) <-
  
         Put `element' at position (`line',`column'). Collection is
  
         resized first when (`line',`column') is not inside current
  
         bounds. New bounds are initialized with default values.
    
  
  
 Index validity:
  
  
  
    - valid_line line:INTEGER :BOOLEAN <- 
      
  
    - valid_index1 line:INTEGER :BOOLEAN <-
      
  
    - valid_column column:INTEGER :BOOLEAN <- 
      
  
    - valid_index2 column:INTEGER :BOOLEAN <-
      
  
    - valid_index (line, column:INTEGER) :BOOLEAN <-
    
  
  
 Counting:
  
  
  
    - count1:INTEGER <-
  
         Size of the first dimension.
    
  
    - line_count:INTEGER <- 
  
         Equivalent of `count1'.
    
  
    - count2 :INTEGER <-
  
         Size of the second dimension.
      
  
    - column_count :INTEGER <- 
  
         Equivalent of `count2'.
  
  
    - count:INTEGER <-
  
         Total number of elements.
      
  
    - swap (line1, column1:INTEGER) with (line2, column2:INTEGER) <-
  
         Swap the element at index (`line1',`column1') with the
  
         the element at index (`line2',`column2').
      
  
    - set_all_with v:E <-
  
         Set all item with value `v'.
      
  
    - clear_all <-
  
         Set all items to default values.
    
  
  
 Creating or initializing:
  
  
  
    - from_collection2 model:COLLECTION2[E] <-
  
          Uses `model' to initialize Current.
      
  
    - from_model model:COLLECTION[COLLECTION[E]] <-
  
         The `model' is used to fill line by line Current.
  
         Assume all sub-collections of `model' have the same
  
         number of lines.
    
  
  
 Looking and comparison:
  
  
  
    - all_default:BOOLEAN <-
  
         Do all items have their type's default value?
    
  
    - '==' other:COLLECTION2[E] :BOOLEAN <-
  
         Do both collections have the same `lower1', `lower2', `upper1' and `upper2', and items?
  
         The basic `=' is used for comparison of items.
  
        
  
         See also `is_equal_map'.
  
  
    - is_equal_map (other:COLLECTION2[E]) :BOOLEAN <-
  
         Do both collections have the same `lower1', `lower2', `upper1' and `upper2', and items?
  
         Feature `is_equal' is used for comparison of items.
  
        
  
         See also `is_equal'.
    
  
  
 Printing:
  
  
  
    - fill_tagged_out_memory <-
    
  
  
 Miscellaneous features:
  
  
  
    - occurrences elt:E :INTEGER <-
  
         Number of occurrences using `equal'.
  
        
  
         See also `fast_occurrences' to chose the apropriate one.
  
    
  
    - fast_occurrences elt:E :INTEGER <-
  
         Number of occurrences using `='.
  
        
  
         See also `occurrences' to chose the apropriate one.
  
     
  
    - 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 `='.
      
  
    - replace_all old_value:E with new_value:E <-
  
         Replace all occurences of the element `old_value' by `new_value'
  
         using `equal' for comparison.
  
        
  
         See also `fast_replace_all' to choose the apropriate one.
      
  
    - fast_replace_all old_value:E with new_value:E <-
  
         Replace all occurences of the element `old_value' by `new_value'
  
         using operator `=' for comparison.
  
        
  
         See also `replace_all' to choose the apropriate one.
      
  
    - sub_collection2 (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) :SELF <-
  
         Create a new object using selected area of `Current'.
      
  
    - set_area (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) with element:E <-
  
         Set all the elements of the selected area rectangle with `element'.