Unformatted text preview: class graph object graph
e1 objects: e2 e3 Figure 2: A path in an object graph. If there is a path in the graph from o1 to o2 ,
then class o1
class o2 .
"¨ Lemma 3 Let c1 and c2 be classes. Then there exists an object graph O of C
c1 and class o2
c2 and O o1 o2 iff
and objects o1 , o2 such that class o1
c1 class o1
P ¨ ¨ ¨
"¨ ¨ Proof: Immediate.
"¨ e c
"¨ ec 0£ ( &
$ FIRST c c
© ¨ Proof: We must show that there exists an object graph O of C and objects o
and o such that
£ C c.
"¨ e £ ¨
"¨ iff c 3. o eO o c
£ ¨ 2. class o c $
S 1. class o The forward direction is immediate from the deﬁnition of an object graph of C.
For the reverse deﬁnition, consider a sequence of classes such that
"¨ c2 en
T e1 1
"¨ c1 cn
"¨ c Then construct an object graph with n 2 objects, of classes c, c1 , . . . ,cn, c ,
with a link labelled e from the c-object to the c1 object, a link labelled e1 from the
£ U 8 c1 object to the c2 object, etc. Let o be the ﬁrst object in this sequence and o be
the last. This object graph satisﬁes the requirements. QED
£ Similarly, to ﬁnd all the edges from an object of class c that might lead to an
edge e, we compute
£ e C
"¨ c ¨ £ c H¨
WV( £ &
$ © ¨ 7 e ec 0
5 £ FIRST c e A Simple Example We illustrate automated traversal generation with a simple example, written in Java
using the DJ library.
Consider an equation system that contains equations with a left-hand side and
a right-hand side. A typical set of equations might be
i A possible class diagram for these structures is shown in Figure 3, using notation similar to that of our previous ﬁgures. The asterisks indicate one-many relations; they are included for UML compatibility but are not part of our model; in
our model has-as-part relations are always possibly one-many.
8 c2 ©222
EE1w c1 cK -paths using the search criterion
In DJ, we search for all minimal c1
1E DJ traversal speciﬁcations allow several extensions of this notation. The criterion
E1Ew c0 cK
E has the same behavior as the search above, but fails if its starting point is not of
type c0 . DJ also allows edge speciﬁcations of the form
e. This can be
implemented by extending FIRST c1 c2 to FIRST c e as deﬁned in section 6 and
modifying the algorithm in section 5 correspondingly...
View Full Document
- Fall '09