Package org.djutils.stats.summarizers
Class Counter
- java.lang.Object
-
- org.djutils.stats.summarizers.Counter
-
- All Implemented Interfaces:
Serializable,Statistic
- Direct Known Subclasses:
EventBasedCounter
public class Counter extends Object implements Statistic
The Counter class defines a statistics event counter.Copyright (c) 2002-2023 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:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCount()Returns the current counter value.StringgetDescription()Returns the description of the statistic.longgetN()Return the current number of observations.voidinitialize()Initialize the counter.longregister(long value)Process one observed value.static StringreportFooter()Return a string representing a footer for a textual table with a monospaced font that can contain multiple statistics.static StringreportHeader()Return a string representing a header for a textual table with a monospaced font that can contain multiple statistics.StringreportLine()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.StringtoString()-
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 Detail
-
Counter
public Counter(String description)
Constructs a new Counter.- Parameters:
description- String; the description for this counter
-
-
Method Detail
-
getCount
public long getCount()
Returns the current counter value.- Returns:
- long; the counter value
-
getN
public long getN()
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:
initializein interfaceStatistic
-
getDescription
public String getDescription()
Returns the description of the statistic.- Specified by:
getDescriptionin interfaceStatistic- Returns:
- String; the description of the statistic
-
reportHeader
public static String 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
public String reportLine()
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:
reportLinein interfaceStatistic- Returns:
- String; line with most important values of the statistic
-
reportFooter
public static String reportFooter()
Return a string representing a footer for a textual table with a monospaced font that can contain multiple statistics.- Returns:
- String; footer for the textual table
-
-