public int countDurationInterval(Interval outer, Duration next, Duration threshold) {
        int count = 0;
        int index = overlapStart(outer);

        Interval inner = new Interval(outer.getStartMillis(), outer.getStartMillis() + next.getMillis());

        long duration = next.getMillis();
        while (index < size() - 1) {
            long start = inner.getStartMillis() + duration;
            long end = inner.getEndMillis() + duration;

            inner = new Interval(start, end);

            if (overlap(inner) > threshold.getMillis()) {
                count++;
            }
            index++;
        }

        return count;
    }