arr.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
---------------------------> Sather 1.1 source file <--------------------------
-- arr.sa: Simple algorithms for array structures
-- Author: Benedict A. Gomes <gomes@tiramisu.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: arr.sa,v 1.4 1996/07/16 04:38:11 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.
-- $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;