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-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 Jacobs
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getCount()
Returns the current counter value.Returns the description of the statistic.long
getN()
Return the current number of observations.void
Initialize the counter.long
register
(long value) Process one observed value.static String
Return a string representing a footer for a textual table with a monospaced font that can contain multiple statistics.static String
Return 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.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djutils.stats.summarizers.Statistic
formatFixed
-
Constructor Details
-
Counter
Constructs a new Counter.- Parameters:
description
- String; the description for this counter
-
-
Method Details
-
getCount
public long getCount()Returns the current counter value.- Returns:
- long; the counter value
-
getN
public long getN()Description copied from interface:Statistic
Return the current number of observations. -
register
public long register(long value) Process one observed value.- Parameters:
value
- long; the value to process- Returns:
- long; the value
-
initialize
public void initialize()Initialize the counter.- Specified by:
initialize
in interfaceStatistic
-
getDescription
Description copied from interface:Statistic
Returns the description of the statistic.- Specified by:
getDescription
in interfaceStatistic
- Returns:
- String; 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:
- String; header for the textual table.
-
reportLine
Description copied from interface:Statistic
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.- Specified by:
reportLine
in interfaceStatistic
- Returns:
- String; line with most important values of the statistic
-
toString
-