1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Text;
|
---|
4 |
|
---|
5 | namespace Netron.Diagramming.Core.Analysis
|
---|
6 | {
|
---|
7 | /// <summary>
|
---|
8 | /// This interface describes the additional members useful if the underlying graph is a tree.
|
---|
9 | /// </summary>
|
---|
10 | public interface ITree : IGraph
|
---|
11 | {
|
---|
12 |
|
---|
13 | /// <summary>
|
---|
14 | /// Gets or sets a value indicating whether this tree is directed.
|
---|
15 | /// </summary>
|
---|
16 | /// <value>
|
---|
17 | /// <c>true</c> if this instance is directed; otherwise, <c>false</c>.
|
---|
18 | /// </value>
|
---|
19 | bool IsDirected { get; set;}
|
---|
20 | /// <summary>
|
---|
21 | /// Gets or sets the root of the tree
|
---|
22 | /// </summary>
|
---|
23 | INode Root { get;set;}
|
---|
24 | /// <summary>
|
---|
25 | /// Gets the children of the given node in the tree hierarchy.
|
---|
26 | /// </summary>
|
---|
27 | /// <param name="node"></param>
|
---|
28 | /// <returns></returns>
|
---|
29 | CollectionBase<INode> Children(INode node);
|
---|
30 | /// <summary>
|
---|
31 | /// Gets the edges connecting the children of the given node.
|
---|
32 | /// </summary>
|
---|
33 | /// <param name="node"></param>
|
---|
34 | /// <returns></returns>
|
---|
35 | CollectionBase<IEdge> ChildEdges(INode node);
|
---|
36 |
|
---|
37 | /// <summary>
|
---|
38 | /// Returns the next sibling node of the given node.
|
---|
39 | /// </summary>
|
---|
40 | /// <param name="node">The node.</param>
|
---|
41 | /// <returns></returns>
|
---|
42 | INode NextSibling(INode node);
|
---|
43 |
|
---|
44 | /// <summary>
|
---|
45 | /// Returns the previous sibling node of the given node.
|
---|
46 | /// </summary>
|
---|
47 | /// <param name="node">The node.</param>
|
---|
48 | /// <returns></returns>
|
---|
49 | INode PreviousSibling(INode node);
|
---|
50 |
|
---|
51 | /// <summary>
|
---|
52 | /// Returns the last child of the given node.
|
---|
53 | /// </summary>
|
---|
54 | /// <param name="node">The node.</param>
|
---|
55 | /// <returns></returns>
|
---|
56 | INode LastChild(INode node);
|
---|
57 |
|
---|
58 | /// <summary>
|
---|
59 | /// Returns the first child of the given node.
|
---|
60 | /// </summary>
|
---|
61 | /// <param name="node">The node.</param>
|
---|
62 | /// <returns></returns>
|
---|
63 | INode FirstChild(INode node);
|
---|
64 | /// <summary>
|
---|
65 | /// Returns how many children the given node has.
|
---|
66 | /// </summary>
|
---|
67 | /// <param name="node">The node.</param>
|
---|
68 | /// <returns></returns>
|
---|
69 | int ChildCount(INode node);
|
---|
70 | /// <summary>
|
---|
71 | /// Returns the depth the specified node.
|
---|
72 | /// </summary>
|
---|
73 | /// <param name="node">The node.</param>
|
---|
74 | /// <returns></returns>
|
---|
75 | int Depth(INode node);
|
---|
76 | /// <summary>
|
---|
77 | /// Returns the parent edge of the given node.
|
---|
78 | /// </summary>
|
---|
79 | /// <param name="node">The node.</param>
|
---|
80 | /// <returns></returns>
|
---|
81 | IEdge ParentEdge(INode node);
|
---|
82 | /// <summary>
|
---|
83 | /// Executes a the given <see cref="System.Action"/> on each node, starting from the given node, by means of a traversal
|
---|
84 | /// </summary>
|
---|
85 | /// <param name="action">The action.</param>
|
---|
86 | /// <param name="startNode">The start node.</param>
|
---|
87 | void ForEach<T>(Action<T> action, INode startNode) where T : INode;
|
---|
88 | }
|
---|
89 | }
|
---|