Question 1: UNKNOWN1 = SGEdge | StrategyGraph *common* [ NegativeConstraint ] UNKNOWN2 = "{" *l + SList(StrategyExpression) - *l "}" UNKNOWN3 = "->" ClassGlobSpec ClassGlobSpec UNKNOWN4 = StrategyDefinitions{ float average() to StrategyGraph { (@ int c; int s; @) init (@ c=0; s=0; @) return (@ (float) s/c @) before StrategyDefinition (@ c += 1; System.out.println(" c = " + c); @) before StrategyGraph (@ s += 1; System.out.println(" s = " + s); @)} } Question 2: UNKNOWN1 = 21 UNKNOWN2 = 26 UNKNOWN3 = 31 UNKNOWN4 = 65 UNKNOWN5 = 65 UNKNOWN6 = Take out line 40, except the ; + " out.print(\"<" + partname + "> \");\n"; UNKNOWN7 = This code defines a method on classes, ClassDef, Subclass, Superclass, Part, and RepeatedPart When invoked on an instance of one of these classes, the method retrieves that associated ClassName object used to identify the class represented by the instance on which the method was invoked. Question 3: ================================================== The most interesting feature of the new notation is the ability to chain visitors together via the 'modifies' clause in the visitor declaration. This allows for the definition of modular visitors (each focused on a single task) which can then be combined to perform more complex tasks. Although this can be done to some extent in Demeter/Java (e.g. the counting visitors example discussed in class), it requires that the collaborating visitors know about each other's types (because collaborating visitors hold references to each other), and therefore reduces the ability to reuse some of these visitors in new collaborations. Question 4: ================================================== Part 1: A strategy s2 is a refinement of of strategy s1 if for any class graph the traversal graph of s2 is a subgraph of the traversal graph of s1. Part 2: The problem with the definiton in Part 1 is that you can't test it explicitly because of the universal quantification over class graphs which it entails. We need a definition in terms of strategy graphs. Look for syntactic properties of a strategy which can be shown to make it a refinement of another. For example A strategy s1 is a refinement of s2 if every edge of s2 can be related to one or more edges of s1 in the following ways: 1) An edge of s2 has an exactly corresponding edge in s1 Ex: s1: A->B bypassing C s2: A->B bypassing C 2) An edge of s2 has a more restricted edge in s1 (i.e. an edge in s1 containg a 'bypassing' clause which is a superset of the bypassing clause of the corresponding edge in s2) Ex: s1: A-> bypassing {C,D} s2: A->B bypassing C 3) An edge of s2 corresponds to a path (sequence of edges) in s1. Ex: s1: A->B,B->C s2: A->C