// partname.beh -- Part name construction // $Id: partname.beh,v 1.1 1998/03/11 22:28:08 dougo Exp $ Program { /** Fill in any missing part names by lowercasing the name of the part class. */ private void fillInPartNames() = allParts { before Part (@ if (host.get_partname() == null) { String newname = host.get_classname().basename().toLowerCase(); host.set_partname(PartName.parse(newname)); } @) } } ClassName { String basename() (@ String s = toString(); return s.substring(s.lastIndexOf(".") + 1); @) } Program { /** Fill in any missing visitor names. */ void fillInVisitorNames() to-stop TraversalDef { before TraversalDef (@ host.fillInVisitorNames(); @) } } TraversalDef { /** Fill in any missing visitor names. */ void fillInVisitorNames() via TraversalParms to Visitor { (@ int i; @) before TraversalParms (@ i = 0; @) before Visitor (@ if (host.get_visitorname() == null) { String newname = "__v" + (i++); host.set_visitorname(VisitorName.parse(newname)); } @) } }