map.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
------------------------->  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 $RO_MAP{KEY,ETP} < $RO_MULTIMAP{KEY,ETP}, $STR

abstract class $RO_MAP{KEY,ETP} < $RO_MULTIMAP{KEY,ETP}, $STR is -- This class provides a read only one-to-one map abstraction (ie no -- alterations permitted). The abstraction is from a domain of keys (class -- KEY) to a range of elements (class ETP). Each key maps to only one -- element. Arrays are a special kind of map where the keys are integers. -- Version 1.2 Nov 98. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 18 Jul 94 hk Original -- 9 Apr 96 bg Revision for Sather 1.1 -- 4 Apr 97 kh Changed for style consistency -- 9 Nov 98 kh Revised for 1.2 aget( key : KEY ) : ETP ; -- This routine returns the element mapped to by the given key (if -- found). If not present then either void or nil is returned (if there is -- a nil value in existence). add( elem : TUP{KEY,ETP} ) : $VMULTIMAP{KEY,ETP} ; -- This routine returns a new multimap containaing, in addition to all -- of the elements of self, the new element given. contains( elem : TUP{KEY,ETP} ) : BOOL ; -- This routine returns true if and only if self contains the given -- tuple, otherwise false. add( key : KEY, elem : ETP ) : $RO_MULTIMAP{KEY,ETP} ; -- This routine is identical to the above with the two separate -- arguments rather than the tuple! insert( key : KEY, elem : ETP ) : $RO_MAP{KEY,ETP} ; -- This routine is a renaming of the above. insert( elem : TUP{KEY,ETP} ) : $RO_MAP{KEY,ETP} ; -- This routine inserts the given element in the bag, replacing any -- tuple with the same key, irrespective of the target value. delete( elem : TUP{KEY,ETP} ) : $RO_MAP{KEY,ETP} ; -- This routine returns a new map identical to self except for one -- element which is element equal to elem (if such an one exists). delete( key : KEY, elem : ETP ) : $RO_MAP{KEY,ETP} ; -- This routine is identical to the above with the two separate -- arguments rather than the tuple! delete_ind( key : KEY ) : $RO_MAP{KEY,ETP} ; -- This routine returns a new map from which any occurrences of the key -- (and its target) have been deleted. delete_all( elem : TUP{KEY,ETP} ) : $RO_MAP{KEY,ETP} ; -- This routine returns a new map identical to self except for all -- elements which are equal to self (if any). concat( arg : $RO_BAG{TUP{KEY,ETP}} ) : $RO_MULTIMAP{KEY,ETP} ; -- This routine returns a new multimap consisting of the elements of -- self together with those of arg. For elements which occur multiple times -- then the result contains the sum of the number in self and the number in -- arg. union( arg : $RO_BAG{TUP{KEY,ETP}} ) : $RO_MULTIMAP{KEY,ETP} ; -- This returns a multimap containing all of the elements of self and -- arg. For those elements which occur multiple times the number in the map -- returned is the larger of the numbers in self and arg. union( arg : $RO_MAP{KEY,ETP} ) : $RO_MAP{KEY,ETP} ; -- This routine returns a new map containing the elements of self and -- arg. This overloads the method in $RO_MULTIMAP with a more specific -- argument. intersection( arg : $RO_BAG{TUP{KEY,ETP}} ) : $RO_MULTIMAP{KEY,ETP} ; -- This routine returns a new multimap containing the elements common -- to self and arg. For elements which occur multiple times the result -- contains the lower number of occurrences in self an arg. intersection( arg : $RO_MAP{KEY,ETP} ) : $RO_MAP{KEY,ETP} ; -- This routine returns a new map which contains the elements of self -- and arg. It overloads the method in $RO_MULTIMAP with a more specific -- argument. diff( arg : $RO_MAP{KEY,ETP} ) : $RO_MAP{KEY,ETP} ; -- This routine returns a map containing the elements common to self -- and arg. sym_diff( arg : $RO_MAP{KEY,ETP} ) : $RO_MAP{KEY,ETP} ; -- This routine returns a new map containing only those elements which -- are NOT common to self and arg. end ; -- RO_MAP{KEY,ETP}

abstract class $VMAP{KEY,ETP} < $RO_MAP{KEY,ETP}, $VMULTIMAP{KEY,ETP}

abstract class $VMAP{KEY,ETP} < $RO_MAP{KEY,ETP}, $VMULTIMAP{KEY,ETP} is -- This class models an unordered container of tuples of key to target -- such that the indices of all tuples are unique. Indices may be used to -- retrieve targets. -- -- IMPORTANT This is a value abstraction and is stricter than the read-only -- abstraction. Subtypes must not support *any* operations that -- modify self. The language cannot enforce this restriction. -- Version 1.2 Nov 98. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 18 Jul 94 hk Original -- 9 Apr 96 bg Revision for Sather 1.1 -- 4 Apr 97 kh Changed for style consistency -- 9 Nov 98 kh Revised for 1.2 add( elem : TUP{KEY,ETP} ) : $VMULTIMAP{KEY,ETP} ; -- This routine returns a new multimap containaing, in addition to all -- of the elements of self, the new element given. add( key : KEY, elem : ETP ) : $VMULTIMAP{KEY,ETP} ; -- This routine is identical to the above with the two separate -- arguments rather than the tuple! insert( key : KEY, elem : ETP ) : $VMAP{KEY,ETP} ; -- This routine is a renaming of the above. insert( elem : TUP{KEY,ETP} ) : $VMAP{KEY,ETP} ; -- This routine inserts the given element in the bag, replacing any -- tuple with the same key, irrespective of the target value. delete( elem : TUP{KEY,ETP} ) : $VMAP{KEY,ETP} ; -- This routine returns a new map identical to self except for one -- element which is element equal to elem (if such an one exists). delete( key : KEY, elem : ETP ) : $VMAP{KEY,ETP} ; -- This routine is identical to the above with the two separate -- arguments rather than the tuple! delete_ind( key : KEY ) : $VMAP{KEY,ETP} ; -- This routine returns a new map from which any occurrences of the key -- (and its target) have been deleted. delete_all( elem : TUP{KEY,ETP} ) : $VMAP{KEY,ETP} ; -- This routine returns a new map identical to self except for all -- elements which are equal to self (if any). concat( arg : $ELT{TUP{KEY,ETP}} ) : $VMULTIMAP{KEY,ETP} ; -- This routine returns a new multimap consisting of the elements of -- self together with those of arg. For elements which occur multiple times -- then the result contains the sum of the number in self and the number in -- arg. union( arg : $RO_BAG{TUP{KEY,ETP}} ) : $VMULTIMAP{KEY,ETP} ; -- This returns a multimap containing all of the elements of self and -- arg. For those elements which occur multiple times the number in the map -- returned is the larger of the numbers in self and arg. union( arg : $RO_MAP{KEY,ETP} ) : $VMAP{KEY,ETP} ; -- This routine returns a new map containing the elements of self and -- arg. This overloads the method in $RO_MULTIMAP with a more specific -- argument. intersection( arg : $RO_BAG{TUP{KEY,ETP}} ) : $VMULTIMAP{KEY,ETP} ; -- This routine returns a new multimap containing the elements common -- to self and arg. For elements which occur multiple times the result -- contains the lower number of occurrences in self an arg. intersection( arg : $RO_MAP{KEY,ETP} ) : $VMAP{KEY,ETP} ; -- This routine returns a new map which contains the elements of self -- and arg. It overloads the method in $RO_MULTIMAP with a more specific -- argument. diff( arg : $RO_MAP{KEY,ETP} ) : $VMAP{KEY,ETP} ; -- This routine returns a map containing the elements common to self -- and arg. sym_diff( arg : $RO_MAP{KEY,ETP} ) : $VMAP{KEY,ETP} ; -- This routine returns a new map containing only those elements which -- are NOT common to self and arg. end ; -- $VMAP

abstract class $MAP{KEY,ETP} < $RO_MAP{KEY,ETP}

abstract class $MAP{KEY,ETP} < $RO_MAP{KEY,ETP} is -- This abstraction defines a modifiable map in which elements are -- stored using the aset notation and rpeeated assignments to a particular -- key will replace the associated data value. -- Version 1.1 Apr 97. Copyright K Hopper, U of Waikato -- Development History -- ------------------- -- Date Who By Detail -- ---- ------ ------ -- 18 Jul 94 hk Original -- 9 Apr 96 bg Revision for Sather 1.1 -- 4 Apr 97 kh Changed for style consistency as_value : $VMAP{KEY,ETP} ; -- This routine returns the value of the map associated with self. aset( key : KEY, elem : ETP ) ; -- This routine maps the given key to elem. If the key is already -- mapped then elem replaces the originally mapped value. delete( key :KEY ) ; -- This routine deletes the tuple associated with the key given if such -- a tuple exists. to_union( arg : $RO_MAP{KEY,ETP} ) ; -- This routine turne self into the union of self and arg. to_intersection( arg : $RO_MAP{KEY,ETP} ) ; -- This routine turns self into the intersection of self and arg. to_diff( arg : $RO_MAP{KEY,ETP} ) ; -- This routine turns self into the map which is the difference between -- self and arg. to_sym_diff( arg : $RO_BAG{TUP{KEY,ETP}} ) ; -- This routine turns self into the map which is the symmetric -- difference of self and arg. add( elem : TUP{KEY,ETP} ) : $VMULTIMAP{KEY,ETP} ; -- This routine returns a new multimap containaing, in addition to all -- of the elements of self, the new element given. add( key : KEY, elem : ETP ) : $VMULTIMAP{KEY,ETP} ; -- This routine is identical to the above with the two separate -- arguments rather than the tuple! insert( key : KEY, elem : ETP ) : $MAP{KEY,ETP} ; -- This routine is a renaming of the above. insert( elem : TUP{KEY,ETP} ) : $MAP{KEY,ETP} ; -- This routine inserts the given element in the bag, replacing any -- tuple with the same key, irrespective of the target value. delete( elem : TUP{KEY,ETP} ) : $MAP{KEY,ETP} ; -- This routine returns a new map identical to self except for one -- element which is element equal to elem (if such an one exists). delete( key : KEY, elem : ETP ) : $MAP{KEY,ETP} ; -- This routine is identical to the above with the two separate -- arguments rather than the tuple! delete_ind( key : KEY ) : $MAP{KEY,ETP} ; -- This routine returns a new map from which any occurrences of the key -- (and its target) have been deleted. delete_all( elem : TUP{KEY,ETP} ) : $MAP{KEY,ETP} ; -- This routine returns a new map identical to self except for all -- elements which are equal to self (if any). concat( arg : $RO_BAG{TUP{KEY,ETP}} ) : $VMULTIMAP{KEY,ETP} ; -- This routine returns a new multimap consisting of the elements of -- self together with those of arg. For elements which occur multiple times -- then the result contains the sum of the number in self and the number in -- arg. union( arg : $RO_BAG{TUP{KEY,ETP}} ) : $VMULTIMAP{KEY,ETP} ; -- This returns a multimap containing all of the elements of self and -- arg. For those elements which occur multiple times the number in the map -- returned is the larger of the numbers in self and arg. union( arg : $RO_MAP{KEY,ETP} ) : $MAP{KEY,ETP} ; -- This routine returns a new map containing the elements of self and -- arg. This overloads the method in $RO_MULTIMAP with a more specific -- argument. intersection( arg : $RO_BAG{TUP{KEY,ETP}} ) : $VMULTIMAP{KEY,ETP} ; -- This routine returns a new multimap containing the elements common -- to self and arg. For elements which occur multiple times the result -- contains the lower number of occurrences in self an arg. intersection( arg : $RO_MAP{KEY,ETP} ) : $MAP{KEY,ETP} ; -- This routine returns a new map which contains the elements of self -- and arg. It overloads the method in $RO_MULTIMAP with a more specific -- argument. diff( arg : $RO_MAP{KEY,ETP} ) : $MAP{KEY,ETP} ; -- This routine returns a map containing the elements common to self -- and arg. sym_diff( arg : $RO_MAP{KEY,ETP} ) : $MAP{KEY,ETP} ; -- This routine returns a new map containing only those elements which -- are NOT common to self and arg. end ; -- $MAP{KEY,ETP}