Class RoadSampler
- java.lang.Object
-
- org.opentrafficsim.kpi.sampling.Sampler<GtuData>
-
- org.opentrafficsim.road.network.sampling.RoadSampler
-
- All Implemented Interfaces:
Serializable,EventListener,EventListenerInterface
public class RoadSampler extends Sampler<GtuData> implements EventListenerInterface
Implementation of kpi sampler for OTS.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 12 okt. 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRoadSampler.FactoryFactory forRoadSampler.
-
Constructor Summary
Constructors Constructor Description RoadSampler(Set<ExtendedDataType<?,?,?,GtuData>> extendedDataTypes, Set<FilterDataType<?>> filterDataTypes, OTSRoadNetwork network)Constructor which uses the operational plan updates of GTU's as sampling interval.RoadSampler(Set<ExtendedDataType<?,?,?,GtuData>> extendedDataTypes, Set<FilterDataType<?>> filterDataTypes, OTSRoadNetwork network, Frequency frequency)Constructor which uses the given frequency to determine the sampling interval.RoadSampler(OTSRoadNetwork network)Constructor which uses the operational plan updates of GTU's as sampling interval.RoadSampler(OTSRoadNetwork network, Frequency frequency)Constructor which uses the given frequency to determine the sampling interval.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RoadSampler.Factorybuild(OTSRoadNetwork network)Returns a factory to create a sampler.booleanequals(Object obj)voidfinalizeRecording(KpiLaneDirection kpiLaneDirection)inthashCode()voidinitRecording(KpiLaneDirection kpiLaneDirection)voidnotify(EventInterface event)voidnotifySample(LaneBasedGTU gtu, LaneDirection laneDirection)Samples a gtu and schedules the next sampling event.Timenow()voidscheduleStartRecording(Time time, KpiLaneDirection kpiLaneDirection)voidscheduleStopRecording(Time time, KpiLaneDirection kpiLaneDirection)StringtoString()-
Methods inherited from class org.opentrafficsim.kpi.sampling.Sampler
contains, getSamplerData, processGtuAddEvent, processGtuMoveEvent, processGtuRemoveEvent, processGtuRemoveEvent, registerSpaceTimeRegion, startRecording, stopRecording
-
-
-
-
Constructor Detail
-
RoadSampler
public RoadSampler(OTSRoadNetwork network)
Constructor which uses the operational plan updates of GTU's as sampling interval.- Parameters:
network- OTSRoadNetwork; the network- Throws:
NullPointerException- if the simulator isnull
-
RoadSampler
public RoadSampler(Set<ExtendedDataType<?,?,?,GtuData>> extendedDataTypes, Set<FilterDataType<?>> filterDataTypes, OTSRoadNetwork network)
Constructor which uses the operational plan updates of GTU's as sampling interval.- Parameters:
extendedDataTypes- Set<ExtendedDataType<?, ?, ?, GtuData>>; extended data typesfilterDataTypes- Set<FilterDataType<?>>; filter data typesnetwork- OTSRoadNetwork; the network- Throws:
NullPointerException- if the simulator isnull
-
RoadSampler
public RoadSampler(OTSRoadNetwork network, Frequency frequency)
Constructor which uses the given frequency to determine the sampling interval.- Parameters:
network- OTSRoadNetwork; the networkfrequency- Frequency; sampling frequency- Throws:
NullPointerException- if an input isnullIllegalArgumentException- if frequency is negative or zero
-
RoadSampler
public RoadSampler(Set<ExtendedDataType<?,?,?,GtuData>> extendedDataTypes, Set<FilterDataType<?>> filterDataTypes, OTSRoadNetwork network, Frequency frequency)
Constructor which uses the given frequency to determine the sampling interval.- Parameters:
extendedDataTypes- Set<ExtendedDataType<?, ?, ?, GGtuData>>; extended data typesfilterDataTypes- Set<FilterDataType<?>>; filter data typesnetwork- OTSRoadNetwork; the networkfrequency- Frequency; sampling frequency- Throws:
NullPointerException- if an input isnullIllegalArgumentException- if frequency is negative or zero
-
-
Method Detail
-
scheduleStartRecording
public final void scheduleStartRecording(Time time, KpiLaneDirection kpiLaneDirection)
- Specified by:
scheduleStartRecordingin classSampler<GtuData>
-
scheduleStopRecording
public final void scheduleStopRecording(Time time, KpiLaneDirection kpiLaneDirection)
- Specified by:
scheduleStopRecordingin classSampler<GtuData>
-
initRecording
public final void initRecording(KpiLaneDirection kpiLaneDirection)
- Specified by:
initRecordingin classSampler<GtuData>
-
finalizeRecording
public final void finalizeRecording(KpiLaneDirection kpiLaneDirection)
- Specified by:
finalizeRecordingin classSampler<GtuData>
-
notify
public final void notify(EventInterface event) throws RemoteException
- Specified by:
notifyin interfaceEventListenerInterface- Throws:
RemoteException
-
notifySample
public final void notifySample(LaneBasedGTU gtu, LaneDirection laneDirection)
Samples a gtu and schedules the next sampling event.- Parameters:
gtu- LaneBasedGTU; gtu to samplelaneDirection- LaneDirection; lane direction where the gtu is at
-
build
public static RoadSampler.Factory build(OTSRoadNetwork network)
Returns a factory to create a sampler.- Parameters:
network- OTSRoadNetwork; network- Returns:
- Factory; factory to create a sampler
-
-