Пример #1
0
        /// <summary>
        /// Sets the specified element in the current random access list to the
        /// specified value.
        /// </summary>
        /// <param name="value">
        /// The new value for the specified element.
        /// </param>
        /// <param name="index">
        /// An integer that represents the position of the random access list
        /// element to set.
        /// </param>
        /// <returns>
        /// A new random access list top node with the element at the specified
        /// position set to the specified value.
        /// </returns>
        public RalTopNode SetValue(object value, int index)
        {
            RalTopNode result;

            // If the element is in the tree represented by the current top
            // node.
            if (index < Root.Count)
            {
                // Descend into the tree.
                result = new RalTopNode(
                    root.SetValue(value, index),
                    NextNode);
            }
            // Else the element is further along in the list.
            else
            {
                // Move to the next top node.
                result = new RalTopNode(
                    root,
                    NextNode.SetValue(value, index - Root.Count));
            }

            return(result);
        }