Beispiel #1
0
 protected InheritanceNode(InheritanceNode parent, IInterface @interface, InheritanceNodeType nodeType, IEnumerable <InheritanceNode> childs)
 {
     this.Parent    = parent;
     this.Interface = @interface;
     this.NodeType  = nodeType;
     if (childs != null)
     {
         childList.AddRange(childs);
     }
 }
Beispiel #2
0
        public void RebuildTree(bool rebuildPaths)
        {
            if (!treeRebuilded)
            {
                treeRebuilded = true;
            }

            var interfacesIterator = new GenericTreeIterator <IInterface>(@interface => @interface.GetCurrentLevelInheritedInterfaces());

            interfacesIterator.IterateTree(true, this.Interface, delegate(GenericTreeIterationArgs <IInterface, InheritanceNode> iterationArgs)
            {
                if (iterationArgs.CurrentStage == GenericTreeIterationStage.Leave)
                {
                    iterationArgs.Data = null;
                }
                else
                {
                    var childs = iterationArgs.Current.GetCurrentLevelInheritedInterfaces();

                    InheritanceNodeType nodeType = childs.Count() == 0
                                                       ? InheritanceNodeType.SuperRoot
                                                       : InheritanceNodeType.Node;

                    InheritanceNode parentNode = iterationArgs.Data ?? this;

                    InheritanceNode newNode = CreateNode(nodeType, parentNode, iterationArgs.Current, null);
                    parentNode.AddChild(newNode);

                    iterationArgs.Data = newNode;
                }
            });

            pathsRebuilded = false;

            if (rebuildPaths)
            {
                RebuildPaths();
            }
        }
Beispiel #3
0
 internal static InheritanceNode CreateNode(InheritanceNodeType nodeType, InheritanceNode parent, IInterface @interface, IEnumerable <InheritanceNode> childs)
 {
     return(new InheritanceNode(parent, @interface, nodeType, childs));
 }