Package com.github.stephengold.joltjni
Class BodyLockMultiRead
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.BodyLockMultiBase
com.github.stephengold.joltjni.BodyLockMultiRead
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Lock multiple bodies for read-only access.
-
Constructor Summary
ConstructorsConstructorDescriptionBodyLockMultiRead
(BodyLockInterface bli, int... bodyIds) Acquire body locks using the specified interface and body IDs. -
Method Summary
Modifier and TypeMethodDescriptionAccess all the bodies.getBody
(int index) Access a specific body.int
Count the bodies that were locked.void
Release all the locks.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
-
BodyLockMultiRead
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
-
-
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
-