public CCNamespace(string name, CCNamespace parent) : base(name) { Parent = parent; if (parent != null) { parent.Namespaces.Add(this); } }
public void EnsureClass(string nameOfNamespace, string nameOfClass) { CCNamespace ns = EnsureNamespace(nameOfNamespace); CCClass c = new CCClass(nameOfClass, ns); if (!ns.Classes.Contains(c)) { ns.Classes.Add(c); } }
public CCNamespace EnsureNamespace(string nameOfNamespace) { CCNamespace parent = null; foreach (var segment in Regex.Split(nameOfNamespace, "\\.")) { string fullName = parent != null?string.Join(".", parent.Name, segment) : segment; var ns = Namespaces.Find(d => d.Name.Equals(fullName)); if (ns == null) { ns = new CCNamespace(fullName, parent); Namespaces.Add(ns); } parent = ns; } return(GetNamespaceByName(nameOfNamespace)); }
} = 0; // aka CyclomaticComplexity /* * public int Cohesion { get; set; } = 0; */ public CCClass(string name, CCNamespace parent) : base(name) { Parent = parent ?? throw new ArgumentNullException("parent"); }