Package com.github.stephengold.joltjni
Class BodyLockMultiWrite
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.BodyLockMultiBase
com.github.stephengold.joltjni.BodyLockMultiWrite
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Lock multiple bodies for read-write access.
-
Constructor Summary
ConstructorsConstructorDescriptionBodyLockMultiWrite
(BodyLockInterface bli, int... bodyIds) Acquire body locks using the specified interface and body IDs. -
Method Summary
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
BodyLockMultiWrite
Acquire body locks using the specified interface and body IDs.- Parameters:
bli
- the interface to use (not null, unaffected)bodyIds
- the IDs of the bodies to lock (not empty)
-
-
Method Details
-
getBodies
Access all the bodies.- Specified by:
getBodies
in classBodyLockMultiBase
- Returns:
- a new array
-
getBody
Access a specific body.- Specified by:
getBody
in classBodyLockMultiBase
- Parameters:
index
- into the array of body IDs (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned, or
null
if not available
-
getNumBodies
public int getNumBodies()Count the bodies that were locked.- Specified by:
getNumBodies
in classBodyLockMultiBase
- Returns:
- the number of bodies (≥0)
-
releaseLocks
public void releaseLocks()Release all the locks.- Specified by:
releaseLocks
in classBodyLockMultiBase
-