Ejemplo n.º 1
0
 public void allRayIntersectionsBreakable(
     Vec raypt, Vec rayNormalizedDir, ToIntFunction<Tp> cons) {
   if (!intersectsWithRay(raypt, rayNormalizedDir)) return;
   for (Tp item : container) {
     int res = cons.applyAsInt(item);
     if (res == -1) return;
   }
   forAllSubtree(
       (i, j, k) -> {
         if (subtree[i][j][k] != null)
           subtree[i][j][k].allRayIntersectionsBreakable(raypt, rayNormalizedDir, cons);
       });
 }
Ejemplo n.º 2
0
  private <E extends RuntimeException> void assertToIntFunction(
      ToIntFunction<Object> test, Class<E> type) {
    assertNotNull(test);
    try {
      test.applyAsInt(null);
      fail();
    } catch (RuntimeException e) {
      assertException(type, e, "null");
    }

    try {
      Stream.of("1", "2", "3").mapToInt(test);
    } catch (RuntimeException e) {
      assertException(type, e, "a");
    }
  }