G
- gtu data typepublic abstract class Sampler<G extends GtuDataInterface> extends Object
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Class and Description |
---|---|
static class |
Sampler.CompressionMethod
Defines the compression method for stored data.
|
Constructor and Description |
---|
Sampler() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(ExtendedDataType<?,?,?,?> extendedDataType)
Whether this sampler has the given extended data type registered to it.
|
boolean |
contains(KpiLaneDirection kpiLaneDirection)
Returns whether there is data for the give lane direction.
|
boolean |
equals(Object obj) |
abstract void |
finalizeRecording(KpiLaneDirection kpiLaneDirection)
Remove listeners to stop recording.
|
TrajectoryGroup<G> |
getTrajectoryGroup(KpiLaneDirection kpiLaneDirection)
Returns the trajectory group of given lane direction.
|
int |
hashCode() |
abstract void |
initRecording(KpiLaneDirection kpiLaneDirection)
Adds listeners to start recording.
|
abstract Time |
now()
Returns the current simulation time.
|
void |
processGtuAddEvent(KpiLaneDirection kpiLaneDirection,
Length position,
Speed speed,
Acceleration acceleration,
Time time,
G gtu)
Creates a trajectory with the current snapshot of a GTU.
|
void |
processGtuMoveEvent(KpiLaneDirection kpiLaneDirection,
Length position,
Speed speed,
Acceleration acceleration,
Time time,
G gtu)
Adds a new snapshot of a GTU to its recording trajectory, if recorded.
|
void |
processGtuRemoveEvent(KpiLaneDirection kpiLaneDirection,
G gtu)
Finalizes a trajectory.
|
void |
processGtuRemoveEvent(KpiLaneDirection kpiLaneDirection,
Length position,
Speed speed,
Acceleration acceleration,
Time time,
G gtu)
Finalizes a trajectory with the current snapshot of a GTU.
|
void |
registerExtendedDataType(ExtendedDataType<?,?,?,G> extendedDataType)
Registers extended data type that will be stored with the trajectories.
|
void |
registerMetaDataTypes(Set<MetaDataType<?>> metaDataTypes)
Registers meta data types that will be stored with the trajectories.
|
void |
registerSpaceTimeRegion(SpaceTimeRegion spaceTimeRegion) |
abstract void |
scheduleStartRecording(Time time,
KpiLaneDirection kpiLaneDirection)
Schedules the start of recording for a given lane-direction.
|
abstract void |
scheduleStopRecording(Time time,
KpiLaneDirection kpiLaneDirection)
Schedules the stop of recording for a given lane-direction.
|
void |
startRecording(KpiLaneDirection kpiLaneDirection)
Start recording at the given time (which should be the current time) on the given lane direction.
|
void |
stopRecording(KpiLaneDirection kpiLaneDirection)
Stop recording at given lane direction.
|
void |
writeToFile(String file)
Write the contents of the sampler in to a file.
|
void |
writeToFile(String file,
String format,
Sampler.CompressionMethod compression)
Write the contents of the sampler in to a file.
|
public final void registerSpaceTimeRegion(SpaceTimeRegion spaceTimeRegion)
spaceTimeRegion
- SpaceTimeRegion; space-time regionIllegalStateException
- if data is not available from the requested start timepublic abstract Time now()
public abstract void scheduleStartRecording(Time time, KpiLaneDirection kpiLaneDirection)
time
- Time; time to start recordingkpiLaneDirection
- KpiLaneDirection; lane-direction to start recordingpublic abstract void scheduleStopRecording(Time time, KpiLaneDirection kpiLaneDirection)
time
- Time; time to stop recordingkpiLaneDirection
- KpiLaneDirection; lane-direction to stop recordingpublic final void registerMetaDataTypes(Set<MetaDataType<?>> metaDataTypes)
metaDataTypes
- Set<MetaDataType<?>>; meta data types to registerpublic final void registerExtendedDataType(ExtendedDataType<?,?,?,G> extendedDataType)
extendedDataType
- ExtendedDataType<?,?,?,G>; extended data type to registerpublic boolean contains(ExtendedDataType<?,?,?,?> extendedDataType)
extendedDataType
- ExtendedDataType<?,?,?,?>; extended data typepublic final void startRecording(KpiLaneDirection kpiLaneDirection)
kpiLaneDirection
- KpiLaneDirection; lane directionpublic abstract void initRecording(KpiLaneDirection kpiLaneDirection)
kpiLaneDirection
- KpiLaneDirection; lane direction to initialize recording forpublic final void stopRecording(KpiLaneDirection kpiLaneDirection)
kpiLaneDirection
- KpiLaneDirection; lane directionpublic abstract void finalizeRecording(KpiLaneDirection kpiLaneDirection)
kpiLaneDirection
- KpiLaneDirection; lane direction to finalize recording forpublic final void processGtuAddEvent(KpiLaneDirection kpiLaneDirection, Length position, Speed speed, Acceleration acceleration, Time time, G gtu)
kpiLaneDirection
- KpiLaneDirection; lane direction the gtu is atposition
- Length; position of the gtu on the lanespeed
- Speed; speed of the gtuacceleration
- Acceleration; acceleration of the gtutime
- Time; current timegtu
- G; gtupublic final void processGtuMoveEvent(KpiLaneDirection kpiLaneDirection, Length position, Speed speed, Acceleration acceleration, Time time, G gtu)
kpiLaneDirection
- KpiLaneDirection; lane direction the gtu is atposition
- Length; position of the gtu on the lanespeed
- Speed; speed of the gtuacceleration
- Acceleration; acceleration of the gtutime
- Time; current timegtu
- G; gtupublic final void processGtuRemoveEvent(KpiLaneDirection kpiLaneDirection, Length position, Speed speed, Acceleration acceleration, Time time, G gtu)
kpiLaneDirection
- KpiLaneDirection; lane direction the gtu is atposition
- Length; position of the gtu on the lanespeed
- Speed; speed of the gtuacceleration
- Acceleration; acceleration of the gtutime
- Time; current timegtu
- G; gtupublic final void processGtuRemoveEvent(KpiLaneDirection kpiLaneDirection, G gtu)
kpiLaneDirection
- KpiLaneDirection; lane direction the gtu is atgtu
- G; gtupublic final boolean contains(KpiLaneDirection kpiLaneDirection)
kpiLaneDirection
- KpiLaneDirection; lane directionpublic final TrajectoryGroup<G> getTrajectoryGroup(KpiLaneDirection kpiLaneDirection)
kpiLaneDirection
- KpiLaneDirection; lane directionnull
if nonepublic final void writeToFile(String file)
file
- String; filepublic final void writeToFile(String file, String format, Sampler.CompressionMethod compression)
file
- String; fileformat
- String; number format, as used in String.format()
compression
- CompressionMethod; how to compress the dataCopyright © 2014–2019 Delft University of Technology. All rights reserved.