Class StatisticsTimeLine

java.lang.Object
org.openspaces.admin.internal.alert.bean.util.StatisticsTimeLine

public class StatisticsTimeLine extends Object
A cyclic array holding statistics (double) values. The array is filled at the cyclicIndex, incremented on each insertion modulo the size of the array. This ensures that new values replace the old ones. Created by moran on 3/3/15.
Since:
10.1.0
  • Constructor Details

    • StatisticsTimeLine

      public StatisticsTimeLine(int length)
      Parameters:
      length - how many statistics samples to keep
  • Method Details

    • addAndGet

      public double addAndGet(double value)
      Returns:
      add value to statistics time-line and get the previous value
    • getTimeLine

      public double[] getTimeLine()
      Returns:
      the values in the time-line. May contain obsolete values if isAvailable() returns false.
    • isAvailable

      public boolean isAvailable()
      Returns:
      true if time-line has enough sampled statistics; otherwise false
    • restartTimeLine

      public void restartTimeLine()
      restarts the time-line measurement. Will become unavailable until time-line has enough samples.
    • toString

      public String toString()
      Overrides:
      toString in class Object