All questions refer to the following class dictionary: import edu.neu.ccs.demeter.dj.*; Input = Component Attachment. Component = "component" ComponentName "class" "graph" MyClassGraph "provides" Provided "expects" PList(Normal) ["constraints" PList(Constraint)] "classes" PList(ClassName). Attachment = "attachment" CList(ComponentName) "on" ComponentName. ComponentName = Ident. ClassGraphName = Ident. ClassName = Ident. Provided = PList(FunctionMember). MyClassGraph = ClassGraphName. FunctionMember : Normal | Aspectual. Normal = "normal". Aspectual = "aspectual". Member = "member". Constraint = . PList(S) ~ "{" S {";" S} "}". CList(S) ~ "(" S {"," S} ")". Main = . All questions refer to the following program: Main { {{ static ClassGraph cg; public static void main(String args[]) throws Exception { cg = new ClassGraph(true, false); ClassGraph cgWT = new ClassGraph(Main.cg, "from Input bypassing -> *,tail,* to *"); cg = cgWT; Input c = Input.parse(System.in); c.display(); System.out.println(); System.out.println("original Input-object"); c.print(); System.out.println(); c.normals(); c.updateInput(); c.print(); System.out.println(); c.normals(); System.out.println(); TraversalGraph tg = new TraversalGraph( "from Input via Provided to Normal", cg); System.out.println(tg); System.out.println(" done "); } }} } Input { void display() to * (DisplayVisitor); void print() to * (PrintVisitor); } Normal { void print() to * (PrintVisitor); } Input { {{ void normals(){ System.out.println(" all Normal objects reachable from Input "); Main.cg.traverse(this,"from Input to Normal", new Visitor() { public void before (Normal host) { host.print(); System.out.println(); } }); } void updateInput(){ System.out.println(" update Provided: add one Normal-object "); Main.cg.traverse(this,"from Input to Provided", new Visitor() { public void before (Provided host) { host.get_fms().addElement(new Normal()); } }); } }} } Question 1: =========== 10 points Consider the following input in program.input: "It works!" What output will the parser produce for this input? UNKNOWN1 Question 2: =========== Write a method called normals() which prints for a given Input-object o all Normal-objects that o contains. UNKNOWN2 Question 3: =========== Write a method called updateInput() which updates a given Input-object o by adding one Normal-object at the end of the list fms contained in every Provided-object of o. For example, if the Input-object is: component T class graph G provides {aspectual} expects {normal} classes {T1} attachment (Y) on B the modified Input-object should be: component T class graph G provides {aspectual;normal} expects {normal} classes {T1} attachment (Y) on B UNKNOWN3 Question 4: =========== When we call the print() method on the following Input-object, what gets printed? : Input ( : Component ( : ComponentName ( : Ident "A" ) : MyClassGraph ( : ClassGraphName ( : Ident "G" ) ) : Provided ( : FunctionMember_PList { : Nonempty_FunctionMember_PList ( : Normal ( ) : Nonempty_FunctionMember_PList ( : Aspectual ( ) : Nonempty_FunctionMember_PList ( : Normal ( ) : Nonempty_FunctionMember_PList ( : Aspectual ( ) ) ) ) ) } ) : Normal_PList { : Nonempty_Normal_PList ( : Normal ( ) : Nonempty_Normal_PList ( : Normal ( ) ) ) } : Constraint_PList { : Nonempty_Constraint_PList ( : Constraint ( ) ) } : ClassName_PList { : Nonempty_ClassName_PList ( : ClassName ( : Ident "R" ) : Nonempty_ClassName_PList ( : ClassName ( : Ident "S" ) : Nonempty_ClassName_PList ( : ClassName ( : Ident "T" ) ) ) ) } ) : Attachment ( : ComponentName_CList { : Nonempty_ComponentName_CList ( : ComponentName ( : Ident "X" ) : Nonempty_ComponentName_CList ( : ComponentName ( : Ident "Y" ) : Nonempty_ComponentName_CList ( : ComponentName ( : Ident "Z" ) ) ) ) } : ComponentName ( : Ident "A" ) ) ) UNKNOWN4 original Input-object component A class graph G provides{normal;aspectual;normal;aspectual}expects{normal;normal}constraints{}classes{R;S;T}attachment(X,Y,Z)on A Question 5: =========== Consider the traversal specification: from Input through Provided to Normal For which classes would you have to write code if you would have to implement this traversal manually following the Law of Demeter? Give the list of classes: UNKNOWN 5