messif.statistics
Class StatisticSimpleWeakrefCounter

java.lang.Object
  extended by messif.statistics.Statistics<StatisticSimpleWeakrefCounter>
      extended by messif.statistics.StatisticSimpleWeakrefCounter
All Implemented Interfaces:
java.io.Serializable

public class StatisticSimpleWeakrefCounter
extends Statistics<StatisticSimpleWeakrefCounter>

See Also:
Serialized Form

Field Summary
protected  java.util.Map<java.lang.Object,java.lang.Long> values
          Reference counter data
 
Fields inherited from class messif.statistics.Statistics
replaceWith
 
Constructor Summary
protected StatisticSimpleWeakrefCounter(java.lang.String name)
          Creates a new instance of StatisticRefCounter
 
Method Summary
 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.
protected  StatisticSimpleWeakrefCounter cast()
          Returns this statistics as the type provided typed argument.
 boolean containsKey(java.lang.Object key)
           
protected  int deepHashCode()
           
 long get(java.lang.Object key)
          Reference counter read operations
 int getKeyCount()
           
 java.util.Set<java.lang.Object> getKeys()
           
static StatisticSimpleWeakrefCounter getStatistics(java.lang.String name)
          Create new statistic object with specified name or get the one already existing
 boolean changedSinceCheckpoint()
          Reports if value of refCounter has been changed since the last setCheckpoint() call.
 boolean remove(java.lang.Object key, boolean propagateDelete)
          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(StatisticSimpleWeakrefCounter 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
protected  void updateFrom(StatisticSimpleWeakrefCounter sourceStat)
          Statistics merging
 
Methods inherited from class messif.statistics.Statistics
addBoundStat, bindTo, canPerformOperation, disableGlobally, enableGlobally, getAllStatistics, getAllStatistics, getBoundStats, getBoundTo, getName, getStatistics, isBound, isEnabledGlobally, isRegisteredGlobally, printStatistics, printStatistics, printStatistics, readResolve, removeBoundStat, removeStatistic, resetStatistics, resetStatistics, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected transient java.util.Map<java.lang.Object,java.lang.Long> values
Reference counter data

Constructor Detail

StatisticSimpleWeakrefCounter

protected StatisticSimpleWeakrefCounter(java.lang.String name)
Creates a new instance of StatisticRefCounter

Method Detail

get

public long get(java.lang.Object key)
Reference counter read operations


getKeys

public java.util.Set<java.lang.Object> getKeys()

getKeyCount

public int getKeyCount()

containsKey

public boolean containsKey(java.lang.Object key)

set

public void set(java.lang.Object key,
                long value)
Reference counter modification operations


remove

public boolean remove(java.lang.Object key,
                      boolean propagateDelete)
Return either the StatisticCounter for given key and remove it from the mapping or return null, if the key is not in the map


add

public void add(java.lang.Object key,
                long value)
Adds the passed value to the current value associated with the passed key.


add

public void add(java.lang.Object key)

sub

public void sub(java.lang.Object key,
                long value)

sub

public void sub(java.lang.Object key)

updateFrom

protected void updateFrom(StatisticSimpleWeakrefCounter sourceStat)
Statistics merging

Specified by:
updateFrom in class Statistics<StatisticSimpleWeakrefCounter>
Parameters:
sourceStat - the statistic from which to update this stat

setFrom

protected void setFrom(StatisticSimpleWeakrefCounter sourceStat)
Description copied from class: Statistics
Set the value of this statistic to the actual value of the given sourceStat.

Specified by:
setFrom in class Statistics<StatisticSimpleWeakrefCounter>
Parameters:
sourceStat - the statistic from which to set this stat

reset

public void reset()
Reset the current statistic (this one only).

Specified by:
reset in class Statistics<StatisticSimpleWeakrefCounter>

getStatistics

public static StatisticSimpleWeakrefCounter getStatistics(java.lang.String name)
                                                   throws java.lang.ClassCastException
Create new statistic object with specified name or get the one already existing

Throws:
java.lang.ClassCastException

toString

public java.lang.String toString()
Text representation

Overrides:
toString in class java.lang.Object

deepHashCode

protected int deepHashCode()

changedSinceCheckpoint

public boolean changedSinceCheckpoint()
Reports if value of refCounter has been changed since the last setCheckpoint() call.


setCheckpoint

public void setCheckpoint()
Sets checkpoint. Stores the current state of refCounter.


cast

protected StatisticSimpleWeakrefCounter cast()
Description copied from class: Statistics
Returns this statistics as the type provided typed argument. This is a convenience method to avoid unchecked casts.

Specified by:
cast in class Statistics<StatisticSimpleWeakrefCounter>
Returns:
this statistics