java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.BodyIdArray
- All Implemented Interfaces:
ConstJoltPhysicsObject,AutoCloseable,Comparable<JoltPhysicsObject>
A fixed-length array of body IDs. (native type:
BodyID[])-
Constructor Summary
ConstructorsConstructorDescriptionBodyIdArray(int length) Instantiate an uninitialized array with the specified length.BodyIdArray(int... idArray) Instantiate an array initialized from the specified Java array.BodyIdArray(IntBuffer idBuffer) Instantiate an array initialized from the specified direct buffer.BodyIdArray(List<Integer> idList) Instantiate an array initialized from the specified Java list. -
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
-
BodyIdArray
public BodyIdArray(int length) Instantiate an uninitialized array with the specified length.- Parameters:
length- the desired number of IDs (>0)
-
BodyIdArray
public BodyIdArray(int... idArray) Instantiate an array initialized from the specified Java array.- Parameters:
idArray- the ID values (notnull, not empty, unaffected)
-
BodyIdArray
Instantiate an array initialized from the specified direct buffer.- Parameters:
idBuffer- the ID values (notnull, direct, positive capacity, unaffected)
-
BodyIdArray
Instantiate an array initialized from the specified Java list.- Parameters:
idList- the ID values (notnull, not empty, unaffected)
-
-
Method Details
-
get
public int get(int elementIndex) Return the ID at the specified index.- Parameters:
elementIndex- the index from which to copy the ID (≥0, <length)- Returns:
- the
BodyIDvalue
-
length
public int length()Return the length of the array.- Returns:
- the length (in IDs)
-
set
public void set(int elementIndex, int bodyId) Store the specified ID at the specified index.- Parameters:
elementIndex- the index at which to store the ID (≥0, <length)bodyId- the ID to store
-