FindCVisitor{ {{ void before (Vertex host){ ClassInfo ci = new ClassInfo(); ClassName cn = new ClassName(); cn.set_ident(host.get_vertex_name()); ci.set_name(cn); Cd_graph.delist.get_classinfo_list().addElement(ci); } }} } FindAdjVisitor{ {{ void before(Adjacency host){ FindCCVisitor fcV = new FindCCVisitor(); ClassInfo result = (ClassInfo)Cd_graph.tg_ded.traverse(host,fcV); if(result != null){ FindComVisitor fV = new FindComVisitor(result); Cd_graph.tg_com.traverse(host,fV); FindPartVisitor fdV = new FindPartVisitor(result); Cd_graph.tg_part.traverse(host,fdV); FindSubVisitor sV = new FindSubVisitor(result); Cd_graph.tg_sub.traverse(host,sV); FindParaVisitor cV = new FindParaVisitor(); result = (ClassInfo)Cd_graph.tg_parameter.traverse(host,cV); } } }} } FindParaVisitor{ {{ void before (Vertex host){ Ident n = host.get_vertex_name(); Cd_graph.check_undefined(n); } }} } FindComVisitor{ {{ void before (Vertex host){ ClassDefList comlist = list.get_parameter(); if(comlist == null){ comlist = ClassDefList.parse("{ }"); list.set_parameter(comlist); } ClassInfo ci = new ClassInfo(); ClassName cn = new ClassName(); cn.set_ident(host.get_vertex_name()); ci.set_name(cn); comlist.get_classinfo_list().addElement(ci); } }} } FindCCVisitor{ {{ ClassInfo result; void before (Vertex host){ FindUCVisitor fV = new FindUCVisitor(host.get_vertex_name()); result = (ClassInfo)Cd_graph.tg_list.traverse(Cd_graph.delist,fV); } public Object getReturnValue(){ return result; } }} } FindUCVisitor{ {{ ClassInfo result; void before (ClassInfo host){ Ident n = host.get_name().get_ident(); if(name.toString().compareTo(n.toString()) == 0){ result = host; } } public Object getReturnValue(){ return result; } }} } FindPartVisitor{ {{ Ident partname; void before (Adjacency host){ partname = null; } void before (Vertex host){ Ident n = host.get_vertex_name(); ClassDefList comlist = list.get_parameter(); ClassInfo result; if(comlist != null){ FindUCVisitor cV = new FindUCVisitor(n); result = (ClassInfo)Cd_graph.tg_list.traverse(comlist,cV); if(result == null) result = Cd_graph.check_undefined(n); } else result = Cd_graph.check_undefined(n); if (result != null){ if(list.get_partclass() == null) list.set_partclass(new PartInfo_List()); PartInfo pi = new PartInfo(); PartName p = new PartName(); if(partname != null) p.set_ident(partname); else { String s = n.toString(); String ss = s.substring(0,1); ss = ss.toLowerCase(); s = s.substring(1); ss = ss + s ; Ident m = new Ident(ss); p.set_ident(m); } pi.set_partname(p); pi.set_classname(result); list.get_partclass().addElement(pi); } partname = null; } void before( Labeled host){ partname = host.get_label_name(); } }} } FindSubVisitor{ {{ void before (Vertex host){ Ident n = host.get_vertex_name(); if(list.get_subclass() == null) list.set_subclass(new ClassInfo_List()); //System.out.println(" :" + n); ClassInfo result = Cd_graph.check_undefined(n); list.get_subclass().addElement(result); } }} } FlattingVisitor{ {{ void before(ClassInfo host){ PartInfo_List partList = host.get_partclass(); //find the list of parts ClassInfo_List subList = host.get_subclass(); //find the list of subclasses if(subList != null){ //have subclasses ClassInfo subClass,parentClass; ClassInfo_List dest; java.util.Enumeration en = subList.elements(); while (en.hasMoreElements()){ subClass = (ClassInfo)en.nextElement(); Ident n = subClass.get_name().get_ident(); parentClass = subClass.get_parent(); //Single inheritance checking if(parentClass == null) subClass.set_parent(host); else { System.out.println("Error: Class " + n + " has two super classes: " + parentClass.get_name().get_ident() + " , " + host.get_name().get_ident()); Main.err_num ++; } //Flatting ClassGraph if(partList != null){ PartInfo_List list; list = subClass.get_partclass(); if(list == null){ subClass.set_partclass(partList); // System.out.println(host.get_name().get_ident() + " to " // +subClass.get_name().get_ident() + "copy list"); } else{ java.util.Enumeration enn = partList.elements(); PartInfo pi; while (enn.hasMoreElements()){ pi = (PartInfo)enn.nextElement(); // System.out.println(host.get_name().get_ident() + " to " // + subClass.get_name().get_ident() // + "copy: "+pi.get_partname().get_ident()); list.addElement(pi); } } } } host.set_partclass(null); } } }} } CheckUPartVisitor{ {{ void before(ClassInfo host){ PartInfo_List list = host.get_partclass(); if(list != null){ PartInfo source; java.util.Enumeration enn,en; en = list.elements(); Vector v = new Vector(); int len = list.size();int i=0,j; while (en.hasMoreElements()){ source = (PartInfo)en.nextElement(); v.addElement(source.get_partname().get_ident().toString()); if(len>1){ FindUCVisitor fV = new FindUCVisitor(source.get_classname().get_name().get_ident()); ClassInfo result = (ClassInfo) Cd_graph.tg_list.traverse(Cd_graph.terminal,fV); //TBR. checking if (result != null){ System.out.println("Warning: Class " + host.get_name().get_ident() +" violates TBR. Class "+ source.get_classname().get_name().get_ident() +" is not the only part class"); Main.war_num++; } } } //Unique checking String source_partname,dest_partname; while(i