Granikos.SMTPSimulator.Service/PriorityQueue/HeapPriorityQueue.cs
/// <summary>
///     <b>Should not be called in production code.</b>
///     Checks to make sure the queue is still in a valid state.  Used for testing/debugging the queue.
/// </summary>
Should not be called in production code.
Should not be called in production code .
public bool IsValidQueue()
        {
            for (var i = 1; i < _nodes.Length; i++)
            {
                if (_nodes[i] != null)
                {
                    var childLeftIndex = 2*i;
                    if (childLeftIndex < _nodes.Length && _nodes[childLeftIndex] != null &&
                        HasHigherPriority(_nodes[childLeftIndex], _nodes[i]))
                        return false;
                    var childRightIndex = childLeftIndex + 1;
                    if (childRightIndex < _nodes.Length && _nodes[childRightIndex] != null &&
                        HasHigherPriority(_nodes[childRightIndex], _nodes[i]))
                        return false;
                }
            }
            return true;
        }
public bool IsValidQueue ( ) { for ( var i = 1 ; i < _nodes . Length ; i ++ ) { if ( _nodes [ i ] != null ) { var childLeftIndex = 2 * i ; if ( childLeftIndex < _nodes . Length && _nodes [ childLeftIndex ] != null && HasHigherPriority ( _nodes [ childLeftIndex ] , _nodes [ i ] ) ) return false ; var childRightIndex = childLeftIndex + 1 ; if ( childRightIndex < _nodes . Length && _nodes [ childRightIndex ] != null && HasHigherPriority ( _nodes [ childRightIndex ] , _nodes [ i ] ) ) return false ; } } return true ; }
Should not be called in production code.
Should not be called in production code .