// // Append SuperClass info // Cd_graph { /* * Algorithm for created Super Class info: * 1. Go through all Class definitions to find definitions of * alternations * 2. for each alternation, store name of SuperClass in Map * 3. Go through all Class definitions again, storing contents of Map * into the class */ void add_supers() {{ disperse_supers(find_supers()); }} /* * Put all super classes into a map by their subclass */ HashMap find_supers() through Term_Bar_list to Vertex { {{ HashMap m; String adj_name; }} init {{ m = new HashMap(); }} before Adjacency {{ adj_name = host.get_source_name(); }} before Vertex {{ if (m.containsKey(host.get_vertex_name().toString())) { String s=(String)m.get(host.get_vertex_name().toString()); s = s + "," + adj_name; m.put(host.get_vertex_name().toString(),s); } else { m.put(host.get_vertex_name().toString(), adj_name); } }} after Cd_graph {{ return_val = m; }} } /* * disperse the superclass info to all classes */ void disperse_supers(HashMap m) to Adjacency { before Adjacency {{ if (m.containsKey(host.get_source_name())) { SuperClasses s = SuperClasses.parse((String) m.get(host.get_source_name())); host.set_supers(s); } }} } }