class SlidingWindows {

    public static SlidingWindows withTimeDifferenceAndGrace(final Duration timeDifference, final Duration grace) throws IllegalArgumentException {
        final String msgPrefixSize = prepareMillisCheckFailMsgPrefix(timeDifference, "timeDifference");
        final long timeDifferenceMs = ApiUtils.validateMillisecondDuration(timeDifference, msgPrefixSize);
        if (timeDifferenceMs < 0) {
            throw new IllegalArgumentException("Window time difference must not be negative.");
        }
        final String msgPrefixGrace = prepareMillisCheckFailMsgPrefix(grace, "grace");
        final long graceMs = ApiUtils.validateMillisecondDuration(grace, msgPrefixGrace);
        if (graceMs < 0) {
            throw new IllegalArgumentException("Window grace period must not be negative.");
        }
        return new SlidingWindows(timeDifferenceMs, graceMs);
    }

    private  SlidingWindows(final long timeDifferenceMs, final long graceMs);

}