FINAL EXAM CSU670 Fall 2003 December 2003 Karl Lieberherr YOUR NAME: YOUR NAME: Open book and open notes. Question 1: ================================================== Comment of Programming Style UNKNOWN0 = There are multiple duplications in the code. It violates the DRY principle. UNKNOWN1 = X X X UNKNOWN2 = NOTHING UNKNOWN3 = X X Question 2: ================================================== UNKNOWN1 = OrderedWithBypassingNewStrategy UNKNOWN2 = "(" UNKNOWN3 = List(BypassingNewStrategy) ")" UNKNOWN4 = ["bypassing" UNKNOWN5 = ] Question 3: ================================================== UNKNOWN1 = AbstractNewStrategy BypassingNewStrategy BypassingNewStrategy_List CompositeNewStrategy ConcreteNewStrategy Entry Exit Histories HistoryPcd HistoryPcd_PList NamedNewStrategy NamedNewStrategyRef NewStrategy NewStrategy_PList Nonempty_BypassingNewStrategy_List Nonempty_HistoryPcd_PList Nonempty_NewStrategy_PList Nonempty_OrderedNewStrategy_BarList OptionalNewStrategy OrderedNewStrategy OrderedNewStrategy_BarList OrderedWithBypassingNewStrategy PrimitiveNewStrategy ZeroOrMoreNewStrategy java.io.Serializable java.lang.Object java.util.Enumeration UNKNOWN2 = Entry NewStrategy Pointcut PrimitiveNewStrategy java.io.Serializable java.lang.Object Question 4: ================================================== Input: Two cds C1 and C2 satisfying the stated relationship that they only differ in the tokens. Output: Translator from C1-sentences to C2-sentences. Solution: 1. Create a directory for C1 and generate the code using DemeterJ. 2. Same for C1. 3. Copy the PrintVisitor.java file for C2 to the PrintVisitor.java file for C1. 3. Using the directory for C1, write a main method: StartClassC1 input StartClassC1.parse(System.in); input.print(); where print() is defined by StartClassC1 { void print() to * (PrintVisitor); } Question 5: ================================================== Change Formals to: Formals = [ CList(Pair) ] . Add: Pair = TypeName VariableName. CList(S) ~ S {"," S} . TypeName = Ident. VariableName = Ident. Question 6: ==================================================== UNKNOWN1 = manifest UNKNOWN2 = extension points UNKNOWN3 = extensions UNKNOWN4 = extension points