messif.statistics
Class StatisticCounter

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

public final class StatisticCounter
extends Statistics<StatisticCounter>

See Also:
Serialized Form

Field Summary
protected  long value
           
 
Fields inherited from class messif.statistics.Statistics
replaceWith
 
Constructor Summary
protected StatisticCounter(java.lang.String name)
          Creates a new instance of StatisticCounter
protected StatisticCounter(java.lang.String name, long value)
          Creates a new instance of StatisticCounter
 
Method Summary
 void add()
           
 void add(long value)
           
protected  StatisticCounter cast()
          Returns this statistics as the type provided typed argument.
 long get()
           
static StatisticCounter getStatistics(java.lang.String name)
          Create new statistic counter with specified name or get the one already existing
 boolean changedSinceCheckpoint()
          Reports if value of counter has been changed since the last setCheckpoint() call.
 void max(long value)
           
 void min(long value)
           
 void reset()
          Reset the current statistic (this one only).
 void set(long value)
           
protected  void setFrom(StatisticCounter sourceStat)
          Set the value of this statistic to the actual value of the given sourceStat.
 void setCheckpoint()
          Sets checkpoint.
 void sub()
           
 void sub(long value)
           
 java.lang.String toString()
           
protected  void updateFrom(StatisticCounter sourceStat)
          Updates the value of this statistic from the given sourceStat.
 
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

value

protected long value
Constructor Detail

StatisticCounter

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


StatisticCounter

protected StatisticCounter(java.lang.String name,
                           long value)
Creates a new instance of StatisticCounter

Method Detail

cast

protected StatisticCounter 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<StatisticCounter>
Returns:
this statistics

set

public void set(long value)

add

public void add(long value)

add

public void add()

sub

public void sub(long value)

sub

public void sub()

get

public long get()

max

public void max(long value)

min

public void min(long value)

updateFrom

protected void updateFrom(StatisticCounter sourceStat)
Description copied from class: Statistics
Updates the value of this statistic from the given sourceStat. Specifically, this method merges the value of the sourceStat with this statistic.

The actual implementation depends on the type of the statistic.

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

setFrom

protected void setFrom(StatisticCounter 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<StatisticCounter>
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<StatisticCounter>

getStatistics

public static StatisticCounter getStatistics(java.lang.String name)
Create new statistic counter with specified name or get the one already existing


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

changedSinceCheckpoint

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


setCheckpoint

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