Class EventBasedWeightedTally

java.lang.Object
org.djutils.stats.summarizers.WeightedTally
org.djutils.stats.summarizers.event.EventBasedWeightedTally
All Implemented Interfaces:
EventListener, EventListener, EventProducer, Statistic, TallyStatistic

public class EventBasedWeightedTally extends WeightedTally implements EventProducer, EventListener
The EventBasedWeightedTally class defines a time-weighted tally that can be notified with weights and values using the EventListener. It also produces events when values are tallied and when the tally is initialized. It embeds an EventProducer so it can keep listeners informed about new observations.

Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://simulation.tudelft.nl/dsol/3.0/license.html.

Author:
Alexander Verbraeck, Peter Knoppers
  • Constructor Details

    • EventBasedWeightedTally

      public EventBasedWeightedTally(String description)
      Construct a new WeightedTally with a description.
      Parameters:
      description - the description of this WeightedTally
    • EventBasedWeightedTally

      public EventBasedWeightedTally(String description, EventProducer eventProducer)
      Construct a new WeightedTally with a description.
      Parameters:
      description - the description of this WeightedTally
      eventProducer - the EventProducer to embed and use in this statistic
  • Method Details

    • getEventListenerMap

      public EventListenerMap getEventListenerMap()
      Specified by:
      getEventListenerMap in interface EventProducer
    • initialize

      public void initialize()
      Description copied from interface: Statistic
      Initialize the statistic.
      Specified by:
      initialize in interface Statistic
      Overrides:
      initialize in class WeightedTally
    • notify

      public void notify(Event event)
      Specified by:
      notify in interface EventListener
    • register

      public double register(double weight, double value)
      Process one observed weighted value.
      Overrides:
      register in class WeightedTally
      Parameters:
      weight - the weight of the value to process
      value - the value to process
      Returns:
      the value
    • fireEvents

      protected void fireEvents()
      Method that can be overridden to fire own events or additional events when registering an observation.
    • toString

      public String toString()
      Overrides:
      toString in class WeightedTally