class Traversal implements Serializable {

    public double getDistanceAtTime(double time) {
        if (time > totalDuration || DoubleMath.fuzzyEquals(time, totalDuration, totalDuration * ROUNDING_ERROR_FRACTION)) {
            return totalDistance;
        }

        if (time < 0) {
            throw new TraversalCalculationException("Negative time provided");
        }

        return SegmentGraphUtilities.accumulateValueTo(
                sections,
                TraversalSection::getDuration,
                TraversalSection::getTotalDistance,
                TraversalSection::getDistanceAtTime,
                time);
    }

    public  Traversal(ImmutableList<TraversalSection> sections);

}