Lecture 6 Notes

# Theorem 1 c e c ec 0 r first c c proof

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

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 C 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 C class o2 c2 .  © ¨ P   ¨   ¨    ¨   "¨ ¨ Proof: Immediate. Theorem 1 C   "¨  e c   "¨ ec 0£ ( & 'R £ \$ 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 e2 ¨22 "4332   "¨ c2 en T  e1 1   "¨ c1 cn   e c £  "¨ 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( £ & 'S \$ © ¨ 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 piX q8hgE5db`X f e Xc a Y ppYX 8wv'u1sgE5dg1X t i Xc f r Xc a e ppr 8Gxu5sgE5dx8X t yc f r Xc a 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. ¨  1  8 c2 ©222 333©  EE1w c1 cK -paths using the search criterion  In DJ, we search for all minimal c1 cK  1E DJ traversal speciﬁcations allow several extensions of this notation. The criterion  VE1w c2  88 c1  1  E1Ew 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

Ask a homework question - tutors are online