org.javasimon
Class CounterSample

java.lang.Object
  extended by org.javasimon.Sample
      extended by org.javasimon.CounterSample
Direct Known Subclasses:
CounterSample

public class CounterSample
extends Sample

CounterSample.

Author:
Richard "Virgo" Richter

Field Summary
private  long counter
           
private  long decrementSum
           
private  long incrementSum
           
private  long max
           
private  long maxTimestamp
           
private  long min
           
private  long minTimestamp
           
 
Constructor Summary
CounterSample()
           
 
Method Summary
 String counterToString()
          Equivalent to CounterImpl.toString() without state.
 long getCounter()
          Returns the value of the counter.
 long getDecrementSum()
          Returns the sum of all decremented values (as a positive number).
 long getIncrementSum()
          Returns the sum of all incremented values.
 long getMax()
          Returns maximal value of counter.
 long getMaxTimestamp()
          Returns ms timestamp when the max value was reached.
 long getMin()
          Returns minimal value of counter.
 long getMinTimestamp()
          Returns ms timestamp when the min value was reached.
 String getTotalAsString()
          Returns the total sum of increments and decrements as a formatted string (+inc/-dec).
 void setCounter(long counter)
          Sets the value of the counter.
 void setDecrementSum(long decrementSum)
          Sets the sum of all decremented values.
 void setIncrementSum(long incrementSum)
          Sets the sum of all incremented values.
 void setMax(long max)
          Sets the maximal value of the counter.
 void setMaxTimestamp(long maxTimestamp)
          Sets ms timestamp when the max value was reached.
 void setMin(long min)
          Sets the minimal value of the counter.
 void setMinTimestamp(long minTimestamp)
          Sets ms timestamp when the min value was reached.
 String toString()
          Returns readable representation of object.
 
Methods inherited from class org.javasimon.Sample
finishWithUsagesAndNote, getFirstUsage, getLastReset, getLastUsage, getName, getNote, setFirstUsage, setLastReset, setLastUsage, setName, setNote, simonToString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

counter

private long counter

min

private long min

max

private long max

minTimestamp

private long minTimestamp

maxTimestamp

private long maxTimestamp

incrementSum

private long incrementSum

decrementSum

private long decrementSum
Constructor Detail

CounterSample

public CounterSample()
Method Detail

getCounter

public final long getCounter()
Returns the value of the counter.

Returns:
counter value

setCounter

public final void setCounter(long counter)
Sets the value of the counter.

Parameters:
counter - value of the counter

getMin

public final long getMin()
Returns minimal value of counter.

Returns:
maximal reached value

setMin

public final void setMin(long min)
Sets the minimal value of the counter.

Parameters:
min - the minimal value of the counter.

getMax

public final long getMax()
Returns maximal value of counter.

Returns:
maximal reached value

setMax

public final void setMax(long max)
Sets the maximal value of the counter.

Parameters:
max - the maximal value of the counter.

getMinTimestamp

public final long getMinTimestamp()
Returns ms timestamp when the min value was reached.

Returns:
ms timestamp of the min value decremented

setMinTimestamp

public final void setMinTimestamp(long minTimestamp)
Sets ms timestamp when the min value was reached.

Parameters:
minTimestamp - ms timestamp when the min value was reached

getMaxTimestamp

public final long getMaxTimestamp()
Returns ms timestamp when the max value was reached.

Returns:
ms timestamp of the max value incremented

setMaxTimestamp

public final void setMaxTimestamp(long maxTimestamp)
Sets ms timestamp when the max value was reached.

Parameters:
maxTimestamp - ms timestamp when the max value was reached

getIncrementSum

public final long getIncrementSum()
Returns the sum of all incremented values. If incremented value was negative, sum is lowered by this value.

Returns:
sum of all incremented values

setIncrementSum

public final void setIncrementSum(long incrementSum)
Sets the sum of all incremented values.

Parameters:
incrementSum - sum of all incremented values

getDecrementSum

public final long getDecrementSum()
Returns the sum of all decremented values (as a positive number). If decremented value was negative, sum is lowered by this value.

Returns:
sum of all decremented values

setDecrementSum

public final void setDecrementSum(long decrementSum)
Sets the sum of all decremented values.

Parameters:
decrementSum - sum of all decremented values

getTotalAsString

public final String getTotalAsString()
Returns the total sum of increments and decrements as a formatted string (+inc/-dec).

Returns:
total sum of increments and decrements as string

toString

public String toString()
Returns readable representation of object.

Overrides:
toString in class Object
Returns:
string with readable representation of object

counterToString

public String counterToString()
Equivalent to CounterImpl.toString() without state.



Copyright © 2013. All Rights Reserved.