multimap.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- Copyright (C) International Computer Science Institute, 1994.COPYRIGHT    --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
-- the file "Doc/License" of the Sather distribution.  The license is also   --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
--------> Please email comments to sather-bugs@icsi.berkeley.edu. <----------
-- Author: Holger Klawitter <holger@icsi.berkeley.du>
-- (gomes) Renamed classes, routines, reorganized code inclusion
--                 added a lot of  functionality 


abstract class $RO_MULTIMAP{K,E} < $CONTAINER{E}

abstract class $RO_MULTIMAP{K,E} < $CONTAINER{E} is -- A mapping form K -> bags of E. A multimap binds elements of type -- `E' to keys of type `K'. In contrast to $MAP{K,E} there can be -- more than one element be bound to a key. It is essentially a -- one-to-many mapping, that allows for repetitions. i.e. -- it is a map from K->$BAG{E} has_ind(k: K): BOOL; -- Returns true if the map has the element "k" has_elt(e: E): BOOL; -- Return true if the map has the element "e" n_inds: INT; -- Returns the number of keys which are bound. ind!: K; -- Yields all keys which are bound in unspecifierd order. target!(once k:K): E; -- Yields all elements wich are bound to 'k' in unspecified -- order. targets(k: K): $BAG{E}; -- Returns all the targets of the element "k" n_targets(k:K): INT; -- Returns the number of elements bound to the index `k'. pair!: TUP{K,E}; -- Yields all bindings in unpecified order. size: INT; -- Returns the number of bindings in the dicitonary. equals(m: $RO_MULTIMAP{K,E}): BOOL; -- Return true if all the key-value pairs are found in the same -- numbers in "m" end;

abstract class $MULTIMAP{K,E} < $RO_MULTIMAP{K,E}

abstract class $MULTIMAP{K,E} < $RO_MULTIMAP{K,E} is -- A multimap that can be modified aset(k:K,e:E); -- Binds the element 'e' to the key 'k'. There may me more -- than one element bound to one key. delete(k:K,e:E); -- Removes the binding between element 'e' and the key 'k'. -- Does nothing if there is no such binding. delete(k:K); -- Removes all bindings to `k'. Does nothing, if there -- is no such binding. end; -- $MULTIMAP{K,E}