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.
-
Field Summary
Fields inherited from class com.github.stephengold.joltjni.BodyLockMultiBase
bli, idArray -
Constructor Summary
ConstructorsConstructorDescriptionBodyLockMultiRead(ConstBodyLockInterface bli, int... bodyIds) Acquire body locks using the specified interface and body IDs.BodyLockMultiRead(ConstBodyLockInterface bli, ConstBodyIdArray 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.intCount the bodies that were locked.voidRelease all the locks.Methods inherited from class com.github.stephengold.joltjni.BodyLockMultiBase
getBodyIdArrayMethods 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 lock interface to use (notnull, alias created)bodyIds- the IDs of the bodies to lock (notnull, alias created)
-
BodyLockMultiRead
Acquire body locks using the specified interface and body IDs.- Parameters:
bli- the lock interface to use (notnull, alias created)bodyIds- the IDs of the bodies to lock (not empty)
-
-
Method Details
-
getBodies
Access all the bodies.- Specified by:
getBodiesin classBodyLockMultiBase- Returns:
- a new array
-
getBody
Access a specific body.- Specified by:
getBodyin classBodyLockMultiBase- Parameters:
index- into the array of body IDs (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned, or
nullif not available
-
getNumBodies
public int getNumBodies()Count the bodies that were locked.- Specified by:
getNumBodiesin classBodyLockMultiBase- Returns:
- the number of bodies (≥0)
-
releaseLocks
public void releaseLocks()Release all the locks.- Specified by:
releaseLocksin classBodyLockMultiBase
-