コード例 #1
0
        public void Compact()
        {
            MockHeap mh = new MockHeap(Heap.Length);

            Stack<MockObject> mockObjectStack = new Stack<MockObject>();
            for (int i = 0; i < Heap.Length; i++)
                for (int j = 0; j < Heap.Length; j++)
                    if (Heap.Storage[i, j] != null)
                        mockObjectStack.Push(Heap.Storage[i, j]);
            Heap = new MockHeap(Heap.Length);
            while (mockObjectStack.Count > 0)
            {
                MockObject mockObject = mockObjectStack.Pop();
                Heap.Add(mockObject);
            }
        }