HotColdSolver { @VisibleForTesting static boolean isFirstPointCloserRect(final WorldPoint firstPoint, final WorldPoint secondPoint, final Rectangle rect) { final WorldPoint nePoint = new WorldPoint((rect.x + rect.width), (rect.y + rect.height), 0); if (!isFirstPointCloser(firstPoint, secondPoint, nePoint)) { return false; } final WorldPoint sePoint = new WorldPoint((rect.x + rect.width), rect.y, 0); if (!isFirstPointCloser(firstPoint, secondPoint, sePoint)) { return false; } final WorldPoint nwPoint = new WorldPoint(rect.x, (rect.y + rect.height), 0); if (!isFirstPointCloser(firstPoint, secondPoint, nwPoint)) { return false; } final WorldPoint swPoint = new WorldPoint(rect.x, rect.y, 0); return (isFirstPointCloser(firstPoint, secondPoint, swPoint)); } HotColdSolver(Set<HotColdLocation> possibleLocations); Set<HotColdLocation> signal(@Nonnull final WorldPoint worldPoint, @Nonnull final HotColdTemperature temperature, @Nullable final HotColdTemperatureChange temperatureChange);  }
@Test public void testIsFirstPointCloserRect() { assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 0), new Rectangle(0, 0, 1, 1))); assertFalse(isFirstPointCloserRect(new WorldPoint(1, 0, 0), new WorldPoint(5, 0, 0), new Rectangle(2, 1, 5, 5))); assertFalse(isFirstPointCloserRect(new WorldPoint(1, 0, 0), new WorldPoint(0, 0, 0), new Rectangle(2, 0, 1, 2))); assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(1, 1, 1), new Rectangle(2, 2, 2, 2))); assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(4, 4, 4), new Rectangle(1, 1, 2, 2))); assertFalse(isFirstPointCloserRect(new WorldPoint(3, 2, 0), new WorldPoint(1, 5, 0), new Rectangle(0, 0, 4, 4))); assertTrue(isFirstPointCloserRect(new WorldPoint(1, 1, 0), new WorldPoint(0, 1, 0), new Rectangle(2, 0, 3, 2))); assertTrue(isFirstPointCloserRect(new WorldPoint(4, 4, 0), new WorldPoint(1, 1, 0), new Rectangle(3, 3, 2, 2))); assertTrue(isFirstPointCloserRect(new WorldPoint(3, 2, 0), new WorldPoint(7, 0, 0), new Rectangle(1, 3, 4, 2))); }