コード例 #1
0
        void Build(CrefNode n, int depth)
        {
            if (TotalNodeCnt++ > CREF_TOTAL_ELEMENT_COUNT)
            {
                return;
            }

            //Progress_indication(false); // Update UI

            depth--;
            if ((depth == 0))
            {
                //Debug.WriteLineIf(DEBUG, "Depth limit exceeded..");
                return;
            }
            //Debug.WriteLineIf(DEBUG, "depth: " + depth.ToString());
            /* If the node already exists in the tree, forget it */
            if (!IsUnique(n, n.Parent))
            {
                //Debug.WriteLineIf(DEBUG, "Discarding: " + n.Module.ToString());
                return;
            }
            List <CrefNode> c = FindChildren(n);

            n.Children = c;
            foreach (CrefNode k in c)
            {
                k.Parent = n;
                Build(k, depth);
            }
        }
コード例 #2
0
        List <CrefNode> FindChildren(CrefNode n)
        {
            List <string>   nodes  = cref.FindUsers(n.Module);
            List <CrefNode> childs = new List <CrefNode>();

            for (int i = 0; i < nodes.Count; i++)
            {
                childs.Add(new CrefNode(nodes[i]));
            }
            return(childs);
        }
コード例 #3
0
 /// <summary>
 /// Walk the current path and see if any node contains this element
 /// </summary>
 /// <param name="n"> The node which could have been duplicated in the tree </param>
 /// <param name="p"> The next parent </param>
 /// <returns></returns>
 bool IsUnique(CrefNode n, CrefNode p)
 {
     if (p == null)
     {
         return(true);
     }
     if (n.Module == p.Module)
     {
         return(false);
     }
     else
     {
         return(IsUnique(n, p.Parent));
     }
 }
コード例 #4
0
        void Build(CrefNode n)
        {
            if (TotalNodeCnt++ > CREF_MAX_DEPS_DEPTH)
            {
                return;
            }
            /* If the node already exists in the tree, forget it */
            if (!IsUnique(n, n.Parent))
            {
                //Debug.WriteLineIf(DEBUG, "Discarding: " + n.Module.ToString());
                return;
            }
            List <CrefNode> c = FindChildren(n);

            n.Children = c;
            foreach (CrefNode k in c)
            {
                k.Parent = n;
                Build(k);
            }
        }
コード例 #5
0
 public CrefNode(string name)
 {
     Module   = name;
     Children = new List <CrefNode>();
     Parent   = null;
 }