org.fusesource.commons.management.basic
Class StatisticImpl

java.lang.Object
  extended by org.fusesource.commons.management.basic.StatisticImpl
All Implemented Interfaces:
Statistic

public class StatisticImpl
extends java.lang.Object
implements Statistic

Basic implementation of the Statistic interface.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.fusesource.commons.management.Statistic
Statistic.UpdateMode
 
Constructor Summary
StatisticImpl(Statistic.UpdateMode updateMode)
          Instantiates a new simple statistic.
 
Method Summary
 long getUpdateCount()
          Gets the number of times the statistic has been updated since the last reset.
 long getValue()
          Gets the current value of the statistic since the last reset.
 void increment()
          Shorthand for updateValue(1).
 void reset()
          Resets the statistic's value and update count to zero.
 java.lang.String toString()
           
 void updateValue(long newValue)
          Update statistic value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatisticImpl

public StatisticImpl(Statistic.UpdateMode updateMode)
Instantiates a new simple statistic.

Parameters:
updateMode - The statistic update mode.
Method Detail

updateValue

public void updateValue(long newValue)
Description copied from interface: Statistic
Update statistic value. The update will be applied according to the Statistic.UpdateMode

Specified by:
updateValue in interface Statistic
Parameters:
newValue - the value

increment

public void increment()
Description copied from interface: Statistic
Shorthand for updateValue(1).

Specified by:
increment in interface Statistic

getValue

public long getValue()
Description copied from interface: Statistic
Gets the current value of the statistic since the last reset.

Specified by:
getValue in interface Statistic
Returns:
the value

getUpdateCount

public long getUpdateCount()
Description copied from interface: Statistic
Gets the number of times the statistic has been updated since the last reset.

Specified by:
getUpdateCount in interface Statistic
Returns:
the update count

reset

public void reset()
Description copied from interface: Statistic
Resets the statistic's value and update count to zero.

Specified by:
reset in interface Statistic

toString

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


Copyright © 2009 FuseSource. All Rights Reserved.