Package com.helger.commons.statistics
Class StatisticsHandlerKeyedCounter
- java.lang.Object
-
- com.helger.commons.statistics.StatisticsHandlerKeyedCounter
-
- All Implemented Interfaces:
IMutableStatisticsHandlerKeyedCounter,IStatisticsHandler,IStatisticsHandlerKeyed,IStatisticsHandlerKeyedCounter
@ThreadSafe public class StatisticsHandlerKeyedCounter extends Object implements IMutableStatisticsHandlerKeyedCounter
Default implementation ofIMutableStatisticsHandlerKeyedCounter- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description StatisticsHandlerKeyedCounter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ICommonsSet<String>getAllKeys()longgetCount(String sKey)Get the count of a certain key.intgetInvocationCount()intgetInvocationCount(String sKey)Get the invocation count for a single key.voidincrement(String sKey, long nByHowMany)Increment by n-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.helger.commons.statistics.IMutableStatisticsHandlerKeyedCounter
increment
-
-
-
-
Method Detail
-
getInvocationCount
@Nonnegative public int getInvocationCount()
- Specified by:
getInvocationCountin interfaceIStatisticsHandler- Returns:
- The number of times this statistics hander was invoked.
-
increment
public void increment(@Nullable String sKey, long nByHowMany)
Description copied from interface:IMutableStatisticsHandlerKeyedCounterIncrement by n- Specified by:
incrementin interfaceIMutableStatisticsHandlerKeyedCounter- Parameters:
sKey- The key to be incremented.nByHowMany- The amount to increment. May be negative as well
-
getAllKeys
@Nonnull @ReturnsMutableCopy public ICommonsSet<String> getAllKeys()
- Specified by:
getAllKeysin interfaceIStatisticsHandlerKeyed- Returns:
- A collection of all keys that have a value assigned. Never
null.
-
getCount
@CheckForSigned public long getCount(@Nullable String sKey)
Description copied from interface:IStatisticsHandlerKeyedCounterGet the count of a certain key.- Specified by:
getCountin interfaceIStatisticsHandlerKeyedCounter- Parameters:
sKey- The key to retrieve the count from- Returns:
CGlobal.ILLEGAL_ULONGif no such key is present.
-
getInvocationCount
@CheckForSigned public 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
-
-