arr.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
-------------------------> GNU Sather - sourcefile <-------------------------
-- Copyright (C) 1995 by International Computer Science Institute --
-- 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> <--------------
-- arr.sa: Simple algorithms for array structures
-- Author: Benedict A. Gomes <gomes@tiramisu.ICSI.Berkeley.EDU>
-- $ARR{ETP} : Array abstraction
abstract class $RO_ARR{ETP} < $CONTAINER{ETP}
abstract class $RO_ARR{ETP} < $CONTAINER{ETP} is
-- A read-only array which is the interface to other algorithm classes
ind!: INT;
-- post 0<=result<size
-- Returns all the indices, which are the integers between 0 and size - 1
aget(i: INT): ETP;
-- pre has_ind(i)
has_ind(i: INT): BOOL;
-- return 0<=i<size
-- This method could actually be implemented at this level
end;
abstract class $ARR{ETP} < $RO_ARR{ETP}
abstract class $ARR{ETP} < $RO_ARR{ETP} is
-- The indices are integers and lie in [0, size-1]
-- Similar to a MAP from ints to elements, but more restrictive conditions
-- The features are repeated here so as to restate the preconditions
-- Inherits: copy, size, capacity, elt! and has
-- size: INT;
-- elt!: ETP;
-- has(e: ETP): BOOL;
ind!: INT;
-- post 0<=result<size
-- Returns all the indices, which are the integers between 0 and size - 1
aget(i: INT): ETP;
-- pre has_ind(i)
aset(ind: INT,e: ETP);
-- pre has_ind(i)
copy: SAME;
-- Redefined to narrow the return type
has_ind(i: INT): BOOL;
-- return 0<=i<size
-- This method could actually be implemented at this level
end;