Пример #1
0
        private AbstractTagTreeNode DeclareChildren(AbstractTagTreeNode parent, params AbstractTagTreeNode[] children)
        {
            foreach (var child in children)
            {
                parent.AddChild(child);
                child.ParentNode = parent;
            }

            return(parent);
        }
Пример #2
0
        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));
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
 public OrientedTreeNode(AbstractTagTreeNode node, Direction direction)
 {
     this.Node      = node;
     this.Direction = direction;
 }
Пример #5
0
 public void AddChild(AbstractTagTreeNode child)
 {
     this.subNodes.Add(child);
 }