Class BodyIdVector

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<ConstJoltPhysicsObject>

public class BodyIdVector extends Array<BodyId>
A variable-length vector (array) of body IDs. (native type: Array<BodyID>)
  • Constructor Details

    • BodyIdVector

      public BodyIdVector()
      Instantiate an empty vector.
  • Method Details

    • capacity

      public int capacity()
      Count how many IDs the currently allocated storage can hold. The vector is unaffected.
      Specified by:
      capacity in class Array<BodyId>
      Returns:
      the number of IDs (≥size)
    • get

      public BodyId get(int elementIndex)
      Access the ID at the specified index.
      Specified by:
      get in class Array<BodyId>
      Parameters:
      elementIndex - the index from which to get the ID (≥0)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • resize

      public void resize(int numIds)
      Expand or truncate the vector.
      Specified by:
      resize in class Array<BodyId>
      Parameters:
      numIds - the desired size (number of IDs, ≥0)
    • set

      public void set(int elementIndex, BodyId id)
      Put the specified ID at the specified index.
      Specified by:
      set in class Array<BodyId>
      Parameters:
      elementIndex - the index at which to put the ID (≥0)
      id - the ID to put (not null)
    • size

      public int size()
      Count how many IDs are in the vector. The vector is unaffected.
      Specified by:
      size in class Array<BodyId>
      Returns:
      the number of IDs (≥0, ≤capacity)