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

RemoveChild() public method

public RemoveChild ( QueryNode child ) : void
child QueryNode
return void
        public void RemoveChild(QueryNode child)
        {
            child.Parent = null;
            children.Remove(child);
        }

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;
        }