home *** CD-ROM | disk | FTP | other *** search
- -----------------------------------------------------------------------------
- --
- -- Copyright (c) 1995 by Westmount Technology B.V., Delft, The Netherlands.
- --
- -- This software is furnished under a license and may be used only in
- -- accordance with the terms of such license and with the inclusion of
- -- the above copyright notice. This software or any other copies thereof
- -- may not be provided or otherwise made available to any other person.
- -- No title to and ownership of the software is hereby transferred.
- --
- -- The information in this software is subject to change without notice
- -- and should not be construed as a commitment by Westmount Technology B.V.
- --
- -----------------------------------------------------------------------------
- --
- -- File : @(#)RSetDict.4gl 1.1
- -- Author :
- -- Original date : 3-2-1995
- -- Description : A simple RSetDict (map of key-value pairs)
- -- Key and value are ixObject references
- --
- -----------------------------------------------------------------------------
-
- INCLUDE "RSetDict.4gh"
-
-
- FUNCTION RSetDict::RSetDict()
- LET dict = NEW RefDict()
- END FUNCTION
-
- FUNCTION RSetDict::add(key ixObject, value ixObject) RETURNING BOOLEAN
- VARIABLE theRefSet RefSet = dict.get(key) CAST RefSet
- IF theRefSet IS NULL THEN
- LET theRefSet = NEW RefSet()
- CALL dict.set(key, theRefSet)
- END IF
- RETURN theRefSet.add(value)
- END FUNCTION
-
- FUNCTION RSetDict::get(key ixObject) RETURNING RefSet
- RETURN dict.get(key) CAST RefSet
- END FUNCTION
-
- FUNCTION RSetDict::remove(key ixObject, value ixObject) RETURNING VOID
- VARIABLE theRefSet RefSet = dict.get(key) CAST RefSet
- IF theRefSet IS NULL THEN
- RETURN
- END IF
- CALL theRefSet.remove(value)
- END FUNCTION
-
- FUNCTION RSetDict::isPresent(key ixObject) RETURNING BOOLEAN
- RETURN dict.isPresent(key)
- END FUNCTION
-
- FUNCTION RSetDict::size() RETURNING INTEGER
- RETURN dict.size()
- END FUNCTION
-
- FUNCTION RSetDict::firstKey() RETURNING ixObject
- RETURN dict.firstKey()
- END FUNCTION
-
- FUNCTION RSetDict::nextKey() RETURNING ixObject
- RETURN dict.nextKey()
- END FUNCTION
-
- FUNCTION RSetDict::firstValue() RETURNING RefSet
- RETURN dict.firstValue() CAST RefSet
- END FUNCTION
-
- FUNCTION RSetDict::nextValue() RETURNING RefSet
- RETURN dict.nextValue() CAST RefSet
- END FUNCTION
-