Class GraphPath<S>

java.lang.Object
org.opentrafficsim.draw.graphs.AbstractGraphSpace<S>
org.opentrafficsim.draw.graphs.GraphPath<S>
Type Parameters:
S - underlying type of path sections
All Implemented Interfaces:
java.lang.Iterable<S>

public class GraphPath<S>
extends AbstractGraphSpace<S>
A GraphPath defines the spatial dimension of graphs. It has a number of sections, each of which may have one or more source objects depending on the number of series. For example, a 3-lane road may result in a few sections each having 3 series. Graphs can aggregate the series, or show multiple series.

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 19 okt. 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • GraphPath

      public GraphPath​(java.lang.String name, java.util.List<GraphPath.Section<S>> sections)
      Constructor for a one-series path.
      Parameters:
      name - String; name
      sections - List<Section<S>>; sections
    • GraphPath

      public GraphPath​(java.util.List<java.lang.String> seriesNames, java.util.List<GraphPath.Section<S>> sections)
      Constructor.
      Parameters:
      seriesNames - List<String>; names of series
      sections - List<Section<S>>; sections
  • Method Details

    • getStartDistance

      public final Length getStartDistance​(GraphPath.Section<S> section)
      Returns the start distance of the section.
      Parameters:
      section - Section<S>; Section<S> section
      Returns:
      Length; start distance of the section
    • getTotalLength

      public final Length getTotalLength()
      Returns the total path length.
      Returns:
      Length; total path length
    • getSpeedLimit

      public final Speed getSpeedLimit()
      Returns the mean speed over the entire section.
      Returns:
      Speed; mean speed over the entire section
    • get

      public GraphPath.Section<S> get​(int index)
      Returns a section.
      Parameters:
      index - int; index of section
      Returns:
      Section<S>; section
    • iterator

      public java.util.Iterator<S> iterator()
    • iterator

      public java.util.Iterator<S> iterator​(int series)
    • getSections

      public ImmutableList<GraphPath.Section<S>> getSections()
      Returns an immutable list of the sections.
      Returns:
      ImmutableList<Section<S>>; sections
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object