Class SamplerData<G extends GtuData>

  • 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
    • 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 direction
        trajectoryGroup - 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, null if 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; file
        compression - Compression; how to compress the data
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in class Table