This preview shows page 1. Sign up to view the full content.
Unformatted text preview: .
E1Ew © ¨ © ¨ A a DJ traversal speciﬁcation 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
PqE 9 EquationSystem
equations
Equation_List *
Equation
rhs lhs *
Variable Expression Ident Simple Compound
op
Figure 3: Class graph for Expression_List g
qqd Operator h
i1 Numerical args . f
1e In our example, let us say that a variable is deﬁned if it appears on the lefthand side of an equation and that it is used if it appears on the righthand. In the
example, variables , and are deﬁned, and variables , and are used.
The purpose of our Java program is to collect the deﬁned and used variables.
r
EX Y
`X k
gE
d
w8 d h
1 h
1
w8 j
1e j
1e
1E d
w8Gw1 h
E
wxEE1whi1
h g
qGd
f
1e E
g
`qd
f
1e
i1
h l
qiw k
g1
E h
E
wmVEEmE
h g
qnd
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 perclass basis. 10 e
EX The code for this task is shown in ﬁgure 4. The static member
contains a
object that contains a representation of the current class diagram1 . i
1X The DJ library uses reﬂection to compute the relevant FIRST sets. This has two
advantages: ﬁrst, 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 ﬁrst 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 ﬁrst traversal may be
written as
The second may be written as
. . ¥ 11
Figure 4: Finding the variables in an equation system
¥
¥
±r szs
G1P1Py
{
}{ztt²u
VwiVVVwi8PwP1Pwi
}ztts yt~}{zysxwu
{¡±
t s yq rr {q tz y
8VwiV"viEii
}xy
´4G8Piiw48iVPVwws
ts}z¡³y
y~t
¥
±r szs
1i1v1iPy
{y
t
x{
}{ztt²u
PVVwViPi...
View
Full
Document
This document was uploaded on 03/17/2014 for the course CSG 111 at Northeastern.
 Fall '09

Click to edit the document details