Package com.github.stephengold.joltjni
Class BodyId
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.BodyId
- All Implemented Interfaces:
ConstBodyId,ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
Identify a particular
Body to a BodyInterface. (native type:
BodyID)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Create a mutable copy.intgetIndex()Return the body's index in the array.intConvert the ID to an integer.intReturn the body's sequence number.booleanisEqual(ConstBodyId id2) Test whether the current ID is equal to the argument.booleanTest whether the ID is valid.voidsetIndexAndSequenceNumber(int value) Alter the index and sequence number.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, va
-
Constructor Details
-
BodyId
public BodyId()Instantiate a default ID. -
BodyId
public BodyId(long idVa) Instantiate with the specified native object assigned but not owned.For use in custom collectors and custom listeners.
- Parameters:
idVa- the virtual address of the native object to assign (not zero)
-
-
Method Details
-
setIndexAndSequenceNumber
public void setIndexAndSequenceNumber(int value) Alter the index and sequence number.- Parameters:
value- the desired value
-
copy
Create a mutable copy. The current ID is unaffected.- Specified by:
copyin interfaceConstBodyId- Returns:
- a new mutable JVM object with a new native object assigned
-
getIndex
public int getIndex()Return the body's index in the array. The ID is unaffected.- Specified by:
getIndexin interfaceConstBodyId- Returns:
- the index (≥0)
-
getIndexAndSequenceNumber
public int getIndexAndSequenceNumber()Convert the ID to an integer. The ID is unaffected.- Specified by:
getIndexAndSequenceNumberin interfaceConstBodyId- Returns:
- the integer value
-
getSequenceNumber
public int getSequenceNumber()Return the body's sequence number. The ID is unaffected.- Specified by:
getSequenceNumberin interfaceConstBodyId- Returns:
- the sequence number (≥0)
-
isEqual
Test whether the current ID is equal to the argument. The current ID is unaffected.- Specified by:
isEqualin interfaceConstBodyId- Parameters:
id2- the 2nd ID to test (not null, unaffected)- Returns:
- true if equal, false if unequal
-
isInvalid
public boolean isInvalid()Test whether the ID is valid. It is unaffected.- Specified by:
isInvalidin interfaceConstBodyId- Returns:
- true if invalid, false if valid
-