------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand        --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------

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

--        This abstract class provides an extensible array abstraction. Similar
--   to a list abstraction, this has keys which are cardinal numbers.   After
--   an insertion some keys may have changed.

--        This class inherits --
--        size : CARD 
--        aget(index : CARD) : ETP 
--        aset(index : CARD, elem : ETP) 
--        has_ind(index : CARD) : BOOL 
--        elt! : ETP
--        ind! : CARD 
--        set_view : $RO_SET{ETP}

--         Version 1.2 Nov 98.   Copyright K Hopper, U of Waikato

--                          Development History
--                          -------------------

--        Date           Who By         Detail
--        ----           ------         ------

--        5 Sep 96        bv       Original
--        3 Apr 97        kh       Changed for CARD instead of INT
--        6 Nov 98        kh       Revised for 1.2, added pre/post conditions

copy : SAME ;

--        This is redefined to narrow the return type


equals(
       other : $RO_ARR{ETP}
       ) : BOOL ;

--        This routine returns true if and only if all elements of self are
--   equal to all elements of other when taken in the same order.
   

insert_after(
            index : CARD,
            val : ETP
            ) ;

--        This inserts val immediately after the given index position.   The
--   indices of all subwequent elements will have increased by one.


insert_after(
            index : CARD,
            val : ETP
            ) : $LIST{ETP} ;

--        This inserts val immediately after the given index position in a copy
--   of self.   The indices of all subsequent elements will have increased by
--   one.  The resulting list is returned.


insert_before(
             index : CARD,
             val : ETP
             ) ;

--        This inserts the value val in the position immediately before the
--   given index.   The indices of all subsequent elements will be increased
--   by one.


insert_before(
             index : CARD,
             val : ETP
             ) : $LIST{ETP} ;

--        This inserts the value val in the position immediately before the
--   given index in a copy of self.   The indices of all subsequent elements
--   will be increased by one.   The resultant list is returned.


insert_all_before(
                 index : CARD,
                 val : $CONTAINER{ETP}
                 ) ;

--        This inserts all of the items in val in order at the position before
--   the given index.   All subsequent elements will have their index increased
--   by the number of elements in val.
   

insert_all_before(
                 index : CARD,
                 val : $CONTAINER{ETP}
                 ) : $LIST{ETP} ;

--        This inserts all of the items in val in order at the position before
--   the given index in a copy of self.   All subsequent elements will have
--   their index increased by the number of elements in val.  The resultant
--   list is returned.
   

insert_all_after(
                 index : CARD,
                 val : $CONTAINER{ETP}
                 ) ;

--        This inserts all of the items in val in order at the position after
--   the given index.   All subsequent elements will have their index increased
--   by the number of elements in val.

   
insert_all_after(
                 index : CARD,
                 val : $CONTAINER{ETP}
                 ) : $LIST{ETP} ;

--        This inserts all of the items in val in order at the position after
--   the given index in a copy of self.   All subsequent elements will have
--   their index increased by the number of elements in val.  The resultant
--   list is returned.

   
append(
      elem : ETP
      ) ;

--        This concatenates elem at the end of the existing list.


append(
      elem : ETP
      ) : $LIST{ETP} ;

--        This concatenates elem at the end of a copy of the existing list
--   before returning the result..


append_all(
           list : $CONTAINER{ETP}
           ) ;

--        This concatenates the given list after self.


append_all(
           list : $CONTAINER{ETP}
           ) : $LIST{ETP} ;

--        This concatenates the given list after copying self and before
--   returning the resultant list.

end ; -- $LIST{ETP}

