Class StatisticsObjectList

java.lang.Object
org.openspaces.admin.internal.pu.statistics.StatisticsObjectList

public class StatisticsObjectList extends Object
A List of Objects that supports min,max,percentile operations if the Objects implement Comparable and supports average operation if the Objects implement Number
Since:
9.0.0
Author:
itaif
  • Constructor Details

    • StatisticsObjectList

      public StatisticsObjectList()
  • Method Details

    • add

      public void add(Object value, long timeStampMillis)
      Adds the specified object to the list
    • getAverage

      public Double getAverage()
      Returns:
      the average values (cast to double) of the object in the list or null if the list is empty
      Throws:
      ClassCastException - if any object in the list is not a Number
    • getMinimum

      public Object getMinimum()
      Returns:
      the minimum (natural order) value object in the list or null if the list is empty.
      Throws:
      ClassCastException - if any object in the list is not a Comparable
    • getMaximum

      public Object getMaximum()
      Returns:
      the maximum (natural order) value object in the list or null if the list is empty.
      Throws:
      ClassCastException - if any object in the list is not a Comparable
    • getLast

      public Object getLast()
      Returns:
      the last added sample or null if the list is empty.
    • getPercentile

      public Object getPercentile(double percentile)
      Returns:
      the specified percentile (natural order) value object in the list or null if the list is empty.
      Throws:
      ClassCastException - if any object in the list is not a Comparable
      IllegalArgumentException - if percentile is bigger than 100 or less than 0
    • getDeltaValuePerNanoSecond

      public Double getDeltaValuePerNanoSecond()
      Returns:
      the (last-first)/deltaTimeInNanos (cast to double) of the object in the list or null if the are less then 2 values
      Throws:
      ClassCastException - if any object in the list is not a Number
    • getDeltaValuePerMilliSecond

      public Double getDeltaValuePerMilliSecond()
      Returns:
      the (last-first)/deltaTimeInMillis (cast to double) of the object in the list or null if the are less then 2 values
      Throws:
      ClassCastException - if any object in the list is not a Number
    • getDeltaValuePerSecond

      public Double getDeltaValuePerSecond()
      Returns:
      the (last-first)/deltaTimeInSeconds (cast to double) of the object in the list or null if the are less then 2 values
      Throws:
      ClassCastException - if any object in the list is not a Number
    • toString

      public String toString()
      Overrides:
      toString in class Object