use of com.github.davidmoten.guavamini.annotations.VisibleForTesting in project risky by amsa-code.
the class Grid method getStartLat.
@VisibleForTesting
static BigDecimal getStartLat(Options options) {
final long moveStartLatUpByCells;
if (options.getFilterBounds().getTopLeftLat() == options.getOriginLat().doubleValue())
moveStartLatUpByCells = 0;
else
moveStartLatUpByCells = Math.max(0, Math.round(Math.floor((options.getFilterBounds().getTopLeftLat() - options.getOriginLat().doubleValue()) / options.getCellSizeDegrees().doubleValue()) + 1));
BigDecimal result = options.getOriginLat();
for (int i = 0; i < moveStartLatUpByCells; i++) result = result.add(options.getCellSizeDegrees());
return result;
}
use of com.github.davidmoten.guavamini.annotations.VisibleForTesting in project risky by amsa-code.
the class StringSockets method socketCreator.
@VisibleForTesting
static Func0<Socket> socketCreator(final String host, final int port, long quietTimeoutMs) {
return Checked.f0(() -> {
Socket socket = new Socket(host, port);
socket.setSoTimeout((int) quietTimeoutMs);
return socket;
});
}
use of com.github.davidmoten.guavamini.annotations.VisibleForTesting in project risky by amsa-code.
the class Grid method getStartLon.
@VisibleForTesting
static BigDecimal getStartLon(Options options) {
final long moveStartLonLeftByCells;
if (options.getFilterBounds().getTopLeftLon() == options.getOriginLon().doubleValue())
moveStartLonLeftByCells = 0;
else {
moveStartLonLeftByCells = Math.max(0, Math.round(Math.floor((options.getOriginLon().doubleValue() - options.getFilterBounds().getTopLeftLon()) / options.getCellSizeDegrees().doubleValue()) + 1));
}
BigDecimal result = options.getOriginLon();
for (int i = 0; i < moveStartLonLeftByCells; i++) result = result.subtract(options.getCellSizeDegrees());
return result;
}
Aggregations