Class EventBasedWeightedTally
java.lang.Object
org.djutils.stats.summarizers.WeightedTally
org.djutils.stats.summarizers.event.EventBasedWeightedTally
- All Implemented Interfaces:
Serializable
,Remote
,EventListener
,org.djutils.event.EventListener
,org.djutils.event.EventProducer
,Statistic
,TallyStatistic
public class EventBasedWeightedTally
extends WeightedTally
implements org.djutils.event.EventProducer, org.djutils.event.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-2024 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
- See Also:
-
Field Summary
Fields inherited from class org.djutils.stats.summarizers.WeightedTally
semaphore
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ConstructorDescriptionEventBasedWeightedTally
(String description) Construct a new WeightedTally with a description.EventBasedWeightedTally
(String description, org.djutils.event.EventProducer eventProducer) Construct a new WeightedTally with a description. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Method that can be overridden to fire own events or additional events when registering an observation.org.djutils.event.EventListenerMap
void
Initialize the statistic.void
notify
(org.djutils.event.Event event) double
register
(double weight, double value) Process one observed weighted value.toString()
Methods inherited from class org.djutils.stats.summarizers.WeightedTally
getDescription, getMax, getMin, getN, getWeightedPopulationMean, getWeightedPopulationStDev, getWeightedPopulationVariance, getWeightedSampleMean, getWeightedSampleStDev, getWeightedSampleVariance, getWeightedSum, reportFooter, reportHeader, reportLine
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from interface org.djutils.stats.summarizers.Statistic
formatFixed
-
Constructor Details
-
EventBasedWeightedTally
Construct a new WeightedTally with a description.- Parameters:
description
- String; the description of this WeightedTally
-
EventBasedWeightedTally
Construct a new WeightedTally with a description.- Parameters:
description
- String; the description of this WeightedTallyeventProducer
- EventProducer; the EventProducer to embed and use in this statistic
-
-
Method Details
-
getEventListenerMap
- Specified by:
getEventListenerMap
in interfaceorg.djutils.event.EventProducer
- Throws:
RemoteException
-
initialize
public void initialize()Description copied from interface:Statistic
Initialize the statistic.- Specified by:
initialize
in interfaceStatistic
- Overrides:
initialize
in classWeightedTally
-
notify
public void notify(org.djutils.event.Event event) - Specified by:
notify
in interfaceorg.djutils.event.EventListener
-
register
public double register(double weight, double value) Process one observed weighted value.- Overrides:
register
in classWeightedTally
- Parameters:
weight
- double; the weight of the value to processvalue
- double; the value to process- Returns:
- double; the value
-
fireEvents
Method that can be overridden to fire own events or additional events when registering an observation.- Throws:
RemoteException
- on network error
-
toString
- Overrides:
toString
in classWeightedTally
-