1 -- File: GraphDS_RelationGraph.cdl
2 -- Created: Fri Sep 6 11:00:25 1991
3 -- Author: Denis PASCAL
5 ---Copyright: Matra Datavision 1991
8 generic class RelationGraph from GraphDS
10 GraphDS_Attribute as any)
12 ---Purpose: This generic class describe a network (or graph) of
13 -- Relations between Entities. an Item can be associated
14 -- to the Entity and respectively an Attribute to the
15 -- Relation. This class can be compared to the
16 -- DirectedGraph of this package. But here the Relation
17 -- (compared to the Edge) can describe links between more
18 -- than two Entities. Each link can be described as
19 -- oriented or not. Nested classes permit to edit and
20 -- visit that structure. Interface of visiting tools are
24 uses TShared from MMgt,
25 MapOfTransient from TColStd,
26 EntityRole from GraphDS
28 raises NoSuchObject from Standard,
29 NoMoreObject from Standard,
30 DomainError from Standard
32 class Entity from GraphDS inherits TShared from MMgt
34 uses RelationRole from GraphDS,
35 MapOfTransient from TColStd
39 Create (value : GraphDS_Item)
40 returns mutable Entity from GraphDS;
44 ---C++ : return const&
45 returns any GraphDS_Item;
47 Contains (me; R : Relation from GraphDS)
49 returns Boolean from Standard;
53 returns Boolean from Standard;
55 GetRole (me; R : Relation from GraphDS)
57 returns RelationRole from GraphDS;
59 IsFront (me; R : Relation from GraphDS)
61 returns Boolean from Standard;
63 IsBack (me; R : Relation from GraphDS)
65 returns Boolean from Standard;
67 Add (me : mutable; R : Relation from GraphDS)
70 Remove (me : mutable; R : Relation from GraphDS)
75 returns MapOfTransient from TColStd
80 myItem : GraphDS_Item;
81 myRelations : MapOfTransient from TColStd;
85 class RelationGraph from GraphDS,
86 class EntitiesIterator from GraphDS,
87 class IncidentEntitiesIterator from GraphDS,
88 class RelationsIterator from GraphDS,
89 class IncidentRelationsIterator from GraphDS
91 end Entity from GraphDS;
94 class Relation inherits TShared from MMgt
96 uses EntityRole from GraphDS,
97 EntityRoleMap from GraphDS
101 Create (value : GraphDS_Attribute)
102 returns mutable Relation;
106 ---C++: return const&
107 returns any GraphDS_Attribute;
109 Contains (me; E : Entity from GraphDS)
111 returns Boolean from Standard;
115 returns Boolean from Standard;
117 GetRole (me; E : Entity from GraphDS)
119 returns EntityRole from GraphDS;
121 IsInput (me; E : Entity from GraphDS)
123 returns Boolean from Standard;
125 IsOutput (me; E : Entity from GraphDS)
127 returns Boolean from Standard;
129 Remove (me : mutable; E : Entity from GraphDS)
132 Add (me : mutable; E : Entity from GraphDS;
133 R : EntityRole from GraphDS)
136 SetRole (me : mutable; E : Entity from GraphDS;
137 R : EntityRole from GraphDS)
141 ---C++: return const&
142 returns EntityRoleMap from GraphDS
147 myAttribute : GraphDS_Attribute;
148 myEntities : EntityRoleMap from GraphDS;
152 class RelationGraph from GraphDS,
153 class EntitiesIterator from GraphDS,
154 class IncidentEntitiesIterator from GraphDS,
155 class RelationsIterator from GraphDS,
156 class IncidentRelationsIterator from GraphDS
161 class EntitiesIterator from GraphDS
163 ---Purpose: Public nested class which defines an iterator to
164 -- visit each Entity member of a given RelationGraph.
166 uses MapOfTransient from TColStd,
167 MapIteratorOfMapOfTransient from TColStd
169 raises NoMoreObject from Standard,
170 NoSuchObject from Standard
174 returns EntitiesIterator from GraphDS;
176 Create (G : RelationGraph from GraphDS)
177 returns EntitiesIterator from GraphDS;
179 Create (G : RelationGraph from GraphDS;
180 E : Entity from GraphDS)
181 returns EntitiesIterator from GraphDS;
183 Create (G : RelationGraph from GraphDS;
184 E : Relation from GraphDS)
185 returns EntitiesIterator from GraphDS;
187 Initialize (me : in out; G : RelationGraph from GraphDS);
190 Initialize (me : in out; G : RelationGraph from GraphDS;
191 E : Entity from GraphDS);
194 Initialize (me : in out; G : RelationGraph from GraphDS;
195 R : Relation from GraphDS);
200 returns Boolean from Standard;
204 raises NoMoreObject from Standard;
207 ---C++: return const&
209 returns Entity from GraphDS
210 raises NoSuchObject from Standard;
214 myMap : MapOfTransient from TColStd;
215 myEntities : MapIteratorOfMapOfTransient from TColStd;
217 end EntitiesIterator;
220 class RelationsIterator from GraphDS
222 ---Purpose: Public nested class which defines an iterator to
223 -- visit each Relation member of a given
226 uses MapOfTransient from TColStd,
227 MapIteratorOfMapOfTransient from TColStd
229 raises NoMoreObject from Standard,
230 NoSuchObject from Standard
234 returns RelationsIterator from GraphDS;
236 Create (G : RelationGraph from GraphDS)
237 returns RelationsIterator from GraphDS;
239 Create (G : RelationGraph from GraphDS;
240 R : Relation from GraphDS)
241 returns RelationsIterator from GraphDS;
243 Create (G : RelationGraph from GraphDS;
244 E : Entity from GraphDS)
245 returns RelationsIterator from GraphDS;
247 Initialize (me : in out; G : RelationGraph from GraphDS);
250 Initialize (me : in out; G : RelationGraph from GraphDS;
251 R : Relation from GraphDS);
254 Initialize (me : in out; G : RelationGraph from GraphDS;
255 E : Entity from GraphDS);
259 returns Boolean from Standard;
263 raises NoMoreObject from Standard;
267 ---C++: return const&
268 returns Relation from GraphDS
269 raises NoSuchObject from Standard;
274 myMap : MapOfTransient from TColStd;
275 myRelations : MapIteratorOfMapOfTransient from TColStd;
277 end RelationsIterator;
280 class IncidentEntitiesIterator from GraphDS
282 uses MapOfTransient from TColStd,
283 MapIteratorOfMapOfTransient from TColStd
285 raises NoMoreObject from Standard,
286 NoSuchObject from Standard
291 returns IncidentEntitiesIterator from GraphDS;
293 Create (G : RelationGraph from GraphDS;
294 E : Entity from GraphDS)
295 returns IncidentEntitiesIterator from GraphDS;
297 Initialize (me : in out; G : RelationGraph from GraphDS;
298 E : Entity from GraphDS);
303 returns Boolean from Standard;
307 raises NoMoreObject from Standard;
310 ---C++: return const&
312 returns Entity from GraphDS
313 raises NoSuchObject from Standard;
317 myMap : MapOfTransient from TColStd;
318 myEntities : MapIteratorOfMapOfTransient from TColStd;
320 end IncidentEntitiesIterator;
323 class IncidentRelationsIterator from GraphDS
325 uses MapOfTransient from TColStd,
326 MapIteratorOfMapOfTransient from TColStd
328 raises NoMoreObject from Standard,
329 NoSuchObject from Standard
332 returns IncidentRelationsIterator from GraphDS;
334 Create (G : RelationGraph from GraphDS;
335 R : Relation from GraphDS)
336 returns IncidentRelationsIterator from GraphDS;
338 Initialize (me : in out; G : RelationGraph from GraphDS;
339 R : Relation from GraphDS);
344 returns Boolean from Standard;
348 raises NoMoreObject from Standard;
351 ---C++: return const&
353 returns Relation from GraphDS
354 raises NoSuchObject from Standard;
358 myMap : MapOfTransient from TColStd;
359 myRelations : MapIteratorOfMapOfTransient from TColStd;
361 end IncidentRelationsIterator;
366 returns RelationGraph from GraphDS;
367 ---Purpose: Creates an empty relation graph.
369 Create (other : RelationGraph from GraphDS)
370 returns RelationGraph from GraphDS;
373 ---Purpose: tests if <me> contains any Entity.
375 returns Boolean from Standard;
378 ---Purpose: Removes all the Entities and all the relations of
382 Contains (me; E : Entity from GraphDS)
383 ---Purpose: tests if <me> contains <E>.
385 returns Boolean from Standard;
387 Contains (me; R : Relation from GraphDS)
388 ---Purpose: tests if <me> contains <rel>.
390 returns Boolean from Standard;
393 ---Purpose: returns the number of Entity of me.
395 returns Integer from Standard;
398 ---Purpose: returns the number of Relations of <me>.
400 returns Integer from Standard;
402 IsInRelation (me; E : Entity from GraphDS)
403 ---Purpose: To Know if <E> is in relation (as input,output
404 -- or both as well) with others Entities of <me>.
406 returns Boolean from Standard
407 raises NoSuchObject from Standard;
409 IsInput (me; E : Entity from GraphDS)
410 returns Boolean from Standard
411 ---Purpose: returns True if <E>
413 raises NoSuchObject from Standard;
415 IsOutput (me; E : Entity from GraphDS)
416 returns Boolean from Standard
417 ---Purpose: returns True if <E> is at least output of one of
420 raises NoSuchObject from Standard;
422 IsDependent (me; E : Entity from GraphDS)
423 returns Boolean from Standard
424 ---Purpose: returns True if <E> is not input of one of its
427 raises NoSuchObject from Standard;
429 AddEntity (me : in out; value : GraphDS_Item)
430 ---Purpose: Creates an adds a new Entity (which contains item)
433 returns Entity from GraphDS;
435 RemoveEntity (me : in out; E : Entity from GraphDS)
436 ---Purpose: Removes a Entity <E> of <me>. Be carefull than an
437 -- exception is raised if <E> is still member of any
440 raises NoSuchObject from Standard,
441 DomainError from Standard;
443 AddRelation (me : in out; value : GraphDS_Attribute)
444 ---Purpose: Creates an adds a new Relation (which contains
445 -- attribute) to <me>.
447 returns Relation from GraphDS;
449 RemoveRelation (me : in out; R : Relation from GraphDS)
450 ---Purpose: Removes a relation <R> of <me>.
452 raises NoSuchObject from Standard;
454 ---Purpose: relation editing function
456 IsEmpty (me; R : Relation)
457 ---Purpose: returns TRUE if noone entity is member of <R>.
459 returns Boolean from Standard
460 raises NoSuchObject from Standard;
462 Add (me : in out; R : Relation; E : Entity)
463 ---Purpose: add an InputAndOutput entity <E> to <R>
465 raises NoSuchObject from Standard;
467 AddInput (me : in out; R : Relation; E : Entity)
468 ---Purpose: add OnlyInput entity <E> to <R>.
470 raises NoSuchObject from Standard;
472 AddOutput (me : in out; R : Relation; E : Entity)
473 ---Purpose: add an OnlyOutput entity <E> to <R>.
475 raises NoSuchObject from Standard;
477 Add (me : in out; R : Relation;
479 role : EntityRole from GraphDS)
480 ---Purpose: add an entity <E> to <R> with role <role>.
482 raises NoSuchObject from Standard;
484 SetRole (me : in out; R : Relation;
486 role : EntityRole from GraphDS)
487 ---Purpose: set a new role <role> for the entity <E> member of <R>.
489 raises NoSuchObject from Standard;
491 Remove (me : in out; R : Relation; E : Entity)
492 ---Purpose: remove the entity <E> member of <R>.
494 raises NoSuchObject from Standard;
498 myEntities : MapOfTransient from TColStd;
499 myRelations : MapOfTransient from TColStd;
503 class EntitiesIterator from GraphDS,
504 class RelationsIterator from GraphDS