コード例 #1
0
        /// <summary>
        /// Removes a property from the tree.
        /// </summary>
        /// <param name="propEnum">An enumerator pointing to the property to remove from the tree.</param>
        /// <returns>A deep enumerator on the property that would be naturally selected if the deleted
        /// item was selected.</returns>
        public PropertyEnumerator Delete(PropertyEnumerator propEnum)
        {
            // Store the previous property (deep)
            PropertyDeepEnumerator dEnumerator = new PropertyDeepEnumerator(propEnum.Node);

            dEnumerator.MovePrev();

            // Remove the property
            propEnum.Node.Owner.Remove(propEnum.Node);

            // Determine the next property of the property that was deleted
            if (dEnumerator.MoveNext() == dEnumerator.RightBound)
            {
                dEnumerator.MovePrev();
            }
            if (dEnumerator == dEnumerator.LeftBound)
            {
                dEnumerator = dEnumerator.RightBound.GetDeepEnumerator();
            }

            // Since the enumerator passed in argument now points to an invalid property,
            // we make it point to the next property (the previous one if no next exists)
            propEnum.Node = dEnumerator.Node;

            return(dEnumerator);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string str = "Deep++\n";

            PropertyDeepEnumerator enumerator = GetDeepEnumerator();

            while (enumerator.MoveNext() != enumerator.RightBound)
            {
                for (int i = 0; i < enumerator.Depth; i++)
                {
                    str += "-";
                }
                str += enumerator.Property.ToString() + "\n";
            }

            str += "\n\nDeep--\n";

            enumerator.MoveToRightBound();
            while (enumerator.MovePrev() != enumerator.LeftBound)
            {
                for (int i = 0; i < enumerator.Depth; i++)
                {
                    str += "-";
                }
                str += enumerator.Property.ToString() + "\n";
            }

            return(str);
        }
コード例 #3
0
ファイル: LinkedList.cs プロジェクト: ChrisMoreton/Test3
        /// <summary>
        /// Removes a property from the tree.
        /// </summary>
        /// <param name="propEnum">An enumerator pointing to the property to remove from the tree.</param>
        /// <returns>A deep enumerator on the property that would be naturally selected if the deleted
        /// item was selected.</returns>
        public PropertyEnumerator Delete(PropertyEnumerator propEnum)
        {
            // Store the previous property (deep)
            PropertyDeepEnumerator dEnumerator = new PropertyDeepEnumerator(propEnum.Node);
            dEnumerator.MovePrev();

            // Remove the property
            propEnum.Node.Owner.Remove(propEnum.Node);

            // Determine the next property of the property that was deleted
            if (dEnumerator.MoveNext() == dEnumerator.RightBound)
                dEnumerator.MovePrev();
            if (dEnumerator == dEnumerator.LeftBound)
                dEnumerator = dEnumerator.RightBound.GetDeepEnumerator();

            // Since the enumerator passed in argument now points to an invalid property,
            // we make it point to the next property (the previous one if no next exists)
            propEnum.Node = dEnumerator.Node;

            return dEnumerator;
        }