Package org.eclipse.jetty.util.statistic
Class CounterStatistic
- java.lang.Object
-
- org.eclipse.jetty.util.statistic.CounterStatistic
-
public class CounterStatistic extends java.lang.ObjectStatistics on a counter value.
This class keeps the total, current and maximum value of a counter that can be incremented and decremented. The total refers only to increments.
-
-
Constructor Summary
Constructors Constructor Description CounterStatistic()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longadd(long delta)longdecrement()Decrements the value by one.longgetCurrent()longgetMax()longgetTotal()longincrement()Increments the value by one.voidreset()Resets the max and total to the current value.voidreset(long value)Resets the max, total and current value to the given parameter.java.lang.StringtoString()
-
-
-
Method Detail
-
reset
public void reset()
Resets the max and total to the current value.
-
reset
public void reset(long value)
Resets the max, total and current value to the given parameter.- Parameters:
value- the new current value
-
add
public long add(long delta)
- Parameters:
delta- the amount to add to the counter- Returns:
- the new counter value
-
increment
public long increment()
Increments the value by one.- Returns:
- the new counter value after the increment
-
decrement
public long decrement()
Decrements the value by one.- Returns:
- the new counter value after the decrement
-
getMax
public long getMax()
- Returns:
- max counter value
-
getCurrent
public long getCurrent()
- Returns:
- current counter value
-
getTotal
public long getTotal()
- Returns:
- total counter value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-