示例#1
0
文件: Octree.java 项目: vlitomsk/fit
 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);
       });
 }
  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");
    }
  }