From: Karl Lieberherr [lieber@ccs.neu.edu] Sent: Monday, June 27, 2005 2:37 PM To: ydu@ccs.neu.edu; Jingsong Feng (jingsong@ccs.neu.edu); jpalm@ccs.neu.edu; lieber@ccs.neu.edu; Pengcheng Wu; Therapon Skotiniotis Subject: display visitor example Hi Theo: Do you agree with the Completion and AllCompletion problems as being relevant for aspect interfaces? -- Karl Aspect interface study for the display visitor generator in DemeterJ: We need a traversal that goes to all class definitions. Aspect interface for: /proj/adaptive/www/software/src/generate/gendisplayvis.beh Why is this .beh file an aspect? Definition: An aspect is a module whose ad-hoc implementation cuts across multiple components. Method generateDisplayVisitor. Its ad-hoc implementation would cut across dozens of classes. (Check DemeterJ generated code) Interface Class Graph: Program = List(ClassDef). ClassDef = ClassName List(Part). Part = [PartName] ClassName . PartName = Ident. ClassName = Ident. visitor signature: before Program after Program before Classdef before Part strategies: from Program to {ClassDef, Part} Important note: from Program to {Part} is sufficient because the interface class graph guarantees that "from Program to Part" has "from Program to ClassDef" as a prefix. (G,s2) is a completion of (G,s1) 1. if for every path p in the path set of (G,s1) there is a completion in the path set of (G,s2). What is the complexity of the Completion decision problem? Given G, s1 and s2: Is (G,s2) a completion of (G,s1)? What is the complexity of the AllCompletion problem: Given G and s1, list all strategies s2 so that (G,s2) a completion of (G,s1). In the above example: "from Program to Part" is a completion of "from Program toClassdef". A strategy and its completion have the same source. composition example: Replace ClassDef = ClassName List(Part). by ClassDef = Classname ClassParts. ClassParts : KindA | KindB common List(Part). KindA = "a". KindB = "b". visitor signature: before Classdef if s1 succeeds ... if s2 succeeds ... strategies s1 = from ClassDef to KindA s2 = from ClassDef to KindB Instantiation: { Program, ClassDef } { traversal allParts(PartVisitor v) { to { Part, RepeatedPart }; } What is the class graph? See generate.cd. Mapping: ================= gentracevis.beh is a little simpler