public static Link[] GetLinks(string dot, Node[] nodes) { var regex = new Regex(@"(?<from>[a-zA-Z0-9_]+)[ \t]*->[ \t]*(?<to>[a-zA-Z0-9_]+)[ \t]*\[[^\]]+\]"); var links = from m in regex.Matches(dot).OfType<Match>() let f = m.Groups["from"].Value let t = m.Groups["to"].Value select new Link(nodes.First(n => n.Name == f), nodes.First(n => n.Name == t)); return links.ToArray(); }
static IEnumerable<PDFObject> HandleNode(Node node) { yield return new Box(node.BoxSize) { Offset = node.BoxOffset }; yield return new TextLine(Node.Font) { Alignment = TextAlignment.Center, Text = node.Label, Offset = node.TextOffset }; switch (node.NodeType) { case Node.NodeTypes.AND: yield return new AndGate(node.GateSize.Y) { Offset = node.GateOffset }; break; case Node.NodeTypes.OR: yield return new OrGate(node.GateSize.Y) { Offset = node.GateOffset }; break; } }
public Link(Node from, Node to) { this.from = from; this.to = to; }