Package org.opentrafficsim.draw.graphs
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGraphPath.Section<S>Interface for sections. -
Constructor Summary
Constructors Constructor Description GraphPath(java.lang.String name, java.util.List<GraphPath.Section<S>> sections)Constructor for a one-series path.GraphPath(java.util.List<java.lang.String> seriesNames, java.util.List<GraphPath.Section<S>> sections)Constructor. -
Method Summary
Modifier and Type Method Description GraphPath.Section<S>get(int index)Returns a section.ImmutableList<GraphPath.Section<S>>getSections()Returns an immutable list of the sections.SpeedgetSpeedLimit()Returns the mean speed over the entire section.LengthgetStartDistance(GraphPath.Section<S> section)Returns the start distance of the section.LengthgetTotalLength()Returns the total path length.java.util.Iterator<S>iterator()java.util.Iterator<S>iterator(int series)java.lang.StringtoString()Methods inherited from class org.opentrafficsim.draw.graphs.AbstractGraphSpace
getName, getNumberOfSeries
-
Constructor Details
-
GraphPath
Constructor for a one-series path.- Parameters:
name- String; namesections- 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 seriessections- List<Section<S>>; sections
-
-
Method Details
-
getStartDistance
Returns the start distance of the section.- Parameters:
section- Section<S>; Section<S> section- Returns:
- Length; start distance of the section
-
getTotalLength
Returns the total path length.- Returns:
- Length; total path length
-
getSpeedLimit
Returns the mean speed over the entire section.- Returns:
- Speed; mean speed over the entire section
-
get
Returns a section.- Parameters:
index- int; index of section- Returns:
- Section<S>; section
-
iterator
-
iterator
-
getSections
Returns an immutable list of the sections.- Returns:
- ImmutableList<Section<S>>; sections
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-