-------------------------------------------------------------------------- Software Design and Development Winter 2002 COM 1205 Karl Lieberherr --------------------------------------------------------------------------- FINAL --------------------------------------------------------------------------- Open book and open notes. Overview: 1: 20 points: class dictionary design and programming 2: 18 points: class dictionary, input and strategy 3: 50 points: parsing and program understanding 4: 36 points: class dictionary design 5: 40 points: program design and programming == 164 points Question 1: ================================================== UNKNOWN1 = CDefs ~ CDef {"." CDef}. CDef ~ CN Ps. Ps = P {"," P}. P = CN. CN = Ident. Main = String. UNKNOWN2 = cg.traverse(this,"from CDefs to CN", new Visitor(){ int c; void start(){c=0;} void before(CN host) {c++;} void finish() {System.out.println(c);} }); OR List l = cg.gather(this,"from CDefs to CN"); System.out.println(" Found " + l.size() + "CN-objects"); Question 2: ================================================== UNKNOWN1 = X = "x" Y. Y = "y" Z. Z = "z". UNKNOWN2 = x y z UNKNOWN3 = from X to Z or from X via Y to Z Question 3: ================================================== UNKNOWN1 = PointCut_List UNKNOWN2 = PointCut UNKNOWN3 = PointCut UNKNOWN4 = AndOrExp UNKNOWN5 = OpPCExp UNKNOWN6 = OpPCExp UNKNOWN7 = Nonempty_PointCut_List UNKNOWN8 = PointCut UNKNOWN9 = CFlow UNKNOWN10 = PointCut UNKNOWN11 = NotExp UNKNOWN12 = CFlow UNKNOWN13 = This UNKNOWN14 = AspectJFragment UNKNOWN15 = PointCut_List UNKNOWN16 = PointCut UNKNOWN17 = This UNKNOWN18 = PointCut UNKNOWN19 = AndOrExp UNKNOWN20 = OpPCExp UNKNOWN21 = This UNKNOWN22 = OpPCExp UNKNOWN23 = PointCut UNKNOWN24 = PointCut UNKNOWN25 = NotExp Question 4: ================================================== There are several variations that are correct. UNKNOWN1 = List UNKNOWN2 = AdviceKind PCList(ArgDecl) ":" PCExp "{" "}" ";". UNKNOWN3 = AdviceKind CHOICE: match with UNKNOWN2 AdviceKind UNKNOWN4 = Before | After UNKNOWN5 = "before" UNKNOWN6 = "after" Question 5: ================================================== UNKNOWN1 = Visitor v1 = new Visitor() { void before(Variable host) { System.out.println(host.get_ident()); } }; System.out.println("left-hand-side"); cg.traverse(this,"from AspectJFragment via {-> *,lhs,*} to Variable",v1); System.out.println("right-hand-side"); cg.traverse(this,"from AspectJFragment via {-> *,rhs,*} to Variable",v1);