public bool Matches(ref int bodyIndex) { //Note that we block traversals on a single thread from retreading old ground. if (PreviouslyTraversedBodies.Contains(bodyIndex)) { return(false); } PreviouslyTraversedBodies.AddUnsafely(bodyIndex); return(Bodies.ActiveSet.Activity[bodyIndex].DeactivationCandidate); }
bool PushBody <TTraversalPredicate>(int bodyIndex, ref HandleSet consideredBodies, ref QuickList <int, Buffer <int> > bodyIndices, ref QuickList <int, Buffer <int> > visitationStack, ref BufferPool <int> intPool, ref TTraversalPredicate predicate) where TTraversalPredicate : IPredicate <int> { if (predicate.Matches(ref bodyIndex)) { if (!consideredBodies.Contains(bodyIndex)) { //This body has not yet been traversed. Push it onto the stack. bodyIndices.Add(bodyIndex, intPool); consideredBodies.AddUnsafely(bodyIndex); visitationStack.Add(bodyIndex, intPool); } return(true); } return(false); }