Ejemplo n.º 1
0
        /// <summary>
        /// Inserts text into this rope.
        /// Runs in O(lg N + M).
        /// </summary>
        /// <exception cref="ArgumentNullException">newElements is null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">index or length is outside the valid range.</exception>
        public static void InsertText(this Rope <char> rope, int index, string text)
        {
            if (rope == null)
            {
                throw new ArgumentNullException("rope");
            }
            rope.InsertRange(index, text.ToCharArray(), 0, text.Length);

            /*if (index < 0 || index > rope.Length) {
             *      throw new ArgumentOutOfRangeException("index", index, "0 <= index <= " + rope.Length.ToString(CultureInfo.InvariantCulture));
             * }
             * if (text == null)
             *      throw new ArgumentNullException("text");
             * if (text.Length == 0)
             *      return;
             * rope.root = rope.root.Insert(index, text);
             * rope.OnChanged();*/
        }