예제 #1
0
파일: Node.cs 프로젝트: Julien-Pires/Pulsar
        /// <summary>
        /// Add a child
        /// </summary>
        /// <param name="child">Node to add as a child</param>
        public void AddChild(Node child)
        {
            if (child == null) throw new ArgumentNullException("child");
            if (child._parentNode != null)
            {
                if (child._parentNode != this) throw new ArgumentException("", "child");

                return;
            }

            Childrens.Add(child);
            child.SetParent(this);
        }
예제 #2
0
파일: Node.cs 프로젝트: Julien-Pires/Pulsar
        /// <summary>
        /// Remove a child
        /// </summary>
        /// <param name="child">Child to remove</param>
        /// <returns></returns>
        public bool RemoveChild(Node child)
        {
            if(child._parentNode != this) throw new ArgumentException("", "child");

            Childrens.Remove(child);
            child.SetParent(null);

            return true;
        }