java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.BodyIdArray
All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class BodyIdArray extends JoltPhysicsObject
A fixed-length array of body IDs. (native type: BodyID[])
  • 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 a Java array.
      Parameters:
      idArray - the ID values (not null, not empty, unaffected)
    • BodyIdArray

      public BodyIdArray(IntBuffer idBuffer)
      Instantiate an array initialized from a direct buffer.
      Parameters:
      idBuffer - the ID values (not null, direct, positive capacity, unaffected)
    • BodyIdArray

      public BodyIdArray(List<Integer> idList)
      Instantiate an array initialized from a Java list.
      Parameters:
      idList - the ID values (not null, 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)
      Returns:
      the BodyID value
    • 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)
      bodyId - the ID to store