public class CounterSample extends Sample
Counter
Simon. Whenever it is important to get more values
in a synchronous manner, Counter.sample()
(or Stopwatch.sampleIncrement(Object)
should be used to obtain this Java Bean object.Constructor and Description |
---|
CounterSample() |
Modifier and Type | Method and Description |
---|---|
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 |
simonToString()
Equivalent to
CounterImpl.toString() without state. |
String |
toString()
Returns readable representation of object.
|
getFirstUsage, getLastUsage, getName, getNote, setFirstUsage, setLastUsage, setName, setNote
public CounterSample()
public final long getCounter()
public final void setCounter(long counter)
counter
- value of the counterpublic final long getMin()
public final void setMin(long min)
min
- the minimal value of the counter.public final long getMax()
public final void setMax(long max)
max
- the maximal value of the counter.public final long getMinTimestamp()
public final void setMinTimestamp(long minTimestamp)
minTimestamp
- ms timestamp when the min value was reachedpublic final long getMaxTimestamp()
public final void setMaxTimestamp(long maxTimestamp)
maxTimestamp
- ms timestamp when the max value was reachedpublic final long getIncrementSum()
public final void setIncrementSum(long incrementSum)
incrementSum
- sum of all incremented valuespublic final long getDecrementSum()
public final void setDecrementSum(long decrementSum)
decrementSum
- sum of all decremented valuespublic final String getTotalAsString()
public String simonToString()
CounterImpl.toString()
without state.simonToString
in class Sample
Copyright © 2019. All rights reserved.