Package org.opentrafficsim.kpi.sampling
Class SamplerData<G extends GtuData>
java.lang.Object
org.djutils.data.Table
org.opentrafficsim.kpi.sampling.SamplerData<G>
- Type Parameters:
G
- gtu data type
- All Implemented Interfaces:
Iterable<org.djutils.data.Row>
,org.djutils.base.Identifiable
SamplerData is a storage for trajectory data. Adding trajectory groups can only be done by subclasses. This is however not a
guaranteed read-only class. Any type can obtain the lane directions and with those the coupled trajectory groups.
Trajectories can be added to these trajectory groups. Data can also be added to the trajectories themselves.
Copyright (c) 2020-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, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionSamplerData
(Set<ExtendedDataType<?, ?, ?, ? super G>> extendedDataTypes, Set<FilterDataType<?, ? super G>> filterDataTypes) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Returns whether there is data for the give lane.getLanes()
Returns the set of lane directions.final TrajectoryGroup<G>
getTrajectoryGroup
(LaneData<?> lane) Returns the trajectory group of given lane.boolean
isEmpty()
Iterator<org.djutils.data.Row>
iterator()
protected final void
putTrajectoryGroup
(LaneData<?> lane, TrajectoryGroup<G> trajectoryGroup) Stores a trajectory group with the lane direction.final void
writeToFile
(String file) Write the contents of the sampler in to a file.final void
writeToFile
(String file, SamplerData.Compression compression) Write the contents of the sampler in to a file.Methods inherited from class org.djutils.data.Table
getColumn, getColumnDataTypes, getColumnDataTypeStrings, getColumnDescriptions, getColumnIds, getColumnNumber, getColumnNumber, getColumns, getDescription, getId, getNumberOfColumns, toString
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 Details
-
SamplerData
public SamplerData(Set<ExtendedDataType<?, ?, ?, ? super G>> extendedDataTypes, Set<FilterDataType<?, ? super G>> filterDataTypes) Constructor.- Parameters:
extendedDataTypes
- Set<? extends ExtendedDataType<?, ?, ?, ? super G>>; extended data types.filterDataTypes
- Set<FilterDataType<?, ? super G>>; filter data types.
-
-
Method Details
-
putTrajectoryGroup
Stores a trajectory group with the lane direction.- Parameters:
lane
- LaneData; lane directiontrajectoryGroup
- trajectory group for given lane direction
-
getLanes
Returns the set of lane directions.- Returns:
- Set<LaneData>; lane directions
-
contains
Returns whether there is data for the give lane.- Parameters:
lane
- LaneData; lane- Returns:
- whether there is data for the give lane
-
getTrajectoryGroup
Returns the trajectory group of given lane.- Parameters:
lane
- LaneData; lane- Returns:
- trajectory group of given lane,
null
if none
-
writeToFile
Write the contents of the sampler in to a file. By default this is zipped.- Parameters:
file
- String; file
-
writeToFile
Write the contents of the sampler in to a file.- Parameters:
file
- String; filecompression
- Compression; how to compress the data
-
iterator
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in classorg.djutils.data.Table
-