package com.mapbox.mapboxsdk.style.functions.stops; import android.support.annotation.NonNull; import android.support.annotation.Size; import java.util.Arrays; import java.util.Iterator; import java.util.Map; /** * The {@link Stops} implementation for interval functions * * @param the input type * @param the output type */ public class IntervalStops extends IterableStops> { private final Stop[] stops; @SafeVarargs public IntervalStops(@NonNull @Size(min = 1) Stop... stops) { this.stops = stops; } /** * {@inheritDoc} */ @Override public String getTypeName() { return "interval"; } /** * {@inheritDoc} */ @Override public Map toValueObject() { Map map = super.toValueObject(); map.put("stops", toValueObjects(stops)); return map; } /** * @return an {@link Iterator} for the contained stops */ @Override public Iterator> iterator() { return Arrays.asList(stops).iterator(); } /** * @return The number of contained stops */ @Override public int size() { return stops.length; } }