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 class
RoadSampler.Factory
Factory 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.Factory
build(OTSRoadNetwork network)
Returns a factory to create a sampler.boolean
equals(Object obj)
void
finalizeRecording(KpiLaneDirection kpiLaneDirection)
int
hashCode()
void
initRecording(KpiLaneDirection kpiLaneDirection)
void
notify(EventInterface event)
void
notifySample(LaneBasedGTU gtu, LaneDirection laneDirection)
Samples a gtu and schedules the next sampling event.Time
now()
void
scheduleStartRecording(Time time, KpiLaneDirection kpiLaneDirection)
void
scheduleStopRecording(Time time, KpiLaneDirection kpiLaneDirection)
String
toString()
-
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 isnull
IllegalArgumentException
- 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 isnull
IllegalArgumentException
- if frequency is negative or zero
-
-
Method Detail
-
scheduleStartRecording
public final void scheduleStartRecording(Time time, KpiLaneDirection kpiLaneDirection)
- Specified by:
scheduleStartRecording
in classSampler<GtuData>
-
scheduleStopRecording
public final void scheduleStopRecording(Time time, KpiLaneDirection kpiLaneDirection)
- Specified by:
scheduleStopRecording
in classSampler<GtuData>
-
initRecording
public final void initRecording(KpiLaneDirection kpiLaneDirection)
- Specified by:
initRecording
in classSampler<GtuData>
-
finalizeRecording
public final void finalizeRecording(KpiLaneDirection kpiLaneDirection)
- Specified by:
finalizeRecording
in classSampler<GtuData>
-
notify
public final void notify(EventInterface event) throws RemoteException
- Specified by:
notify
in 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
-
-