Cd_graph { {{ HashSet definedClasses = new HashSet(); // Collection of defined classes // These collections will prevent duplicate error messages from being displayed HashSet undefinedClasses = new HashSet(); // Collection of undefined classes HashSet duplicateDefined = new HashSet(); // Collection of classes defined more than once public void findDefinedClasses(final ClassGraph cg) { /* Traverse to all defined classes and create a hashset of defined classes */ Strategy sg = new Strategy("from Cd_graph bypassing Neighbors to Vertex"); definedClasses = (HashSet) cg.traverse( this, sg, new Visitor() { HashSet h; public void start(){h = new HashSet();} public void before( Vertex host ) { Ident vname = host.get_vertex_name(); if (h.contains(vname)) {// Check for multiple definitions if(!duplicateDefined.contains(vname)) System.out.println(" *** ERROR: Class " + vname + " is defined more than once in the class dictionary."); duplicateDefined.add(vname); } else { // Add to the hashSet of defined classes h.add(vname); } } public Object getReturnValue(){return h;} }); // End traversal }// End function }} }