Package com.helger.commons.statistics
Class AbstractStatisticsHandlerKeyedNumeric
- java.lang.Object
-
- com.helger.commons.statistics.AbstractStatisticsHandlerKeyedNumeric
-
- All Implemented Interfaces:
IStatisticsHandler,IStatisticsHandlerKeyed,IStatisticsHandlerKeyedNumeric
- Direct Known Subclasses:
StatisticsHandlerKeyedSize,StatisticsHandlerKeyedTimer
@ThreadSafe public abstract class AbstractStatisticsHandlerKeyedNumeric extends Object implements IStatisticsHandlerKeyedNumeric
Abstract base class for a keyed numeric statistic handler- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description AbstractStatisticsHandlerKeyedNumeric()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddValue(String sKey, long nValue)ICommonsSet<String>getAllKeys()longgetAverage(String sKey)intgetInvocationCount()intgetInvocationCount(String sKey)Get the invocation count for a single key.longgetMax(String sKey)longgetMin(String sKey)BigIntegergetSum(String sKey)
-
-
-
Method Detail
-
getInvocationCount
@Nonnegative public final int getInvocationCount()
- Specified by:
getInvocationCountin interfaceIStatisticsHandler- Returns:
- The number of times this statistics hander was invoked.
-
getAllKeys
@Nonnull @ReturnsMutableCopy public ICommonsSet<String> getAllKeys()
- Specified by:
getAllKeysin interfaceIStatisticsHandlerKeyed- Returns:
- A collection of all keys that have a value assigned. Never
null.
-
getInvocationCount
@CheckForSigned public final int getInvocationCount(@Nullable String sKey)
Description copied from interface:IStatisticsHandlerKeyedGet the invocation count for a single key.- Specified by:
getInvocationCountin interfaceIStatisticsHandlerKeyed- Parameters:
sKey- The key to be queried. May benull.- Returns:
- The invocation count for a single key or
CGlobal.ILLEGAL_UINTif no such key exists
-
getSum
@Nullable public final BigInteger getSum(@Nullable String sKey)
- Specified by:
getSumin interfaceIStatisticsHandlerKeyedNumeric- Parameters:
sKey- The key to be queried.- Returns:
- The sum of aggregated values.
nullif no such key exists.
-
getMin
@CheckForSigned public final long getMin(@Nullable String sKey)
- Specified by:
getMinin interfaceIStatisticsHandlerKeyedNumeric- Parameters:
sKey- The key to be queried.- Returns:
- The smallest value. Returns
CGlobal.ILLEGAL_ULONGif no such key exists.
-
getAverage
@CheckForSigned public final long getAverage(@Nullable String sKey)
- Specified by:
getAveragein interfaceIStatisticsHandlerKeyedNumeric- Parameters:
sKey- The key to be queried.- Returns:
- The average value (=sum/invocationCount). Returns
CGlobal.ILLEGAL_ULONGif no such key exists.
-
getMax
@CheckForSigned public long getMax(@Nullable String sKey)
- Specified by:
getMaxin interfaceIStatisticsHandlerKeyedNumeric- Parameters:
sKey- The key to be queried.- Returns:
- The biggest value. Returns
CGlobal.ILLEGAL_ULONGif no such key exists.
-
-