Package org.djutils.stats.summarizers
Class Counter
java.lang.Object
org.djutils.stats.summarizers.Counter
- All Implemented Interfaces:
Serializable,Statistic
- Direct Known Subclasses:
EventBasedCounter
The Counter class defines a statistics event counter.
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 Jacobs
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetCount()Returns the current counter value.Returns the description of the statistic.longgetN()Return the current number of observations.voidInitialize the counter.longregister(long value) Process one observed value.static StringReturn a string representing a footer for a textual table with a monospaced font that can contain multiple statistics.static StringReturn a string representing a header for a textual table with a monospaced font that can contain multiple statistics.Return a string representing a line with important statistics values for this statistic, for a textual table with a monospaced font that can contain multiple statistics.voidsetDescription(String description) Set a new description of the statistic.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.djutils.stats.summarizers.Statistic
formatFixed
-
Constructor Details
-
Counter
Constructs a new Counter.- Parameters:
description- the description for this counter
-
-
Method Details
-
getCount
public long getCount()Returns the current counter value.- Returns:
- the counter value
-
getN
public long getN()Description copied from interface:StatisticReturn the current number of observations. -
setDescription
Description copied from interface:StatisticSet a new description of the statistic.- Specified by:
setDescriptionin interfaceStatistic- Parameters:
description- the new description of the statistic
-
register
public long register(long value) Process one observed value.- Parameters:
value- the value to process- Returns:
- the value
-
initialize
public void initialize()Initialize the counter.- Specified by:
initializein interfaceStatistic
-
getDescription
Description copied from interface:StatisticReturns the description of the statistic.- Specified by:
getDescriptionin interfaceStatistic- Returns:
- the description of the statistic
-
reportHeader
Return a string representing a header for a textual table with a monospaced font that can contain multiple statistics.- Returns:
- header for the textual table.
-
reportLine
Description copied from interface:StatisticReturn a string representing a line with important statistics values for this statistic, for a textual table with a monospaced font that can contain multiple statistics.- Specified by:
reportLinein interfaceStatistic- Returns:
- line with most important values of the statistic
-
toString
-