Question 2: ================== 15 UNKNOWNs: 3 points each: 45 points. Consider the following class dictionary SchemaComplex: import java.util.*; import java.io.*; import edu.neu.ccs.demeter.dj.*; //****************************************************************************** // Basic definitions //****************************************************************************** Main = . List(S) ~ { + *l S -}. //****************************************************************************** // PART 1: Definitions of structures implementing the components of the input // XML schema specification //****************************************************************************** Schema = "<" [ NSRef ] "schema" List(AttrValue) ">" List(SchemaItem) " NSRef ] "schema>" *EOF*. NSRef = Ident ":". AttrValue = [ lookahead (@2@) NSRef ] Ident "=" String. SchemaItem : lookahead (@4@) Annotation | lookahead (@4@) Attribute | lookahead (@4@) ElementItem | lookahead (@4@) TypeDef | Comment . Annotation = "<" [ NSRef ] "annotation>" List(AnnotationContent) " NSRef ] "annotation>". AnnotationContent : lookahead (@4@) Appinfo | lookahead (@4@) Documentation. Appinfo = "<" [ NSRef ] "appinfo>" List(AttrValue) " NSRef ] "appinfo>". Documentation = "<" [ NSRef ] "documentation" List(AttrValue) RestOfDocumentation. RestOfDocumentation : EmptyDocumentation | NonEmptyDocumentation. EmptyDocumentation = "/>". NonEmptyDocumentation = ">" [ String ] " NSRef ] "documentation>". Attribute = "<" [ NSRef ] "attribute" List(AttrValue) RestOfAttribute. RestOfAttribute : EmptyAttribute | NonEmptyAttribute. EmptyAttribute = "/>". NonEmptyAttribute = ">" [ lookahead (@4@) Annotation ] " NSRef ] "attribute>". Element = "<" [ NSRef ] "element" List(AttrValue) RestOfElement. RestOfElement : EmptyElement | NonEmptyElement. EmptyElement = "/>". NonEmptyElement = ">" [ lookahead (@4@) Annotation ] [ lookahead (@4@) TypeDef ] " NSRef ] "element>". TypeDef : lookahead (@4@) SimpleType | lookahead (@4@) ComplexType. SimpleType = "<" [ NSRef ] "simpleType" List(AttrValue) ">" [ lookahead (@4@) Annotation ] " NSRef ] "simpleType>". ComplexType = "<" [ NSRef ] "complexType" List(AttrValue) ">" [ lookahead (@4@) Annotation ] ComplexTypeContent List(Attribute) " NSRef ] "complexType>". ComplexTypeContent = [ lookahead (@4@) ElementItem ]. ElementItem : lookahead (@4@) Element | lookahead (@4@) SequenceGroup . SequenceGroup = "<" [ NSRef ] "sequence" List(AttrValue) ">" [ lookahead (@4@) Annotation ] List(ElementItem) " NSRef ] "sequence>". Comment = "". Consider the following program that finds all names of complex types in an XML schema. The program finds all ComplexType-objects and then searches the Attribute_List to find an attribute with name "name". Fr example, the following complex type definition is introducing a type called PurchaseOrderType. The program will put string "PurchaseOrderType" into a HashSet-object. Find the UNKNOWNs below. Schema { {{ HashSet getDefThings(ClassGraph cg){ String definedThings = "from Schema to ComplexType"; Visitor v = new Visitor(){ HashSet r = new HashSet(); void before(ComplexType host){ String n = UNKNOWN1.UNKNOWN2().search_name(); if (!(n == null)) r.add(n); } public Object UNKNOWN3(){return r;} }; cg.UNKNOWN4(this,UNKNOWN5,UNKNOWN6); return (HashSet) v.UNKNOWN7(); } }} } AttrValue_List { {{ String search_name(){ UNKNOWN8 en = this.elements(); String s = new String("name"); String result; while (UNKNOWN9.UNKNOWN10()) { UNKNOWN11 n = (UNKNOWN12) en.UNKNOWN13(); if (s.equals(n.UNKNOWN14().toString())) { result = n.UNKNOWN15(); System.out.println("Type " + result + " found"); return result; } } System.out.println("NOTHING FOUND"); return null; } }} } If getDefThings(..) is called on the Schema-object described in XML2AP.input: < xsd : documentation > "Purchase order schema for Example.com. Copyright 2000 Example.com. All rights reserved." < xsd : sequence > < xsd : sequence > we get the following output: Type PurchaseOrderType found Type USAddress found Type Items found NOTHING FOUND