Class RoadSampler

    • 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:
        java.lang.NullPointerException - if the simulator is null
      • RoadSampler

        public RoadSampler​(java.util.Set<ExtendedDataType<?,​?,​?,​GtuData>> extendedDataTypes,
                           java.util.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 types
        filterDataTypes - Set<FilterDataType<?>>; filter data types
        network - OTSRoadNetwork; the network
        Throws:
        java.lang.NullPointerException - if the simulator is null
      • RoadSampler

        public RoadSampler​(OTSRoadNetwork network,
                           Frequency frequency)
        Constructor which uses the given frequency to determine the sampling interval.
        Parameters:
        network - OTSRoadNetwork; the network
        frequency - Frequency; sampling frequency
        Throws:
        java.lang.NullPointerException - if an input is null
        java.lang.IllegalArgumentException - if frequency is negative or zero
      • RoadSampler

        public RoadSampler​(java.util.Set<ExtendedDataType<?,​?,​?,​GtuData>> extendedDataTypes,
                           java.util.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 types
        filterDataTypes - Set<FilterDataType<?>>; filter data types
        network - OTSRoadNetwork; the network
        frequency - Frequency; sampling frequency
        Throws:
        java.lang.NullPointerException - if an input is null
        java.lang.IllegalArgumentException - if frequency is negative or zero
    • Method Detail

      • notifySample

        public final void notifySample​(LaneBasedGTU gtu,
                                       LaneDirection laneDirection)
        Samples a gtu and schedules the next sampling event.
        Parameters:
        gtu - LaneBasedGTU; gtu to sample
        laneDirection - LaneDirection; lane direction where the gtu is at
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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