private IModelNode TransformVertexRecursive(IModelNode vertex, TransformRule[] transforms)
{
var newName = transforms.Aggregate(
vertex.DisplayName,
(name, rule) => GetTransform(rule.Pattern).Replace(name, rule.Name ?? string.Empty));
var type = vertex.Type;
var linesOfCode = vertex.LinesOfCode;
var maintainabilityIndex = vertex.MaintainabilityIndex;
var cyclomaticComplexity = vertex.CyclomaticComplexity;
var quality = vertex.Quality;
var children = vertex.Children.Select(x => TransformVertexRecursive(x, transforms));
return vertex is StaticModelNode
? new StaticModelNode(
newName,
type,
quality,
linesOfCode,
maintainabilityIndex,
cyclomaticComplexity,
children.ToList())
: new ModelNode(
newName,
type,
quality,
linesOfCode,
maintainabilityIndex,
cyclomaticComplexity,
children.ToList());
}
}