From a213d4225d76449f6cfec111c11d76bf685a64d9 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Mon, 22 Apr 2019 15:22:23 +0200 Subject: [PATCH] Uniformization --- SystemExtensions/Collections/FibonacciHeap.cs | 39 +------------------ .../Collections/FibonacciHeapTests.cs | 22 ----------- 2 files changed, 2 insertions(+), 59 deletions(-) diff --git a/SystemExtensions/Collections/FibonacciHeap.cs b/SystemExtensions/Collections/FibonacciHeap.cs index 0cbfdfa..c7dd994 100644 --- a/SystemExtensions/Collections/FibonacciHeap.cs +++ b/SystemExtensions/Collections/FibonacciHeap.cs @@ -7,10 +7,10 @@ using System.Threading.Tasks; namespace SystemExtensions.Collections { /// - /// Fibonacci Heap implementation. Implements IDisposable to clear the sub structure of the heap. + /// Fibonacci Heap implementation. /// /// Provided type - public class FibonacciHeap : IDisposable + public class FibonacciHeap { #region Fields private FibonacciNode root; @@ -75,7 +75,6 @@ namespace SystemExtensions.Collections root = Merge(root, otherHeap.root); otherHeap.root = null; count += otherHeap.count; - otherHeap.Dispose(); } /// /// Remove the minimum value from the heap. @@ -424,40 +423,6 @@ namespace SystemExtensions.Collections return null; } #endregion - #region IDisposable Support - private bool disposedValue = false; - /// - /// Disposes of the contents of the heap. Called by the public Dispose(). - /// - /// - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (root != null) - { - if (disposing) - { - Remove(root); - } - root.Previous = root.Next = root.Parent = root.Child = null; - root = null; - } - - disposedValue = true; - } - } - /// - /// Disposes of the contents of the heap. - /// - public void Dispose() - { - // Do not change this code. Put cleanup code in Dispose(bool disposing) above. - Dispose(true); - // TODO: uncomment the following line if the finalizer is overridden above. - // GC.SuppressFinalize(this); - } - #endregion } internal class FibonacciNode diff --git a/SystemExtensionsTests/Collections/FibonacciHeapTests.cs b/SystemExtensionsTests/Collections/FibonacciHeapTests.cs index ba8635f..183ebab 100644 --- a/SystemExtensionsTests/Collections/FibonacciHeapTests.cs +++ b/SystemExtensionsTests/Collections/FibonacciHeapTests.cs @@ -40,7 +40,6 @@ namespace SystemExtensions.Collections.Tests [TestMethod()] public void FibonacciHeapTest() { - fibonacciHeap.Dispose(); fibonacciHeap = new FibonacciHeap(new Comparison(IntegerComparison)); if(fibonacciHeap.Count != 0) { @@ -51,7 +50,6 @@ namespace SystemExtensions.Collections.Tests [TestMethod()] public void MergeTest() { - fibonacciHeap.Dispose(); FibonacciHeap fibonacciHeap1 = new FibonacciHeap(new Comparison(IntegerComparison)); FibonacciHeap fibonacciHeap2 = new FibonacciHeap(new Comparison(IntegerComparison)); @@ -150,26 +148,6 @@ namespace SystemExtensions.Collections.Tests } } - [TestMethod()] - public void DisposeTest() - { - List> heaps = new List>(); - for(int i = 0; i < 10; i++) - { - heaps.Add(new Collections.FibonacciHeap(new Comparison(IntegerComparison))); - for(int j = 0; j < 10000; j++) - { - heaps[heaps.Count - 1].Insert(j); - } - } - for(int i = 0; i < 10; i++) - { - heaps[i].Dispose(); - } - GC.Collect(); - heaps.Clear(); - } - [TestMethod()] public void ToArrayTest() {