Class EventBasedWeightedTally
java.lang.Object
org.djutils.event.EventProducer
org.djutils.stats.summarizers.event.EventBasedWeightedTally
- All Implemented Interfaces:
Serializable,EventListener,org.djutils.event.EventListenerInterface,org.djutils.event.EventProducerInterface,BasicTallyInterface,WeightedTallyInterface
public class EventBasedWeightedTally extends org.djutils.event.EventProducer implements org.djutils.event.EventListenerInterface, WeightedTallyInterface
The EventBasedWeightedTally class defines a time-weighted tally that can be notified with weights and values using the
EventListenerInterface. It also produces events when values are tallied and when the tally is initialized.
Copyright (c) 2002-2020 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:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description EventBasedWeightedTally(String description)Construct a new WeightedTally with a description. -
Method Summary
Modifier and Type Method Description protected voidfireEvents()Method that can be overridden to fire own events or additional events when ingesting an observation.StringgetDescription()returns the description of this tally.doublegetMax()Returns the max.doublegetMin()Returns the min.longgetN()Returns the number of observations.SerializablegetSourceId()doublegetWeightedPopulationStDev()Retrieve the current weighted standard deviation of the observations.doublegetWeightedPopulationVariance()Retrieve the current weighted variance of the observations.doublegetWeightedSampleMean()Retrieve the current weighted sample mean of all observations since the initialization.doublegetWeightedSampleStDev()Retrieve the current weighted sample standard deviation of the observations.doublegetWeightedSampleVariance()Retrieve the current weighted sample variance of the observations.doublegetWeightedSum()Retrieve the current weighted sum of the values of the observations.doubleingest(double weight, double value)Process one observed weighted value.voidinitialize()initializes the Tally.voidnotify(org.djutils.event.EventInterface event)StringtoString()Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.stats.summarizers.WeightedTallyInterface
getWeightedPopulationMean
-
Constructor Details
-
EventBasedWeightedTally
Construct a new WeightedTally with a description.- Parameters:
description- String; the description of this WeightedTally
-
-
Method Details
-
getSourceId
- Specified by:
getSourceIdin interfaceorg.djutils.event.EventProducerInterface- Specified by:
getSourceIdin classorg.djutils.event.EventProducer
-
getDescription
returns the description of this tally.- Specified by:
getDescriptionin interfaceBasicTallyInterface- Returns:
- Sting description
-
getMax
public final double getMax()Returns the max.- Specified by:
getMaxin interfaceBasicTallyInterface- Returns:
- double
-
getMin
public final double getMin()Returns the min.- Specified by:
getMinin interfaceBasicTallyInterface- Returns:
- double
-
getN
public final long getN()Returns the number of observations.- Specified by:
getNin interfaceBasicTallyInterface- Returns:
- long n
-
getWeightedSampleMean
public final double getWeightedSampleMean()Retrieve the current weighted sample mean of all observations since the initialization.- Specified by:
getWeightedSampleMeanin interfaceWeightedTallyInterface- Returns:
- double; the current weighted sample mean
-
getWeightedSampleStDev
public final double getWeightedSampleStDev()Retrieve the current weighted sample standard deviation of the observations.- Specified by:
getWeightedSampleStDevin interfaceWeightedTallyInterface- Returns:
- double; the current weighted sample standard deviation
-
getWeightedPopulationStDev
public final double getWeightedPopulationStDev()Retrieve the current weighted standard deviation of the observations.- Specified by:
getWeightedPopulationStDevin interfaceWeightedTallyInterface- Returns:
- double; the current weighted standard deviation
-
getWeightedSampleVariance
public final double getWeightedSampleVariance()Retrieve the current weighted sample variance of the observations.- Specified by:
getWeightedSampleVariancein interfaceWeightedTallyInterface- Returns:
- double; the current weighted sample variance of the observations
-
getWeightedPopulationVariance
public final double getWeightedPopulationVariance()Retrieve the current weighted variance of the observations.- Specified by:
getWeightedPopulationVariancein interfaceWeightedTallyInterface- Returns:
- double; the current weighted variance of the observations
-
getWeightedSum
public final double getWeightedSum()Retrieve the current weighted sum of the values of the observations.- Specified by:
getWeightedSumin interfaceWeightedTallyInterface- Returns:
- double; the current weighted sum of the values of the observations
-
initialize
public void initialize()initializes the Tally. This methods sets the max, min, n, sum and variance values to their initial values.- Specified by:
initializein interfaceBasicTallyInterface
-
notify
public void notify(org.djutils.event.EventInterface event)- Specified by:
notifyin interfaceorg.djutils.event.EventListenerInterface
-
ingest
public double ingest(double weight, double value)Process one observed weighted value.- Parameters:
weight- double; the weight of the value to processvalue- double; the value to process- Returns:
- double; the value
-
fireEvents
protected void fireEvents()Method that can be overridden to fire own events or additional events when ingesting an observation. -
toString
-