BEPUutilities2.ResourceManagement.Allocator.ValidatePointers C# (CSharp) Method

ValidatePointers() private method

private ValidatePointers ( ) : void
return void
        private void ValidatePointers()
        {
            if (allocations.Count == 0)
                return;
            var initialId = allocations.Keys[0];
            ulong backwardId = initialId;
            ulong forwardId = initialId;
            for (int i = 0; i < allocations.Count; ++i)
            {
                var backwardIndex = allocations.IndexOf(backwardId);
                backwardId = allocations.Values[backwardIndex].Previous;

                var forwardIndex = allocations.IndexOf(forwardId);
                forwardId = allocations.Values[forwardIndex].Next;
            }
            Debug.Assert(initialId == backwardId && initialId == forwardId, "We should be able to walk back to the starting id in exactly allocations.Count steps in either direction.");
        }