private void ValidateBuffer()
{
#if DEBUG
Box2DXDebug.Assert(_pairBufferCount <= _pairCount);
//std::sort(m_pairBuffer, m_pairBuffer + m_pairBufferCount);
BufferedPair[] tmp = new BufferedPair[_pairBufferCount];
Array.Copy(_pairBuffer, 0, tmp, 0, _pairBufferCount);
Array.Sort<BufferedPair>(tmp, BufferedPairSortPredicate);
Array.Copy(tmp, 0, _pairBuffer, 0, _pairBufferCount);
for (int i = 0; i < _pairBufferCount; ++i)
{
if (i > 0)
{
Box2DXDebug.Assert(Equals(_pairBuffer[i], _pairBuffer[i - 1]) == false);
}
Pair pair = Find(_pairBuffer[i].ProxyId1, _pairBuffer[i].ProxyId2);
Box2DXDebug.Assert(pair.IsBuffered());
Box2DXDebug.Assert(pair.ProxyId1 != pair.ProxyId2);
Box2DXDebug.Assert(pair.ProxyId1 < Settings.MaxProxies);
Box2DXDebug.Assert(pair.ProxyId2 < Settings.MaxProxies);
Proxy proxy1 = _broadPhase._proxyPool[pair.ProxyId1];
Proxy proxy2 = _broadPhase._proxyPool[pair.ProxyId2];
Box2DXDebug.Assert(proxy1.IsValid == true);
Box2DXDebug.Assert(proxy2.IsValid == true);
}
#endif
}