XMLVisitor { {{ void around( Alternat_ns host, SubTraverser subtraversal) { } void before(Adjacency host){ String hostname = host.get_source().get_vertex_name().toString(); Regular_syntax xmlfname = new Regular_syntax("<"+hostname+">"); Regular_syntax xmlename = new Regular_syntax(""); Any_vertex_List hlist = ((Neighbors_wc) host.get_ns()).get_construct_ns(); Nonempty_Any_vertex_List contents = hlist.get_first(); Nonempty_Any_vertex_List prev = null; for(int i=0; i < hlist.size();i++){ Any_vertex keep = (Any_vertex) contents.get_it(); // If it is found reconstruct the linked list // depending on where it is in the structure if (keep instanceof Syntax_vertex){ if (prev == null){ if (contents.get_next() == null){ contents = null; hlist.set_first(contents); } else { contents = contents.get_next(); hlist.set_first(contents); } } else { if(contents.get_next() != null) { contents = contents.get_next(); prev.set_next(contents); } else prev.set_next(null); } } // If not found yet and can go to next do it if (contents.get_next() != null){ prev = contents; contents = contents.get_next(); } } // Pushes XML style on each Adjacency Neighbors_wc test = (Neighbors_wc) host.get_ns(); if(test instanceof Construct_ns){ hlist.push(xmlfname); hlist.addElement(xmlename); } // Print out the adjacency host.print(); } }} }