Package com.github.stephengold.joltjni
Class IndexedTriangleList
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Array<IndexedTriangle>
com.github.stephengold.joltjni.IndexedTriangleList
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
A variable-length list (array) of indexed triangles. (native type:
Array<IndexedTriangle>
)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
capacity()
Count how many triangles the currently allocated storage can hold.void
erase
(int startIndex, int stopIndex) Remove all triangles in the specified range of indices.get
(int elementIndex) Access the triangle at the specified index.void
resize
(int numTriangles) Expand or truncate the list.void
set
(int elementIndex, IndexedTriangle triangle) Put the specified triangle at the specified index.int
size()
Count how many triangles 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
-
IndexedTriangleList
public IndexedTriangleList()Instantiate an empty list.
-
-
Method Details
-
capacity
public int capacity()Count how many triangles the currently allocated storage can hold. The list is unaffected.- Specified by:
capacity
in classArray<IndexedTriangle>
- Returns:
- the number of triangles (≥size)
-
erase
public void erase(int startIndex, int stopIndex) Remove all triangles in the specified range of indices.- Specified by:
erase
in classArray<IndexedTriangle>
- Parameters:
startIndex
- the index of the first element to remove (≥0)stopIndex
- one plus the index of the last element to remove (≥0)
-
get
Access the triangle at the specified index.- Specified by:
get
in classArray<IndexedTriangle>
- Parameters:
elementIndex
- the index from which to get the triangle (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
resize
public void resize(int numTriangles) Expand or truncate the list.- Specified by:
resize
in classArray<IndexedTriangle>
- Parameters:
numTriangles
- the desired size (number of triangles, ≥0)
-
set
Put the specified triangle at the specified index.- Specified by:
set
in classArray<IndexedTriangle>
- Parameters:
elementIndex
- the index at which to put the triangle (≥0)triangle
- the triangle to put (not null)
-
size
public int size()Count how many triangles are in the list. The list is unaffected.- Specified by:
size
in classArray<IndexedTriangle>
- Returns:
- the number of triangles (≥0, ≤capacity)
-