1 -- Created on: 1992-02-19
2 -- Created by: Jean Pierre TIRAULT
3 -- Copyright (c) 1992-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
21 -- Revised: Thu Jan 7 17:26:12 1993
22 -- By : Mireille MERCIEN
25 generic class HDataMap from PCollection (Key as Storable;
30 ---Purpose: A map is a Collection of bindings
31 -- between two objects. One is considered as
32 -- the key and a hash code value must be
36 raises MultiplyDefined from Standard,
37 NoMoreObject from Standard,
38 NoSuchObject from Standard
43 class MapNode inherits PManaged
44 ---Purpose: This class is used in the implementation of Map class.
47 Create( aKey : Key ; anItem : Item ; aNext : MapNode)
48 returns mutable MapNode from PCollection;
50 GetKey (me) returns any Key is static;
52 ---Purpose: Returns myKey
54 Value(me) returns any Item is static;
56 ---Purpose: Returns myItem.
58 Next(me) returns mutable MapNode is static;
60 ---Purpose: Returns myNext.
62 SetKey (me : mutable ; aKey : Key) is static;
64 ---Purpose: Modifies myKey.
66 SetValue( me : mutable; anItem: Item) is static;
68 ---Purpose: Modifies myItem.
70 SetNext( me : mutable; aNode: MapNode) is static;
72 ---Purpose: Modifies myNext.
74 ShallowCopy(me) returns mutable like me
77 ---Purpose: ShallowCopy redefinition
80 ShallowDump (me; s: in out OStream)
83 ---Purpose: ShallowDump redefinition
94 class Array instantiates HArray1 from PCollection(MapNode);
98 raises NoMoreObject from Standard,
99 NoSuchObject from Standard
101 ---Purpose: This class provides to iterate on a Map from the
102 -- first bucket entry to the last one in the table;
103 -- Going through the associated list for each bucket entry.
105 Create( aMap: HDataMap)
106 ---Purpose: Creates an iterator on <aMap> .
111 ---Purpose: Returns True if there is still an element to be read.
112 returns Boolean from Standard;
114 Next( me: in out) raises NoMoreObject from Standard;
116 ---Purpose: Goes to next element of <me>.
121 raises NoSuchObject from Standard;
126 raises NoSuchObject from Standard;
137 Create(NbBuckets : Integer ; F : FH) returns mutable HDataMap;
138 ---Purpose: Creation of a map of NbBuckets entries.
139 -- the table is empty.
140 -- If NbBuckets eq. 0 an exception will be raised.
142 NbBuckets(me) returns Integer from Standard;
144 ---Purpose: Returns the number of entries in the table.
146 IsEmpty(me) returns Boolean from Standard;
148 ---Purpose: Returns true if the table is empty.
150 Extent(me) returns Integer from Standard ;
152 ---Purpose: Returns the number of elements in the table.
153 ---Example: if me is the hash table ((a x)(b y)(c z)) Extent
156 IsBound(me; K : Key) returns Boolean;
158 ---Purpose: Returns True if an element is bounded to K
160 Find(me; K : Key) returns any Item raises NoSuchObject;
162 ---Purpose: Returns the element bounded to K.
163 -- Raises an exception if the binding does not exist.
165 -- me = ((a x)(b y)(c z)) , K = b
170 ---Purpose: Removes all the element in the table.
172 -- me = ((a x)(b y)(c z))
176 Bind(me:mutable; K : Key; T : Item)
177 raises MultiplyDefined;
179 ---Purpose: Creates a binding between a key K and an item T.
180 -- Raises an exception if the binding already exists.
182 -- me = ((a x)(b y)) , K = c , T = z
184 -- me = ((a x)(b y)(c z))
186 Rebind(me:mutable; K : Key; T : Item) raises NoSuchObject;
188 ---Purpose: Replaces the object binded to the key K by T.
189 -- Raises an exception if the binding does not exist.
191 -- me = ((a x)(b y)) , K = b , T = z
195 Unbind(me:mutable; K : Key) raises NoSuchObject;
197 ---Purpose: Removes the binding keyed by K.
198 -- Raises an exception if the binding does not exist.
200 -- me = ((a x)(b y)(c z)) , K = b
204 ShallowCopy(me) returns mutable like me
207 ---Purpose: ShallowCopy redefinition
208 ---C++: function call
211 ShallowDump (me; s: in out OStream)
214 ---Purpose: ShallowDump redefinition
215 ---C++: function call
218 GetArray (me) returns Array is private;
220 ---Purpose :Returns the field Buckets associated to the object.
223 GetFH (me) returns FH is private;
225 ---Purpose :Returns the field Hash associated to the object.
232 friends class MapIterator from PCollection