From: Chris M. <zm...@us...> - 2001-07-21 23:01:37
|
Update of /cvsroot/kuml/kuml/libkuml/uml/tools In directory usw-pr-cvs1:/tmp/cvs-serv1929 Modified Files: gen_class_ccs.xsl Log Message: A or B end of association resolved. Index: gen_class_ccs.xsl =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/uml/tools/gen_class_ccs.xsl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** gen_class_ccs.xsl 2001/07/09 22:38:30 1.4 --- gen_class_ccs.xsl 2001/07/21 23:01:33 1.5 *************** *** 503,506 **** --- 503,519 ---- + <xsl:template match="Model:AssociationEnd" mode="a_or_b_end_of_ref"> + <xsl:choose> + <!-- Is this end the A end? --> + <xsl:when test='@xmi.id = ../Model:AssociationEnd[position()=1]/@xmi.id'> + <xsl:text>A_END</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>B_END</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="REFERENCE"> *************** *** 544,547 **** --- 557,565 ---- <xsl:variable name="assoc_end_ref" select="@referencedEnd"/> + <xsl:variable name="end_a_or_b"> + <xsl:apply-templates mode="a_or_b_end_of_ref" + select='/descendant::Model:AssociationEnd[@xmi.id=$assoc_end_ref]'/> + </xsl:variable> + <!-- The value of the name attribute of a Model:Association descendant of the root node, which contains the referenced AssociationEnd. *************** *** 600,603 **** --- 618,625 ---- <xsl:text> </xsl:text> + <xsl:text>// A OR B END </xsl:text> + <xsl:value-of select="$end_a_or_b"/> + <xsl:text> </xsl:text> + <xsl:text>// BASE ASSOC NAME </xsl:text> <xsl:value-of select="$base_assoc_name"/> *************** *** 876,884 **** <xsl:text>::</xsl:text> <xsl:value-of select="$assoc_name"/> ! <xsl:text>_ptr assoc_proxy = cp-></xsl:text> <xsl:value-of select="$lc_assoc_name"/> <xsl:text>_ref(); </xsl:text> ! <xsl:text> assoc_proxy->add( new_element, _this() ); </xsl:text> <xsl:text>} </xsl:text> --- 898,915 ---- <xsl:text>::</xsl:text> <xsl:value-of select="$assoc_name"/> ! <xsl:text>_ptr assoc_proxy = </xsl:text> ! ! <xsl:text> cp-></xsl:text> <xsl:value-of select="$lc_assoc_name"/> <xsl:text>_ref(); </xsl:text> ! <xsl:choose> ! <xsl:when test='$end_a_or_b = "A_END"'> ! <xsl:text> assoc_proxy->add( new_element, _this() ); </xsl:text> ! </xsl:when> ! <xsl:otherwise> ! <xsl:text> assoc_proxy->add( _this(), new_element ); </xsl:text> ! </xsl:otherwise> ! </xsl:choose> <xsl:text>} </xsl:text> *************** *** 930,934 **** <xsl:text> assoc_proxy->add_before_</xsl:text> <xsl:value-of select="$ref_name"/> ! <xsl:text>(new_element, _this(), before_element); </xsl:text> <xsl:text>} </xsl:text> --- 961,972 ---- <xsl:text> assoc_proxy->add_before_</xsl:text> <xsl:value-of select="$ref_name"/> ! <xsl:choose> ! <xsl:when test='$end_a_or_b = "A_END"'> ! <xsl:text>(new_element, _this(), before_element); </xsl:text> ! </xsl:when> ! <xsl:otherwise> ! <xsl:text>(_this(), new_element, before_element); </xsl:text> ! </xsl:otherwise> ! </xsl:choose> <xsl:text>} </xsl:text> *************** *** 978,982 **** <xsl:text> assoc_proxy->modify_</xsl:text> <xsl:value-of select="$ref_name"/> ! <xsl:text>(old_element, _this(), new_element); </xsl:text> <xsl:text>} </xsl:text> --- 1016,1027 ---- <xsl:text> assoc_proxy->modify_</xsl:text> <xsl:value-of select="$ref_name"/> ! <xsl:choose> ! <xsl:when test='$end_a_or_b = "A_END"'> ! <xsl:text>(old_element, _this(), new_element); </xsl:text> ! </xsl:when> ! <xsl:otherwise> ! <xsl:text>(_this(), old_element, new_element); </xsl:text> ! </xsl:otherwise> ! </xsl:choose> <xsl:text>} </xsl:text> *************** *** 1019,1023 **** <xsl:text>_ref(); </xsl:text> ! <xsl:text> assoc_proxy->remove( old_element, _this() ); </xsl:text> <xsl:text>} </xsl:text> --- 1064,1075 ---- <xsl:text>_ref(); </xsl:text> ! <xsl:choose> ! <xsl:when test='$end_a_or_b = "A_END"'> ! <xsl:text> assoc_proxy->remove( old_element, _this() ); </xsl:text> ! </xsl:when> ! <xsl:otherwise> ! <xsl:text> assoc_proxy->remove( _this(), old_element ); </xsl:text> ! </xsl:otherwise> ! </xsl:choose> <xsl:text>} </xsl:text> |