//Determine if there are any non-unique parts. //The main assumption made is that the class-graph is already flattened //When a class is defined with two parts with the same name( immediate // or inherited), we will get the following message: //class className contains a NON-UNIQUE PART partName LabelVisitor{(@ LinkedList labelHashSet = new LinkedList(); void before(Labeled host){ labelHashSet.add(host.get_label_name().toString()); } LinkedList getHashSet(){ return labelHashSet; } @)} AdjacencyVisitor{ (@ HashSet adjHashSet = new HashSet(); void before(Adjacency host){ int first = 0; String toLabels = "from Adjacency bypassing {-> *, superclass, *} through Construct_ns through Any_vertex_List through {Regular, Labeled} to-stop " + Main.FIDENT; TraversalGraph partGraph = new TraversalGraph(toLabels, Main.cg); //create the list of label names for the part classes LabelVisitor lv = new LabelVisitor(); partGraph.traverse(host, lv); //get the list of label names for the part classes LinkedList partSet = lv.getHashSet(); Iterator iter = partSet.iterator(); //Do actual check for non-unique parts while(partSet.size() != 0){ String pName = (String)partSet.removeFirst(); if(partSet.contains(pName)){ String aName = host.get_source().get_vertex_name().toString(); System.out.println(aName + " contains a NON-UNIQUE PART " + pName ); System.exit(1); } } partSet.clear(); } @) } Cd_graph{ (@ void unique_Parts_Check(){ String strategy = "from Cd_graph bypassing {-> *, superclass, *} to-stop Adjacency"; TraversalGraph where = new TraversalGraph(strategy, Main.cg); AdjacencyVisitor av = new AdjacencyVisitor(); where.traverse(this, av); } @) }