Package com.github.stephengold.joltjni
Class PhysicsMaterialList
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Array<PhysicsMaterialRef>
com.github.stephengold.joltjni.PhysicsMaterialList
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
A variable-length list (array) of material references. (native type:
Array<RefConst<PhysicsMaterial>>
)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
Count how many references the currently allocated storage can hold.void
erase
(int startIndex, int stopIndex) Remove all references in the specified range of indices.get
(int elementIndex) Copy the reference at the specified index.void
resize
(int numElements) Expand or truncate the list.void
set
(int elementIndex, PhysicsMaterialRef reference) Duplicate the specified reference at the specified index.int
size()
Count how many references are in the list.Methods inherited from class com.github.stephengold.joltjni.template.Array
clear, empty, erase, pushBack, toList
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
PhysicsMaterialList
public PhysicsMaterialList()Instantiate an empty list.
-
-
Method Details
-
capacity
public int capacity()Count how many references the currently allocated storage can hold. The list is unaffected.- Specified by:
capacity
in classArray<PhysicsMaterialRef>
- Returns:
- the number of references (≥size)
-
erase
public void erase(int startIndex, int stopIndex) Remove all references in the specified range of indices.- Specified by:
erase
in classArray<PhysicsMaterialRef>
- Parameters:
startIndex
- the index of the first element to remove (≥0)stopIndex
- one plus the index of the last element to remove (≥0)
-
get
Copy the reference at the specified index.- Specified by:
get
in classArray<PhysicsMaterialRef>
- Parameters:
elementIndex
- the index from which to get the reference (≥0)- Returns:
- a new reference to the same material
-
resize
public void resize(int numElements) Expand or truncate the list.- Specified by:
resize
in classArray<PhysicsMaterialRef>
- Parameters:
numElements
- the desired size (number of references, ≥0)
-
set
Duplicate the specified reference at the specified index.- Specified by:
set
in classArray<PhysicsMaterialRef>
- Parameters:
elementIndex
- the index at which to put the reference (≥0)reference
- the reference to put (not null)
-
size
public int size()Count how many references are in the list. The list is unaffected.- Specified by:
size
in classArray<PhysicsMaterialRef>
- Returns:
- the number of references (≥0, ≤capacity)
-