//checks for undefined classes Cd_graph{ //returns "true" if no undefined classes. boolean checkUndefined(ClassGraph cg){{ System.out.println("Checking for Undefined Classes. . ."); return checkDefined(cg, getClasses(cg)); }} HashSet getClasses(ClassGraph cg){{ Strategy getAll = new Strategy("from Cd_graph bypassing Neighbors to Vertex"); TraversalGraph tg = new TraversalGraph(getAll, cg); return (HashSet)tg.traverse(this, new Visitor(){ HashSet return_val = new HashSet(); void before(Vertex v){ return_val.add(v.get_vertex_name()); } public Object getReturnValue(){ return return_val; } }); }} boolean checkDefined(ClassGraph cg, HashSet tempClassSet){{ final HashSet classHash = tempClassSet; Strategy checkAll = new Strategy("from Cd_graph through Neighbors to Vertex"); TraversalGraph tg = new TraversalGraph(checkAll, cg); return ((Boolean)tg.traverse(this, new Visitor(){ boolean return_val = true; void before(Vertex v){ if(!classHash.contains(v.get_vertex_name())){ System.out.println("ERROR: The class "+ v.get_vertex_name() + " is undefined."); return_val = false; } } public Object getReturnValue(){ return new Boolean(return_val); } } )).booleanValue(); }} }