Example #1
0
        internal void Remove(FibonacciHeapCell Node)
        {
            Contract.Requires <ArgumentNullException>(Node != null);
            Contract.Ensures(Node.Next == null);
            Contract.Ensures(Node.Previous == null);
            Contract.Ensures(Node.Count <= 0);


            Node.Next     = null;
            Node.Previous = null;
        }
Example #2
0
        private static void BadTest(FibonacciHeapCell Node, FibonacciHeapLinkedList children, FibonacciHeapLinkedList others)
        {
            Contract.Requires <ArgumentNullException>(Node != null);
            Contract.Requires <ArgumentNullException>(children != null);
            Contract.Requires <ArgumentNullException>(others != null);

            var parentNode = Node.Parent;

            while (parentNode != null)
            {
                children.Remove(parentNode);
                Contract.Assert(parentNode.Previous == null);
                UpdateNodesDegree(parentNode);
                others.AddLast(parentNode);
                parentNode = parentNode.Parent;
            }
        }
Example #3
0
 internal void AddLast(FibonacciHeapCell Node)
 {
     Contract.Requires(Node.Previous == null);
     Contract.Requires(Node.Count <= 0); // Add this to test old in numerical domains
 }
Example #4
0
 private static void UpdateNodesDegree(FibonacciHeapCell parentNode)
 {
     Contract.Ensures(parentNode.Previous == Contract.OldValue(parentNode.Previous));
     Contract.Ensures(parentNode.Next == Contract.OldValue(parentNode.Next));
     Contract.Ensures(parentNode.Count == Contract.OldValue(parentNode.Count));
 }