private AbstractTagTreeNode DeclareChildren(AbstractTagTreeNode parent, params AbstractTagTreeNode[] children) { foreach (var child in children) { parent.AddChild(child); child.ParentNode = parent; } return(parent); }
private void FlattenTree(AbstractTagTreeNode node, List <OrientedTreeNode> list) { if (node.SubNodes.Any()) { list.Add(new OrientedTreeNode(node, Direction.Left)); foreach (var child in node.SubNodes) { this.FlattenTree(child, list); } list.Add(new OrientedTreeNode(node, Direction.Right)); } else { list.Add(new OrientedTreeNode(node, Direction.None)); } }
public TagTree(string name, AbstractTagTreeNode rootNode) { this.Name = name; this.RootNode = rootNode; if (rootNode.SubNodes.Count() >= 1 && rootNode.SubNodes.First().IsAdjunction) { this.IsAdjunctionTree = AdjunctionType.Left; } else if (rootNode.SubNodes.Count() >= 2 && rootNode.SubNodes.Last().IsAdjunction) { this.IsAdjunctionTree = AdjunctionType.Right; } else if (rootNode.Any(node => node.IsAdjunction)) { this.IsAdjunctionTree = AdjunctionType.Complex; } else { this.IsAdjunctionTree = AdjunctionType.None; } }
public OrientedTreeNode(AbstractTagTreeNode node, Direction direction) { this.Node = node; this.Direction = direction; }
public void AddChild(AbstractTagTreeNode child) { this.subNodes.Add(child); }