/// <summary> /// Clears the stats. /// </summary> public void Clear() { HighestAddedElement = int.MinValue; HighestExtractedElement = int.MinValue; LowestAddedElement = int.MaxValue; MaxNumberOfElements = 0; NumberOfExtracts = 0; NumberOfInserts = 0; CurrentHeapSize = 0; ExtractedElementsAgeTotalSum = 0; OldestExtractedElement = 0; CurrentTime = 0; ElementsAges.Clear(); KeysUsed.Clear(); }
/// <summary> /// Updates the stats after element removal. /// </summary> /// <param name="removedElement">Removed element.</param> public void UpdateAfterRemove(HeapNode removedElement) { CurrentTime++; CurrentHeapSize--; NumberOfExtracts++; if (HighestExtractedElement < removedElement.Key) { HighestExtractedElement = removedElement.Key; } int elementAge = CurrentTime - removedElement.TimeStamp; if (OldestExtractedElement < elementAge) { OldestExtractedElement = elementAge; } ElementsAges.Add(elementAge); ExtractedElementsAgeTotalSum += elementAge; }