www.sdmetrics.com

sdmetrics.app
Class DescStats

java.lang.Object
  |
  +--sdmetrics.app.DescStats

public class DescStats
extends java.lang.Object

Class to calculate and provide descriptive statistics for the metrics. The descriptive statistics calculated are:

The implementation uses a "lazy evaluation-on-demand" strategy: the first time the descriptive statistics for a particular metric is requested, statistics are calculated and stored. The next time the same statistic is requested for the same metric, the data is retrieved from the class internal cache.


Constructor Summary
DescStats(DataTable dt, float[] percentiles)
           
 
Method Summary
 float[] getDataArray(int eltype, int metnum)
          Access the numeric metric values for a metric, in ascending order.
 DataTable getDataTable()
          Get an object to access the descriptive statistics via the DataTable interface.
 float getMax(int eltype, int metnum)
          Return the maximum value for a metric.
 float getMean(int eltype, int metnum)
          Return the average value for a metric.
 float getMin(int eltype, int metnum)
          Return the minimum value for a metric.
 int getNumPercentiles()
          Retrieve the number of percentiles that are to be calculated.
 int getNumVal(int eltype, int metnum)
          Return the number of valid numerical values for a metric.
 float getPercentile(int index)
          Retrieve a particular percentile threshold.
 float getPercentile(int eltype, int metnum, int pind)
          Return a percentile of the metric.
 float getStdDev(int eltype, int metnum)
          Return the standard deviation of a metric's distribution.
 float getSum(int eltype, int metnum)
          Return the sum of metric values across all design elements for a metric.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DescStats

public DescStats(DataTable dt,
                 float[] percentiles)
Parameters:
dt - Metric data for which to calculate the descriptive statistics.
percentiles - The percentiles to calculate.
Method Detail

getDataTable

public DataTable getDataTable()
Get an object to access the descriptive statistics via the DataTable interface.

Returns:
The descriptive statistics in table format.

getNumVal

public int getNumVal(int eltype,
                     int metnum)
Return the number of valid numerical values for a metric.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
Returns:
Number of model elements for which the metric yields a numerical value.

getMin

public float getMin(int eltype,
                    int metnum)
Return the minimum value for a metric.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
Returns:
Minimum value of the metric.

getMax

public float getMax(int eltype,
                    int metnum)
Return the maximum value for a metric.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
Returns:
Maximum value of the metric.

getMean

public float getMean(int eltype,
                     int metnum)
Return the average value for a metric.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
Returns:
The arithmetic mean of the metric.

getStdDev

public float getStdDev(int eltype,
                       int metnum)
Return the standard deviation of a metric's distribution.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
Returns:
The standard deviation of the metric.

getSum

public float getSum(int eltype,
                    int metnum)
Return the sum of metric values across all design elements for a metric.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
Returns:
The sum of metric values for the metric (column sum in the metric data table).

getPercentile

public float getPercentile(int eltype,
                           int metnum,
                           int pind)
Return a percentile of the metric.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
pind - Index of the percentile to calculate.
Returns:
Selected percentile for the metric.

getNumPercentiles

public int getNumPercentiles()
Retrieve the number of percentiles that are to be calculated.

Returns:
The number of percentiles to be calculated.

getPercentile

public float getPercentile(int index)
Retrieve a particular percentile threshold.

Parameters:
index - Index of the percentile to retrieve. Valid indices run from 0 to getNumPercentiles()-1.
Returns:
Percentile for the selected index.

getDataArray

public float[] getDataArray(int eltype,
                            int metnum)
Access the numeric metric values for a metric, in ascending order.

Parameters:
eltype - Metamodel element type ID for which the metric is defined.
metnum - Index (column number) of the metric.
Returns:
An array of floats, containing the numeric metric values of the metric, sorted in ascending order. Note that the valid data is in the range 0...getNumVal(eltype,metnum)-1. The length of the array can be larger than getNumVal() - the trailing values must be ignored.

www.sdmetrics.com