Example #1
0
        /// <summary>
        /// Removes the child at the given index.
        /// </summary>
        /// <param name="index">The index of the child to remove.</param>
        /// <returns>Returns the node that is removed.</returns>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the index provided is out of bounds.</exception>
        public virtual Node <M> RemoveChild(int index)
        {
            if (InnerNode != null)
            {
                return(InnerNode.RemoveChild(index));
            }

            if (Terminal)
            {
                throw new ArgumentOutOfRangeException("Terminal nodes have no children.");
            }

            Node <M> ret = children[index];

            children.RemoveAt(index);

            return(ret);
        }