All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops Maven / Gradle / Ivy

There is a newer version: 9.2.1
Show newest version
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;

/**
 * {@link Stops} implementation for categorical functions
 *
 * @param  the {@link Stop} input type
 * @param  the {@link Stop} output type
 */
public class CategoricalStops extends IterableStops> {

  private final Stop[] stops;

  /**
   * Create a categorical {@link Stops} implementation. Use through {@link Stops#categorical(Stop[])}
   *
   * @param stops the stops
   */
  @SafeVarargs
  public CategoricalStops(@NonNull @Size(min = 1) Stop... stops) {
    this.stops = stops;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public Map toValueObject() {
    Map map = super.toValueObject();
    map.put("stops", toValueObjects(stops));
    return map;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public String getTypeName() {
    return "categorical";
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public Iterator> iterator() {
    return Arrays.asList(stops).iterator();
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public int size() {
    return stops.length;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy