Exemple #1
0
 /// <summary>
 /// Clears all the objects in this instance.
 /// </summary>
 /// <remarks>
 /// <b>Notes to Inheritors: </b>
 ///  Derived classes can override this method to change the behavior of the <see cref="Clear"/> method.
 /// </remarks>
 protected virtual void ClearItems()
 {
     tree  = null;
     Count = 0;
 }
Exemple #2
0
        /// <summary>
        /// Finds the maximum node.
        /// </summary>
        /// <param name="startNode">The start node.</param>
        /// <param name="parent">The parent of the node found.</param>
        /// <returns>The maximum node underneath the node specified.  If the node specified is a leaf node, it is returned.</returns>
        private static BinaryTree <KeyValuePair <TKey, TValue> > FindMaximumNode(BinaryTree <KeyValuePair <TKey, TValue> > startNode, out BinaryTree <KeyValuePair <TKey, TValue> > parent)
        {
            #region Asserts

            Debug.Assert(startNode != null);

            #endregion

            var searchNode = startNode;
            parent = null;

            while (searchNode.Right != null)
            {
                parent     = searchNode;
                searchNode = searchNode.Right;
            }

            return(searchNode);
        }