Ejemplo n.º 1
0
        internal void DebugValidate()
        {
            Debug.CheckValid(_resources != null, "_resources != null");

            Debug.CheckValid(0 <= _iDisposable && _iDisposable <= _resources.Count,
                             "0 <= _iDisposable && _iDisposable <= _resources.Count" +
                             ";_iDisposable=" + _iDisposable +
                             ";_resources.Count=" + _resources.Count);

            Debug.CheckValid(_interval > TimeSpan.Zero, "_interval > TimeSpan.Zero" +
                             ";_interval=" + _interval);
        }
        internal /*public*/ override void DebugValidate()
        {
            DoubleLink l1, l2;

            base.DebugValidate();
            l1 = Next;
            l2 = l1.Next;
            while (l2 != this)
            {
                Debug.CheckValid(_comparer.Compare(l1, l2) <= 0, "SortedDoubleLinkList is not sorted");

                l1 = l2;
                l2 = l2.Next;
            }
        }
        internal override void DebugValidate()
        {
            DoubleLink l1, l2;

            base.DebugValidate();

            /*
             * Detect loops by moving one pointer forward 2 for every 1
             * of the other.
             */

            l1 = l2 = this;
            for (;;)
            {
                /* move l2 forward */
                l2 = l2._next;
                if (l2 == this)
                {
                    break;
                }

                Debug.CheckValid(l2 != l1, "Invalid loop in list, first move.");
                l2.DebugValidate();

                /* move l2 forward again */
                l2 = l2._next;
                if (l2 == this)
                {
                    break;
                }

                Debug.CheckValid(l2 != l1, "Invalid loop in list, second move.");
                l2.DebugValidate();

                /* move l1 forward */
                l1 = l1._next;
            }
        }
 internal virtual void DebugValidate()
 {
     Debug.CheckValid(this._next != this || this._prev == this, "Invalid link");
 }