-
Notifications
You must be signed in to change notification settings - Fork 0
/
Node.cs
36 lines (32 loc) · 942 Bytes
/
Node.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma warning disable
using System.Runtime.CompilerServices;
namespace libdag
{
public class Node
{
public enum NodeStatus
{
Created,
Started,
Completed,
Failed,
ChildFailed
}
public bool IsRoot { get; private set; }
public string NodeId { get; private set; }
public Dictionary<string, Node> ParentNodes = new Dictionary<string, Node>();
public Dictionary<string, Node> ChildNodes = new Dictionary<string, Node>();
public NodeStatus Status
{
get;
[MethodImpl(MethodImplOptions.Synchronized)]
set;
} = NodeStatus.Created;
public void AddParent(Node parent)
{
IsRoot = false;
ParentNodes[parent.NodeId] = parent;
parent.ChildNodes[NodeId] = this;
}
}
}