public final class StatisticRefCounter extends Statistics<StatisticRefCounter>
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.Object,StatisticCounter> |
values
Reference counter data
|
replaceWith
Modifier | Constructor and Description |
---|---|
protected |
StatisticRefCounter(java.lang.String name)
Creates a new instance of StatisticRefCounter
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.Object key) |
void |
add(java.lang.Object key,
long value)
Adds the passed value to the current value associated with the passed key.
|
void |
bindTo(StatisticCounter object,
java.lang.Object key)
Bind current statistics object to receive notifications at the same time as the specified statistics receives some.
|
void |
bindTo(StatisticRefCounter object)
Bind current statistics object to receive notifications at the same time as the specified statistics receives some.
|
protected StatisticRefCounter |
cast()
Returns this statistics as the type provided typed argument.
|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
long |
get(java.lang.Object key)
Reference counter read operations
|
int |
getKeyCount() |
java.util.Set<java.lang.Object> |
getKeys() |
protected StatisticCounter |
getStatisticCounter(java.lang.Object key,
boolean createIfNotExist)
Return the statistic counter associated with the provided key.
|
protected StatisticCounter |
getStatisticCounter(java.lang.Object key,
boolean createIfNotExist,
long initialValue)
Return the statistic counter associated with the provided key.
|
static StatisticRefCounter |
getStatistics(java.lang.String name)
Create new statistic object with specified name or get the one already existing
|
java.util.Map<java.lang.Object,StatisticCounter> |
getValue()
Returns the value of this statistic.
|
boolean |
changedSinceCheckpoint()
Reports if value of refCounter has been changed since the last setCheckpoint() call.
|
void |
max(java.lang.Object key,
long value)
Set the passed value to the current value associated with the passed key if it is greater than current value.
|
void |
min(java.lang.Object key,
long value)
Set the passed value to the current value associated with the passed key if it is smaller than current value.
|
StatisticCounter |
remove(java.lang.Object key)
Return either the StatisticCounter for given key and remove it from the mapping or return null, if the key is not in the map
|
void |
reset()
Reset the current statistic (this one only).
|
void |
set(java.lang.Object key,
long value)
Reference counter modification operations
|
protected void |
setFrom(StatisticRefCounter sourceStat)
Set the value of this statistic to the actual value of the given
sourceStat . |
void |
setCheckpoint()
Sets checkpoint.
|
void |
sub(java.lang.Object key) |
void |
sub(java.lang.Object key,
long value) |
java.lang.String |
toString()
Text representation
|
void |
turnToInsertOrdered()
Changes the collection of this statistics ref counter to
LinkedHashMap . |
void |
unbind()
RefCounter binding overrides
|
void |
unbind(java.lang.Object key)
Deregister statistic counter for key from the binding list
|
protected void |
updateFrom(StatisticRefCounter sourceStat)
Statistics merging
|
addBoundStat, canPerformOperation, disableGlobally, enableGlobally, getAllStatistics, getAllStatistics, getBoundStats, getBoundTo, getName, getStatistics, isBound, isEnabledGlobally, isRegisteredGlobally, printStatistics, printStatistics, printStatistics, readResolve, removeBoundStat, removeStatistic, resetStatistics, resetStatistics
protected java.util.Map<java.lang.Object,StatisticCounter> values
protected StatisticRefCounter(java.lang.String name)
public long get(java.lang.Object key)
public java.util.Set<java.lang.Object> getKeys()
public int getKeyCount()
public boolean containsKey(java.lang.Object key)
public java.util.Map<java.lang.Object,StatisticCounter> getValue()
Statistics
getValue
in class Statistics<StatisticRefCounter>
protected StatisticCounter getStatisticCounter(java.lang.Object key, boolean createIfNotExist, long initialValue)
key
- the reference key of the retrieved counterprotected StatisticCounter getStatisticCounter(java.lang.Object key, boolean createIfNotExist)
key
- the reference key of the retrieved counterpublic void set(java.lang.Object key, long value)
public StatisticCounter remove(java.lang.Object key)
public void add(java.lang.Object key, long value)
public void add(java.lang.Object key)
public void sub(java.lang.Object key, long value)
public void sub(java.lang.Object key)
public void max(java.lang.Object key, long value)
public void min(java.lang.Object key, long value)
public void clear()
protected void updateFrom(StatisticRefCounter sourceStat)
updateFrom
in class Statistics<StatisticRefCounter>
sourceStat
- the statistic from which to update this statprotected void setFrom(StatisticRefCounter sourceStat)
Statistics
sourceStat
.setFrom
in class Statistics<StatisticRefCounter>
sourceStat
- the statistic from which to set this statpublic void reset()
reset
in class Statistics<StatisticRefCounter>
public void turnToInsertOrdered()
LinkedHashMap
.public void bindTo(StatisticCounter object, java.lang.Object key) throws java.lang.IllegalArgumentException
object
- the parent statistics counter objectkey
- the reference key of our counter to bind it tojava.lang.IllegalArgumentException
public void unbind(java.lang.Object key)
public void unbind()
unbind
in class Statistics<StatisticRefCounter>
public void bindTo(StatisticRefCounter object) throws java.lang.IllegalArgumentException
bindTo
in class Statistics<StatisticRefCounter>
object
- the parent statistics objectjava.lang.IllegalArgumentException
- if this statistic is already bound to another statpublic static StatisticRefCounter getStatistics(java.lang.String name) throws java.lang.ClassCastException
java.lang.ClassCastException
public java.lang.String toString()
toString
in class java.lang.Object
public boolean changedSinceCheckpoint()
public void setCheckpoint()
protected StatisticRefCounter cast()
Statistics
cast
in class Statistics<StatisticRefCounter>