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

public class ContactSet extends JoltPhysicsObject
A variable-length array of contact keys. (native type: Array<CharacterVirtual::ContactKey>)
  • Constructor Details

    • ContactSet

      public ContactSet()
      Instantiate an empty set.
    • ContactSet

      public ContactSet(ContactSet original)
      Instantiate a copy of the specified set.
      Parameters:
      original - the set to copy (not null, unaffected)
  • Method Details

    • capacity

      public int capacity()
      Count how many keys the currently allocated storage can hold. The set is unaffected.
      Returns:
      the number of keys (≥size)
    • empty

      public boolean empty()
      Test whether the set contains one or more keys. The set is unaffected.
      Returns:
      true if empty, otherwise false
    • erase

      public void erase(int elementIndex)
      Remove the key at the specified index.
      Parameters:
      elementIndex - the element index of the key to remove (≥0)
    • erase

      public void erase(int startIndex, int stopIndex)
      Remove all keys in the specified range of indices.
      Parameters:
      startIndex - the index of the first key to remove (≥0)
      stopIndex - one plus the index of the last key to remove (≥0)
    • find

      public int find(ConstContactKey key)
      Find the element index of the first matching key, if any.
      Parameters:
      key - the key to search for (not null, unaffected)
      Returns:
      the index of the first matching key, or -1 if not found
    • get

      public ContactKey get(int elementIndex)
      Copy the key at the specified index.
      Parameters:
      elementIndex - the index from which to copy the key (≥0)
      Returns:
      a new object
    • pushBack

      public void pushBack(ConstContactKey key)
      Append a copy of the specified key to the end.
      Parameters:
      key - the key to append (not null, unaffected)
    • resize

      public void resize(int numKeys)
      Extend or truncate the set.
      Parameters:
      numKeys - the desired size (number of keys, ≥0)
    • set

      public void set(int elementIndex, ConstContactKey key)
      Store a copy of the specified key at the specified index.
      Parameters:
      elementIndex - the index at which to store the key (≥0)
      key - the key to store (not null, unaffected)
    • size

      public int size()
      Count how many keys are in the set. The set is unaffected.
      Returns:
      the number of keys (≥0, ≤capacity)
    • toList

      public List<ContactKey> toList()
      Copy all the keys (in order) to a Java list.
      Returns:
      a new Java list