package org.opentrafficsim.draw.graphs; import java.util.Iterator; import java.util.List; /** * Common functionality between a cross-section and a path. *

* Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License. *

* @version $Revision$, $LastChangedDate$, by $Author$, initial version 23 okt. 2018
* @author Alexander Verbraeck * @author Peter Knoppers * @author Wouter Schakel * @param underlying type of path sections */ public abstract class AbstractGraphSpace implements Iterable { /** Series names. */ private final List seriesNames; /** * Constructor. * @param seriesNames List<String>; names of series */ public AbstractGraphSpace(final List seriesNames) { this.seriesNames = seriesNames; } /** * Returns the name of the series. * @param series int; series * @return String; name of the series */ public final String getName(final int series) { return this.seriesNames.get(series); } /** * Returns the number of series. * @return int; number of series */ public final int getNumberOfSeries() { return this.seriesNames.size(); } /** * Returns an iterator over the sources on the given series. * @param series int; number of the series * @return Iterator<S>; iterator over the sources on the given series */ abstract Iterator iterator(int series); }