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

public final class ShapeList extends Array<ShapeRefC>
A variable-length list (array) of shapes. (native type: Array<RefConst<Shape>>)
  • Constructor Details

    • ShapeList

      public ShapeList()
      Instantiate an empty list.
    • ShapeList

      public ShapeList(ShapeRefC shapeRef)
      Instantiate a list containing a single shape.
      Parameters:
      shapeRef - a counted reference to the desired shape (not null)
  • Method Details

    • capacity

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

      public void erase(int startIndex, int stopIndex)
      Remove all shapes in the specified range of indices.
      Specified by:
      erase in class Array<ShapeRefC>
      Parameters:
      startIndex - the index of the first element to remove (≥0)
      stopIndex - one plus the index of the last element to remove (≥0)
    • get

      public ShapeRefC get(int elementIndex)
      Access the shape at the specified index.
      Specified by:
      get in class Array<ShapeRefC>
      Parameters:
      elementIndex - the index from which to get the shape (≥0)
      Returns:
      a new reference
    • resize

      public void resize(int numElements)
      Expand or truncate the list.
      Specified by:
      resize in class Array<ShapeRefC>
      Parameters:
      numElements - the desired size (number of shapes, ≥0)
    • set

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

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