list.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- list.sa: Extensible array
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: list.sa,v 1.6 1996/07/16 04:38:15 holger Exp $
--
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: Sather/Doc/License of the
-- Sather distribution. The license is also available from ICSI,
-- 1947 Center St., Suite 600, Berkeley CA 94704, USA.


abstract class $LIST{ETP} < $ARR{ETP}, $STR

abstract class $LIST{ETP} < $ARR{ETP}, $STR is -- An extensible array abstraction. Similar to a list abstraction, -- but keys are integers after an insert all other keys may have -- changed -- Inherits: -- size: INT; -- aget(i: INT): ETP -- aset(ind: INT, e: ETP) -- has_ind(i: INT): BOOL; -- elt!: ETP; -- ind!: INT -- set_view: $RO_SET{ETP}; -- ------ Initialization/Duplication ------ copy: SAME; -- Redefined to narrow the return type -- ------ Insertion/Removal --------------- insert_after(ind: INT, val: ETP); -- pre valid_ind(ind) post valid_ind(result); -- Insert the value "val" after the index "ind" in the list -- The indices of all subseqeuent elements will be shifted up by 1 insert_before(ind: INT,val: ETP); -- Insert the value "val" before the index "ind" in the list -- The indices of all subsequent elements will be shifted upward insert_all_before(ind: INT, val: $CONTAINER{ETP}); -- Insert the elements of "val" in order, before "ind". The indices -- of it and all subsequent elements will be shifted upward insert_all_after(ind: INT, val: $CONTAINER{ETP}); -- Insert the elements of the list in order after the element at -- index "ind". The indices of all subsequent elements will be -- shifted upward append(e: ETP); -- Concatenate "e" onto the end of the array append_all(l: $CONTAINER{ETP}); -- post has(l.elt!) -- Append the elements of "l" onto the end of the current array equals(a: $RO_ARR{ETP}): BOOL; end; -- class $LIST{ETP}