| 94 | |
| 95 | |
| 96 | public Box advance(Box b, BiFunction<Rect, Rect, Rect> advance) { |
| 97 | Rect R = b.properties.get(Box.frame); |
| 98 | boolean repeat = false; |
| 99 | do { |
| 100 | repeat = false; |
| 101 | for (Rect rr : r.values()) { |
| 102 | if (rr==null) continue; |
| 103 | if (overlaps(rr, R)) { |
| 104 | R = advance.apply(rr, R); |
| 105 | repeat = true; |
| 106 | break; |
| 107 | } |
| 108 | } |
| 109 | } while (repeat); |
| 110 | |
| 111 | b.properties.put(Box.frame, R); |
| 112 | r.put(b.properties.getOrConstruct(IO.id), R); |
| 113 | return b; |
| 114 | } |
| 115 | |
| 116 | public Box advance(Box b, BiFunction<Rect, Rect, Rect> advance, float maxTravel, BiFunction<Rect, Rect, Rect> andThen) { |
| 117 | Rect R = b.properties.get(Box.frame); |