class AnimationPlanFactory {

    public DefaultAnimationPlan createDefaultAnimationPlan(TimeSpan loopSpan, Duration frameDuration,
            Collection<? extends TimeSpan> skippedSpans)
    {
        List<TimeSpan> sequence = New.list();
        TimeSpan ts = TimeSpan.get(loopSpan.getStartInstant(), frameDuration);
        do
        {
            if (!ts.overlaps(skippedSpans))
            {
                sequence.add(ts);
            }
            ts = TimeSpan.get(ts.getEndInstant(), frameDuration);
        }
        while (ts.getStartInstant().compareTo(loopSpan.getEndInstant()) < 0);

        return new DefaultAnimationPlan(sequence, EndBehavior.WRAP);
    }

}