// The program eliminates all SyntaxVertex-objects from // a class dictionary Cd_graph{ {{ void removeSyntax(ClassGraph cg){ String beforeListsToBeEmptied = "from Cd_graph to {Kernel_Sandwich, Term_Sandwich}"; cg.traverse(this, beforeListsToBeEmptied, new ListEmptyingVisitor()); String whatToKeepInList = "from Cd_graph bypassing Syntax_vertex to Any_vertex"; cg.traverse(this, whatToKeepInList, new ListEditingVisitor()); } }} } ListEmptyingVisitor{ {{ public void before(Kernel_Sandwich target) { target.set_first(new Syntax_vertex_List()); //set both lists empty target.set_second(new Syntax_vertex_List()); } public void before(Term_Sandwich target) { target.set_first(new Syntax_vertex_List()); //set both lists empty target.set_second(new Syntax_vertex_List()); } }} } ListEditingVisitor { {{ private Any_vertex_List list; public void before(Neighbors_wc a) { list=new Any_vertex_List(); } public void before(Any_vertex a) { list.addElement(a); System.out.println("non syntax element added"); a.print(); System.out.println(); } public void after(Neighbors_wc a) { a.set_construct_ns(list); } }} }