public class

SimpleStats

extends Object
java.lang.Object
   ↳ com.android.tradefed.util.SimpleStats

Class Overview

A small utility class that calculates a few statistical measures given a numerical dataset. The values are stored internally as Doubles.

Summary

Public Constructors
SimpleStats()
Public Methods
void add(double meas)
Add a measurement to the dataset.
void addAll(Collection<? extends Double> c)
Add a number of measurements to the dataset.
List<Double> getData()
Retrieve the dataset.
boolean isEmpty()
Check if the dataset is empty.
Double max()
Return the maximum value in the dataset, or null if the dataset is empty.
Double mean()
Calculate and return the mean of the dataset, or null if the dataset is empty.
Double median()
Calculate and return the median of the dataset, or null if the dataset is empty.
Double min()
Return the minimum value in the dataset, or null if the dataset is empty.
int size()
Check how many elements are in the dataset.
Double stdev()
Return the standard deviation of the dataset, or null if the dataset is empty.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SimpleStats ()

Public Methods

public void add (double meas)

Add a measurement to the dataset.

public void addAll (Collection<? extends Double> c)

Add a number of measurements to the dataset.

Throws
NullPointerException if the collection contains any null elements

public List<Double> getData ()

Retrieve the dataset.

public boolean isEmpty ()

Check if the dataset is empty.

public Double max ()

Return the maximum value in the dataset, or null if the dataset is empty.

public Double mean ()

Calculate and return the mean of the dataset, or null if the dataset is empty.

public Double median ()

Calculate and return the median of the dataset, or null if the dataset is empty.

public Double min ()

Return the minimum value in the dataset, or null if the dataset is empty.

public int size ()

Check how many elements are in the dataset.

public Double stdev ()

Return the standard deviation of the dataset, or null if the dataset is empty.

Note that this method calculates the population standard deviation, not the sample standard deviation. That is, it assumes that the dataset is entirely contained in the SimpleStats instance.