Skip to content

Commit 18d9b14

Browse files
committed
add countHits() methods to 5 more all-hit collector classes
1 parent 392b8ba commit 18d9b14

5 files changed

Lines changed: 55 additions & 0 deletions

File tree

src/main/java/com/github/stephengold/joltjni/AllHitCastRayCollector.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public AllHitCastRayCollector() {
4444
// *************************************************************************
4545
// new methods exposed
4646

47+
/**
48+
* Count the hits.
49+
*
50+
* @return the count (≥0)
51+
*/
52+
public int countHits() {
53+
long collectorVa = va();
54+
int result = countHits(collectorVa);
55+
return result;
56+
}
57+
4758
/**
4859
* Access the hit with the specified index.
4960
*

src/main/java/com/github/stephengold/joltjni/AllHitCastShapeCollector.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public AllHitCastShapeCollector() {
4444
// *************************************************************************
4545
// new methods exposed
4646

47+
/**
48+
* Count the hits.
49+
*
50+
* @return the count (≥0)
51+
*/
52+
public int countHits() {
53+
long collectorVa = va();
54+
int result = countHits(collectorVa);
55+
return result;
56+
}
57+
4758
/**
4859
* Access the hit with the specified index.
4960
*

src/main/java/com/github/stephengold/joltjni/AllHitCollidePointCollector.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public AllHitCollidePointCollector() {
4444
// *************************************************************************
4545
// new methods exposed
4646

47+
/**
48+
* Count the hits.
49+
*
50+
* @return the count (≥0)
51+
*/
52+
public int countHits() {
53+
long collectorVa = va();
54+
int result = countHits(collectorVa);
55+
return result;
56+
}
57+
4758
/**
4859
* Access the hit with the specified index.
4960
*

src/main/java/com/github/stephengold/joltjni/AllHitCollideShapeCollector.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public AllHitCollideShapeCollector() {
4444
// *************************************************************************
4545
// new methods exposed
4646

47+
/**
48+
* Count the hits.
49+
*
50+
* @return the count (≥0)
51+
*/
52+
public int countHits() {
53+
long collectorVa = va();
54+
int result = countHits(collectorVa);
55+
return result;
56+
}
57+
4758
/**
4859
* Access the hit with the specified index. (native attribute: mHits)
4960
*

src/main/java/com/github/stephengold/joltjni/AllHitRayCastBodyCollector.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ public AllHitRayCastBodyCollector() {
4444
// *************************************************************************
4545
// new methods exposed
4646

47+
/**
48+
* Count the hits.
49+
*
50+
* @return the count (≥0)
51+
*/
52+
public int countHits() {
53+
long collectorVa = va();
54+
int result = countHits(collectorVa);
55+
return result;
56+
}
57+
4758
/**
4859
* Access the hit with the specified index.
4960
*

0 commit comments

Comments
 (0)