Class RoadSampler
java.lang.Object
org.opentrafficsim.kpi.sampling.Sampler<GtuDataRoad,LaneDataRoad>
org.opentrafficsim.road.network.sampling.RoadSampler
- All Implemented Interfaces:
EventListener,EventListener
Implementation of kpi sampler for OTS.
Copyright (c) 2013-2024 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 -
Constructor Summary
ConstructorsConstructorDescriptionRoadSampler(Set<ExtendedDataType<?, ?, ?, ? super GtuDataRoad>> extendedDataTypes, Set<FilterDataType<?, ? super GtuDataRoad>> filterDataTypes, RoadNetwork network) Constructor which uses the operational plan updates of GTU's as sampling interval.RoadSampler(Set<ExtendedDataType<?, ?, ?, ? super GtuDataRoad>> extendedDataTypes, Set<FilterDataType<?, ? super GtuDataRoad>> filterDataTypes, RoadNetwork network, Frequency frequency) Constructor which uses the given frequency to determine the sampling interval.RoadSampler(RoadNetwork network) Constructor which uses the operational plan updates of GTU's as sampling interval.RoadSampler(RoadNetwork network, Frequency frequency) Constructor which uses the given frequency to determine the sampling interval. -
Method Summary
Modifier and TypeMethodDescriptionstatic RoadSampler.Factorybuild(RoadNetwork network) Returns a factory to create a sampler.booleanfinal voidinthashCode()final voidinitRecording(LaneDataRoad lane) final voidfinal Durationnow()final voidscheduleStartRecording(Duration time, LaneDataRoad lane) final voidscheduleStopRecording(Duration time, LaneDataRoad lane) final StringtoString()Methods inherited from class org.opentrafficsim.kpi.sampling.Sampler
addGtu, addGtuWithSnapshot, contains, getSamplerData, registerSpaceTimeRegion, removeGtu, removeGtuWithSnapshot, snapshot, startRecording, stopRecording
-
Constructor Details
-
RoadSampler
Constructor which uses the operational plan updates of GTU's as sampling interval.- Parameters:
network- the network- Throws:
NullPointerException- if the simulator isnull
-
RoadSampler
public RoadSampler(Set<ExtendedDataType<?, ?, ?, ? super GtuDataRoad>> extendedDataTypes, Set<FilterDataType<?, ? super GtuDataRoad>> filterDataTypes, RoadNetwork network) Constructor which uses the operational plan updates of GTU's as sampling interval.- Parameters:
extendedDataTypes- extended data typesfilterDataTypes- filter data typesnetwork- the network- Throws:
NullPointerException- if the simulator isnull
-
RoadSampler
Constructor which uses the given frequency to determine the sampling interval.- Parameters:
network- the networkfrequency- sampling frequency- Throws:
NullPointerException- if an input isnullIllegalArgumentException- if frequency is negative or zero
-
RoadSampler
public RoadSampler(Set<ExtendedDataType<?, ?, ?, ? super GtuDataRoad>> extendedDataTypes, Set<FilterDataType<?, ? super GtuDataRoad>> filterDataTypes, RoadNetwork network, Frequency frequency) Constructor which uses the given frequency to determine the sampling interval.- Parameters:
extendedDataTypes- extended data typesfilterDataTypes- filter data typesnetwork- the networkfrequency- sampling frequency- Throws:
NullPointerException- if an input isnullIllegalArgumentException- if frequency is negative or zero
-
-
Method Details
-
now
- Specified by:
nowin classSampler<GtuDataRoad,LaneDataRoad>
-
scheduleStartRecording
- Specified by:
scheduleStartRecordingin classSampler<GtuDataRoad,LaneDataRoad>
-
scheduleStopRecording
- Specified by:
scheduleStopRecordingin classSampler<GtuDataRoad,LaneDataRoad>
-
initRecording
- Specified by:
initRecordingin classSampler<GtuDataRoad,LaneDataRoad>
-
finalizeRecording
- Specified by:
finalizeRecordingin classSampler<GtuDataRoad,LaneDataRoad>
-
notify
- Specified by:
notifyin interfaceEventListener
-
hashCode
public int hashCode()- Overrides:
hashCodein classSampler<GtuDataRoad,LaneDataRoad>
-
equals
- Overrides:
equalsin classSampler<GtuDataRoad,LaneDataRoad>
-
toString
-
build
Returns a factory to create a sampler.- Parameters:
network- network- Returns:
- factory to create a sampler
-