Lecture 6 Notes

In the example variables and are dened and variables

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . ‡…„ƒ ‚E†1Ew€  ‡ ©  ¨ © ¨ A a DJ traversal specification may include a clause c1 specifying that the portion of the path in which this clause occurs may not pass through an object of class c1 . The DJ library also includes ways to specify strategy graphs [10]. d™˜˜—–• Pˆq‚E” 9 EquationSystem equations Equation_List * Equation rhs lhs * Variable Expression Ident Simple Compound op „ € ™ … — Figure 3: Class graph for Expression_List ˜•g q‚qd Operator ’h i1€ Numerical args . f 1e In our example, let us say that a variable is defined if it appears on the lefthand side of an equation and that it is used if it appears on the right-hand. In the example, variables , and are defined, and variables , and are used. The purpose of our Java program is to collect the defined and used variables. r EX Y `X k gE€ „ d „ ™˜ w8˜ d „ h 1ƒ h 1ƒ ™˜ w8˜ ‡ –j †1e –j †1e ‡…„ƒ †ˆ†1E‚€ d™˜˜—–• “w8ˆGw1” ’h “E€ ƒ wx‚E†E1whi1€ ‡…„ƒ€ ’h ˜ ˜•g q‚Gd „ ™ € — … f 1e ’“„Eƒ ‘ ˜•g `†qd „ € ™ — … f 1e ’„ i1ƒ ‘ h ƒ l”— qiw™ — k g1€ „ „ E€ ’h “E€ ˜ ƒ wm†ˆVEE‚m“E€ ‡…„ƒ€ ’h ˜•g q‚nd „ ™ € — … f 1e ’„ “Eƒ ‘ ˜•g `‚Gd „ ™ € — … f 8e ’„ iEƒ ‘ h h l”— GV‚™ ƒ — k gE€ „  ˜ l ‡…„ƒ †ˆ†1E‚€ l”— GVw™ — ƒ k ‡ o  – i— ƒ p˜˜— V8E8l 1 In a real application, this would probably done globally rather than on a per-class basis. 10 — e EX The code for this task is shown in figure 4. The static member contains a object that contains a representation of the current class diagram1 . ƒ i 1X The DJ library uses reflection to compute the relevant FIRST sets. This has two advantages: first, it allows the same code to be reused even if the class structure changes. We say this behavior is adaptive [8]. Second, it allows the ksystem to be implemented as a pure Java library rather than as a preprocessor. l”— GVw™ e 1X There are of course many ways of specifying the same traversals. For example the first could have been written as , and the second could have been written as . h i 1X To solve this problem, we identify two traversals. The first traversal may be written as The second may be written as . . ¥ 11 Figure 4: Finding the variables in an equation system ¥ ¥ ’‘±r szˆs™ G“1“P|1P‚Ž†y { }{zttˆ‰²u ||†Vw††iVœVƒ†Vw‚i†œ”‚€8PwP|1Pw“†‹”†iƒ” Œ}ztts‰ ‚yt~}{zysxwu ‚{ˆ¡± t ˆs ™yq rr {q— tz Šy 8“‚V”wiV†|"viE“Ži†i“†ˆ }ˆxy „ ´4G8P‚iiw48i‚VP‚“Vwƒws ˜ ‘ tˆs™–}z¡³yŒ y~Št ¥ ’‘±r szˆs™ ˆ“1i||1“‚‚v1iŽ“†P‚†“y {y tŠˆ ŠŒx{ˆŠ }{zttˆ‰²u P|VVw‚†“VŽi†P††i”‚...
View Full Document

This document was uploaded on 03/17/2014 for the course CSG 111 at Northeastern.

Ask a homework question - tutors are online