Skip to content

Commit

Permalink
added calculation of ncc & fixed xsl formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
starkda committed Mar 25, 2024
1 parent d051565 commit d62314d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/main/resources/org/jpeek/metrics/CCM.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ SOFTWARE.
</xsl:for-each>
</xsl:for-each>
</xsl:variable>

<xsl:variable name="graph">
<xsl:for-each select="$methods">
<xsl:variable name="method" select="."/>
Expand All @@ -81,7 +80,6 @@ SOFTWARE.
</node>
</xsl:for-each>
</xsl:variable>

<xsl:variable name="result">
<xsl:for-each select="$graph/node">
<xsl:variable name="root" select="."/>
Expand All @@ -101,22 +99,19 @@ SOFTWARE.
</xsl:element>
</xsl:for-each>
</xsl:variable>

<xsl:variable name="counts">
<!-- Iterate over each group -->
<xsl:for-each-group select="$result/group" group-by="@id">
<xsl:variable name="groupId" select="current-grouping-key()"/>
<xsl:variable name="minValue">
<xsl:perform-sort select="current-group()/edge">
<xsl:sort select="./text()" order="ascending"/>
<xsl:sort select="./text()"/>
</xsl:perform-sort>
</xsl:variable>
<minValue><xsl:value-of select="$minValue/edge[1]/text()"/></minValue>
<minValue>
<xsl:value-of select="$minValue/edge[1]/text()"/>
</minValue>
</xsl:for-each-group>
</xsl:variable>

<xsl:copy>

<xsl:variable name="nc" select="count($edges/edge) div 2"/>
<xsl:variable name="ncc" select="count(distinct-values($counts/minValue/text()))"/>
<xsl:variable name="nmp" select="(count($methods) * (count($methods) - 1)) div 2"/>
Expand Down Expand Up @@ -144,7 +139,6 @@ SOFTWARE.
<var id="nmp">
<xsl:value-of select="$nmp"/>
</var>

</vars>
</xsl:copy>
</xsl:template>
Expand Down

0 comments on commit d62314d

Please sign in to comment.