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