java.lang.Object
net.i2p.stat.RateAverages

public class RateAveragesextends Object
Storage space for computations of various averages.
  • Constructor Details

    • RateAverages

      public RateAverages()
      Create a new RateAverages.
  • Method Details

    • getTemp

      public static RateAverages getTemp()
      Thread-local temp instance.
      Returns:
      thread-local temp instance.
    • release

      public static void release()
      Remove the thread-local temp instance.
    • reset

      void reset()
      Reset all fields to zero.
    • getAverage

      public double getAverage()
      The weighted average.
      Returns:
      one of several things: if there are any events (current or last) => weighted average otherwise if the useLifetime parameter to Rate.computeAverages was: true => the lifetime average value false => zero
    • setAverage

      void setAverage(double average)
      Stores the weighted average.
      Parameters:
      average - the combined period average, or the lifetime average if no events were recorded
    • getCurrent

      public double getCurrent()
      The current average.
      Returns:
      the current average == current value / current event count
    • setCurrent

      void setCurrent(double current)
      Stores the current period average.
      Parameters:
      current - the current period's value total divided by its event count
    • getLast

      public double getLast()
      The last average.
      Returns:
      the last average == last value / last event count
    • setLast

      void setLast(double last)
      Stores the last period average.
      Parameters:
      last - the previous period's value total divided by its event count
    • getTotalEventCount

      public long getTotalEventCount()
      The total event count.
      Returns:
      the total event count == current + last event counts
    • setTotalEventCount

      void setTotalEventCount(long totalEventCount)
      Stores the total event count.
      Parameters:
      totalEventCount - the current and previous periods' event counts added together
    • getTotalValues

      public double getTotalValues()
      The total values.
      Returns:
      the total values == current + last values
    • setTotalValues

      void setTotalValues(double totalValues)
      Stores the total values sum.
      Parameters:
      totalValues - the current and previous periods' value totals added together