using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Xml; namespace NTERA.Engine.Compiler { [DebuggerDisplay("{Type}")] public class ExecutionNode { public string Type { get; set; } public Dictionary Metadata { get; set; } = new Dictionary(); public string Anchor { get; set; } public Marker Symbol { get; set; } public ExecutionNode[] SubNodes { get; set; } = new ExecutionNode[0]; public ExecutionNode this[string type] { get { return SubNodes.First(x => x.Type == type); } } public void WriteXml(XmlWriter writer) { writer.WriteStartElement(Type); foreach (var kv in Metadata) writer.WriteAttributeString(kv.Key, kv.Value); foreach (var node in SubNodes) node.WriteXml(writer); writer.WriteEndElement(); } } }