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

org.opentrafficsim.draw.graphs.AbstractGraphSpace Maven / Gradle / Ivy

The newest version!
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-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License. *

* @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 String getName(final int series) { return this.seriesNames.get(series); } /** * Returns the number of series. * @return int; number of series */ public 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); }