[Uml-devel] Generalizations not treated properly in jswriter or aswriter

Brian Thomas thomas at mail630.gsfc.nasa.gov
Thu Mar 6 13:50:21 UTC 2003


	Oh yeah, 

	I meant to mention that while I was checking that my hacking didnt blow up
	the other codegenerators I found that generalizations were being used
	incorrectly in the jswriter and aswriter. Here's a snippet of code:

       int i;
        UMLAssociation* association;

        for(association = generalizations.first(), i = generalizations.count();
            association && i; association = generalizations.next(), i--) {
                as << classname << ".prototype = new " << cleanName(association->getName()) << " ();" << endl;
        }

	The problem is that the generalization (association) often *doesnt* have a name, so I'd imagine
	that the codewriters will print out empty new declarations at this point. What should be used
	is the c->findSuperClassConcepts which returns a QPtrList of UMLConcept pointers. You can then
	query the name of each concept in the list to determine what ".prototype = new" stuff you have to
	print out. Optionally, you could do it the old way, which is to say, make a call to get the association
	roleB object Id, then look that up in the UMLDoc for the codewriter and thus get the name. Most of
	the other codegenerators do it this way, so I wont reprint it here. 


							-b.t.


-- 

  * Dr. Brian Thomas 

  * Code 630.1 
  * Goddard Space Flight Center NASA

  *   fax: (301) 286-1771
  * phone: (301) 286-6128

I hate quotations.
		-- Ralph Waldo Emerson





More information about the umbrello-devel mailing list