Hyena.Query.QueryListNode.TakeChildren C# (CSharp) Method

TakeChildren() public method

public TakeChildren ( QueryListNode from ) : void
from QueryListNode
return void
        public void TakeChildren(QueryListNode from)
        {
            foreach (QueryNode child in from.Children) {
                AddChild (child);
            }
            from.Children.Clear ();
        }

Usage Example

        public override QueryNode Trim()
        {
            // Trim depth first
            List<QueryNode> copy = new List<QueryNode> (Children);
            foreach (QueryNode child in copy)
                child.Trim ();

            if (Keyword == Keyword.Not) {
                if (ChildCount != 1) {
                    if (Parent != null) {
                        Parent.RemoveChild (this);
                    } else {
                        return null;
                    }
                }
            } else {
                if (ChildCount <= 1) {
                    if (Parent != null) {
                        QueryListNode p = Parent;
                        p.RemoveChild (this);
                        p.TakeChildren (this);
                    } else if (ChildCount == 1) {
                        Children[0].Parent = null;
                        return Children[0];
                    }
                }
            }

            return this;
        }
All Usage Examples Of Hyena.Query.QueryListNode::TakeChildren