예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AreaIterationNode"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="path">The path.</param>
 /// <param name="nodeId">The node id.</param>
 /// <param name="rootNode">The root node.</param>
 public AreaIterationNode(string name, string path, string nodeId, IAreaIterationNode rootNode)
 {
     Name     = name;
     Path     = path;
     NodeID   = nodeId;
     RootNode = rootNode;
 }
예제 #2
0
        /// <summary>
        /// Flattens the hierarchy.
        /// </summary>
        /// <param name="node">The root node of the recursion.</param>
        /// <returns>A List of all descendants in the tree.</returns>
        private IEnumerable <IAreaIterationNode> FlattenHierarchy(IAreaIterationNode node)
        {
            yield return(node);

            if (node.Childs != null)
            {
                foreach (var child in node.Childs)
                {
                    foreach (var childOrDescendant in child.FlattenHierarchy())
                    {
                        yield return(childOrDescendant);
                    }
                }
            }
        }