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:
Iterable<S>
public class GraphPath<S> extends AbstractGraphSpace<S>
AGraphPath
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 interface
GraphPath.Section<S>
Interface for sections.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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.Speed
getSpeedLimit()
Returns the mean speed over the entire section.Length
getStartDistance(GraphPath.Section<S> section)
Returns the start distance of the section.Length
getTotalLength()
Returns the total path length.static void
initRecording(Sampler<?> sampler, GraphPath<KpiLaneDirection> path)
Start recording along path.Iterator<S>
iterator()
Iterator<S>
iterator(int series)
String
toString()
-
Methods inherited from class org.opentrafficsim.draw.graphs.AbstractGraphSpace
getName, getNumberOfSeries
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GraphPath
public GraphPath(String name, List<GraphPath.Section<S>> sections)
Constructor for a one-series path.- Parameters:
name
- String; namesections
- List<Section<S>>; sections
-
GraphPath
public GraphPath(List<String> seriesNames, List<GraphPath.Section<S>> sections)
Constructor.- Parameters:
seriesNames
- List<String>; names of seriessections
- List<Section<S>>; sections
-
-
Method Detail
-
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
-
getSections
public ImmutableList<GraphPath.Section<S>> getSections()
Returns an immutable list of the sections.- Returns:
- ImmutableList<Section<S>>; sections
-
initRecording
public static void initRecording(Sampler<?> sampler, GraphPath<KpiLaneDirection> path)
Start recording along path.- Parameters:
sampler
- Sampler<?>; samplerpath
- GraphPath<KpiLaneDirection>; path
-
-