コード例 #1
0
 public T GetFirstParentOfType <T>(TTreeNode start, Predicate <T> predicate = null, bool includeRoot = true, bool canTypeBeAncestor = true, LevelRestriction depthLimits = null)
     where T : class, TTreeNode
 {
     return(TreeTraversal <TTreeNode> .GetFirstParentOfType(this.Root, start, predicate, includeRoot, canTypeBeAncestor, depthLimits, this.GetChildrenOverride, this.GetParentOverride));
 }
コード例 #2
0
 public TTreeNode NodeAt(TreeNodePath nodePath)
 {
     return(TreeTraversal <TTreeNode> .NodeAt(this.Root, nodePath, this.GetChildrenOverride, this.GetParentOverride));
 }
コード例 #3
0
 public T GetFirstChildOfType <T>(Predicate <T> predicate = null, bool includeRoot = true, eTraversalFlowDirection flowDirection = TreeTraversal <TTreeNode> .DefaultTraversalFlowDirection, eTraversalStrategy strategy = TreeTraversal <TTreeNode> .DefaultTraversalStrategy, bool canTypeBeAncestor = true, LevelRestriction depthLimits = null)
     where T : class, TTreeNode
 {
     return(TreeTraversal <TTreeNode> .GetFirstChildOfType(this.Root, this.Root, predicate, flowDirection, strategy, includeRoot, canTypeBeAncestor, depthLimits, this.GetChildrenOverride, this.GetParentOverride));
 }
コード例 #4
0
 public TTreeNode GetFirstParentWhichPasses(TTreeNode start, Predicate <TTreeNode> predicate, bool includeRoot = true, LevelRestriction depthLimits = null)
 {
     return(TreeTraversal <TTreeNode> .GetFirstParentWhichPasses(this.Root, start, predicate, includeRoot, depthLimits, this.GetChildrenOverride, this.GetParentOverride));
 }
コード例 #5
0
 public TTreeNode GetFirstChildWhichPasses(TTreeNode start, Predicate <TTreeNode> predicate, eTraversalFlowDirection flowDirection = TreeTraversal <TTreeNode> .DefaultTraversalFlowDirection, eTraversalStrategy strategy = TreeTraversal <TTreeNode> .DefaultTraversalStrategy, bool includeRoot = true, LevelRestriction depthLimits = null)
 {
     return(TreeTraversal <TTreeNode> .GetFirstChildWhichPasses(this.Root, start, predicate, flowDirection, strategy, includeRoot, depthLimits, this.GetChildrenOverride, this.GetParentOverride));
 }
コード例 #6
0
 public TreeIter <TTreeNode> IteratorAt(TreeNodePath nodePath, Predicate <TTreeNode> predicate = null, eTraversalFlowDirection flowDirection = TreeTraversal <TTreeNode> .DefaultTraversalFlowDirection, eTraversalStrategy strategy = TreeTraversal <TTreeNode> .DefaultTraversalStrategy, bool includeRoot = true, LevelRestriction depthLimits = null)
 {
     return(TreeTraversal <TTreeNode> .IteratorAt(this.Root, nodePath, predicate, flowDirection, strategy, includeRoot, depthLimits, this.GetChildrenOverride, this.GetParentOverride));
 }
コード例 #7
0
 /// <summary>
 /// Returns an enumerable of all nodes in the tree
 /// </summary>
 /// <param name="startNode">The node on the tree to start at</param>
 /// <param name="flowDirection">The traversal direction</param>
 /// <param name="strategy">The traversal strategy (BFS or DFS)</param>
 /// <param name="includeRoot">Should the root node be included</param>
 /// <returns></returns>
 public IEnumerable <TTreeNode> All(TTreeNode startNode, eTraversalFlowDirection flowDirection = TreeTraversal <TTreeNode> .DefaultTraversalFlowDirection, eTraversalStrategy strategy = TreeTraversal <TTreeNode> .DefaultTraversalStrategy, bool includeRoot = true)
 {
     return(TreeTraversal <TTreeNode> .All(startNode ?? this.Root, flowDirection, strategy, includeRoot, this.GetChildrenOverride, this.GetParentOverride));
 }
コード例 #8
0
 /// <summary>
 /// Creates a customizable tree iterator
 /// </summary>
 /// <param name="startNode">The node of the tree to start at, or null to start at the root</param>
 /// <param name="traversalParameters">The custom parameters used to control the traversal</param>
 /// <returns>The iterator that was created</returns>
 public TreeIter <TTreeNode> CreateIterator(TTreeNode startNode, TreeTraversalParameters <TTreeNode> traversalParameters)
 {
     traversalParameters.Root = this.Root;
     traversalParameters.SetGetChildrenGetParentOverrideMethods(this.GetChildrenOverride, this.GetParentOverride);
     return(TreeTraversal <TTreeNode> .CreateIterator(startNode ?? this.Root, traversalParameters));
 }
コード例 #9
0
        // -----------------------------------------------------------------------------------------------------------------------------------------------------
        // =====================================[ Public Instance Functions of TreeTraverser Utilities ] =======================================================
        // -----------------------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Creates a basic tree iterator
        /// </summary>
        /// <param name="startNode">The node of the tree to start at (or null to start at the root)</param>
        /// <param name="flowDirection">The direction to flow through the tree</param>
        /// <param name="strategy">The traversal strategy to use</param>
        /// <returns>The iterator that was created</returns>
        public TreeIter <TTreeNode> CreateIterator(TTreeNode startNode = null, eTraversalFlowDirection flowDirection = TreeTraversal <TTreeNode> .DefaultTraversalFlowDirection, eTraversalStrategy strategy = TreeTraversal <TTreeNode> .DefaultTraversalStrategy)
        {
            return(TreeTraversal <TTreeNode> .CreateIterator(this.Root, startNode, flowDirection, strategy, this.GetChildrenOverride, this.GetParentOverride));
        }