// // Utility methods for all other behaviors // Adjacency { /* * Get the source name of a Adjacency. Essentially the name of the * class being defined. */ String get_source_name() bypassing Neighbors to Vertex { before Vertex {{ return_val = host.get_vertex_name().toString(); }} } /* * Count the number of SuperClasses for a given Adjacency (class) */ int num_supers() to SuperClass { {{ int count; }} init {{ count = 0; }} before SuperClass {{ count++; }} after Adjacency {{ return_val = count; }} } /* * Count the number of Alternations (subclasses) for a given * Adjacency (class) */ int num_subs() through Term_Bar_list to Vertex { {{ int count; }} init {{ count = 0; }} before Vertex {{ count++; }} after Adjacency {{ return_val = count; }} } /* * get the list of constructs for a given Adjacency */ Any_vertex_List get_construct_list() to Neighbors_wc { before Neighbors_wc {{ return_val = host.get_construct_ns(); }} } /* * get the constructs of a given Adjacency as a Set */ Set constructs() to Any_vertex { {{ Set partSet; }} init {{ partSet = new HashSet(); }} before Any_vertex {{ partSet.add(host); }} after Adjacency {{ return_val = partSet; }} } /* * get an iterator to the set of SuperClasses */ Iterator super_iter() to SuperClass { {{ Set superSet; }} init {{ superSet = new HashSet(); }} before SuperClass {{ superSet.add(host); }} after Adjacency {{ return_val = superSet.iterator(); }} } } Cd_graph { /* * print out the number of superclasses for all classes in CD */ void print_num_supers() to Adjacency { before Adjacency {{ System.out.println(host.get_source_name() + " has " + host.num_supers() + " super class(es)."); }} } /* * get the class in the CD with a given name */ Adjacency get_class(String name) to Adjacency { before Adjacency {{ //System.out.println(name +","+host.get_source_name()); if (name.equalsIgnoreCase(host.get_source_name())) { //System.out.println("MATCH"); return_val = host; } }} } } Opt_labeled_term { /* * get the class name for a given construct */ String get_class_name() to Vertex { before Vertex {{ return_val = host.get_vertex_name().toString(); }} } }