The code in this section demonstrates some scenarios with Dependency Matrix tool. The code may not be executable or may not return a correct result. The purpose is to show you how to use Generic Table tool and how it works.
Prints the row, column and its relationship name.
#foreach ($diagram in $project.getDiagrams("Dependency Matrix")) #set ($matrix = $depmatrix.getMatrix($diagram)) #foreach ($row in $matrix.getRows()) #foreach ($col in $matrix.getColumns()) #foreach ($rel in $matrix.getRelation($row, $col)) $row.name has $rel.name with $col.name #end #end #end #end
Counts the number of relations of column elements.
#foreach ($diagram in $project.getDiagrams("Dependency Matrix")) #set ($matrix = $depmatrix.getMatrix($diagram)) #foreach ($col in $matrix.getColumns()) #set ($count = 0) #foreach ($row in $matrix.getRows()) #set ($numberOfrelation = $matrix.getRelation($row, $col).size()) #set ($count = $count + $numberOfrelation) #end $col.name has $count relations #end #end