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<Row>,Identifiable
public class SamplerData<G extends GtuData> extends Table
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-2023 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
Nested Classes Modifier and Type Class Description static classSamplerData.CompressionCompression method.
-
Constructor Summary
Constructors Constructor Description SamplerData(Set<ExtendedDataType<?,?,?,G>> extendedDataTypes, Set<FilterDataType<?>> filterDataTypes)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(LaneData lane)Returns whether there is data for the give lane.Set<LaneData>getLanes()Returns the set of lane directions.TrajectoryGroup<G>getTrajectoryGroup(LaneData lane)Returns the trajectory group of given lane.booleanisEmpty()Iterator<Row>iterator()protected voidputTrajectoryGroup(LaneData lane, TrajectoryGroup<G> trajectoryGroup)Stores a trajectory group with the lane direction.voidwriteToFile(String file)Write the contents of the sampler in to a file.voidwriteToFile(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 Detail
-
SamplerData
public SamplerData(Set<ExtendedDataType<?,?,?,G>> extendedDataTypes, Set<FilterDataType<?>> filterDataTypes)
Constructor.- Parameters:
extendedDataTypes- Set<? extends ExtendedDataType<?, ?, ?, G>>; extended data types.filterDataTypes- Set<FilterDataType<?>>; filter data types.
-
-
Method Detail
-
putTrajectoryGroup
protected final void putTrajectoryGroup(LaneData lane, TrajectoryGroup<G> trajectoryGroup)
Stores a trajectory group with the lane direction.- Parameters:
lane- LaneData; lane directiontrajectoryGroup- trajectory group for given lane direction
-
getLanes
public final Set<LaneData> getLanes()
Returns the set of lane directions.- Returns:
- Set<LaneData>; lane directions
-
contains
public final boolean contains(LaneData lane)
Returns whether there is data for the give lane.- Parameters:
lane- LaneData; lane- Returns:
- whether there is data for the give lane
-
getTrajectoryGroup
public final TrajectoryGroup<G> getTrajectoryGroup(LaneData lane)
Returns the trajectory group of given lane.- Parameters:
lane- LaneData; lane- Returns:
- trajectory group of given lane,
nullif none
-
writeToFile
public final void writeToFile(String file)
Write the contents of the sampler in to a file. By default this is zipped.- Parameters:
file- String; file
-
writeToFile
public final void writeToFile(String file, SamplerData.Compression compression)
Write the contents of the sampler in to a file.- Parameters:
file- String; filecompression- Compression; how to compress the data
-
-