Interface Detector.DetectorMeasurement<C,​A>

  • Type Parameters:
    C - accumulated type
    A - aggregated type
    All Known Implementing Classes:
    Detector.PlatoonSizes
    Enclosing class:
    Detector

    public static interface Detector.DetectorMeasurement<C,​A>
    Interface for what detectors measure.

    Copyright (c) 2013-2022 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 mrt. 2018
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Method Detail

      • identity

        C identity()
        Returns the initial value before accumulation.
        Returns:
        C; initial value before accumulation
      • accumulateEntry

        C accumulateEntry​(C cumulative,
                          LaneBasedGTU gtu,
                          Detector loopDetector)
        Returns an accumulated value for when the front reaches the detector. GTU's may trigger an exit without having triggered an entry due to a lane change. Reversely, GTU's may not trigger an exit while they did trigger an entry.
        Parameters:
        cumulative - C; accumulated value
        gtu - LaneBasedGTU; gtu
        loopDetector - Detector; loop detector
        Returns:
        C; accumulated value
      • accumulateExit

        C accumulateExit​(C cumulative,
                         LaneBasedGTU gtu,
                         Detector loopDetector)
        Returns an accumulated value for when the rear leaves the detector. GTU's may trigger an exit without having triggered an entry due to a lane change. Reversely, GTU's may not trigger an exit while they did trigger an entry.
        Parameters:
        cumulative - C; accumulated value
        gtu - LaneBasedGTU; gtu
        loopDetector - Detector; loop detector
        Returns:
        C; accumulated value
      • isPeriodic

        boolean isPeriodic()
        Returns whether the measurement aggregates every aggregation period (or only over the entire simulation).
        Returns:
        boolean; whether the measurement aggregates every aggregation period (or only over the entire simulation)
      • aggregate

        A aggregate​(C cumulative,
                    int count,
                    Duration aggregation)
        Returns an aggregated value.
        Parameters:
        cumulative - C; accumulated value
        count - int; GTU count
        aggregation - Duration; aggregation period
        Returns:
        A; aggregated value
      • getName

        String getName()
        Returns the value name.
        Returns:
        String; value name
      • stringValue

        String stringValue​(A aggregate,
                           String format)
        Returns a string representation of the aggregate result.
        Parameters:
        aggregate - A; aggregate result
        format - String; format string
        Returns:
        String; string representation of the aggregate result