public void FreeBlockTest() { IPersistentCollectionSpaceManager pafs = InitPAFS("PCSMFreeBlock", 16, 8); try { int token1 = pafs.AllocateBlock(); int token2 = pafs.AllocateBlock(); int token3 = pafs.AllocateBlock(); int token4 = pafs.AllocateBlock(); pafs.FreeBlock(token4); pafs.FreeBlock(token3); pafs.FreeBlock(token2); pafs.FreeBlock(token1); } finally { pafs.Close(); } }
public byte[] Remove(int nodeReference) { if (GetSize() == 0) //um, there's nothing in the list? { throw new InvalidOperationException("No elements in list"); } AssertNotBadNodeReference(nodeReference); LinkedListElement removingElement = GetElementAt(nodeReference); LinkedListElement previous = GetElementAt(removingElement.Previous); LinkedListElement next = GetElementAt(removingElement.Next); SetPreviousNext(previous, next); PutElement(previous); PutElement(next); DecreaseSize(); _persistentSimpleCollection.FreeBlock(removingElement.Index); return(removingElement.Data); }