예제 #1
0
 public CCNamespace(string name, CCNamespace parent) : base(name)
 {
     Parent = parent;
     if (parent != null)
     {
         parent.Namespaces.Add(this);
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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));
        }
예제 #4
0
        } = 0;                                                 // aka CyclomaticComplexity

        /*
         *  public int Cohesion { get; set; } = 0;
         */
        public CCClass(string name, CCNamespace parent) : base(name)
        {
            Parent = parent ?? throw new ArgumentNullException("parent");
        }