Search in sources :

Example 6 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class PlanAnalysisPage method createLogNormalHistogram.

private ResultSet createLogNormalHistogram(List<Double> values, String rangeKey, String colName) {
    // be analyzed with a lognormal distribution
    for (Iterator<Double> i = values.iterator(); i.hasNext(); ) if (!(i.next() > 0))
        i.remove();
    // mean and std dev cannot be calculated with insufficient data points
    int n = values.size();
    if (n < 2)
        return null;
    // calculate the lognormal mean of the values
    double[] logValues = new double[n];
    double logSum = 0;
    for (int i = 0; i < n; i++) {
        logValues[i] = Math.log(values.get(i));
        logSum += logValues[i];
    }
    double logMean = logSum / n;
    if (badDouble(logMean))
        return null;
    // calculate the lognormal standard deviation
    double stdSum = 0;
    for (int i = 0; i < n; i++) {
        double diff = logValues[i] - logMean;
        stdSum += diff * diff;
    }
    double logStdDev = Math.sqrt(stdSum / (n - 1));
    if (badDouble(logStdDev))
        return null;
    double logStdDevHalf = logStdDev / 2;
    // build a result set showing a histogram of the log bins
    int numBins = LOG_NORMAL_BUCKET_KEYS.length;
    ResultSet result = new ResultSet(numBins, 4);
    for (int bin = 0; bin < numBins; bin++) {
        int row = bin + 1;
        result.setRowName(row, resources.getString(//
        "Plan.Distribution." + LOG_NORMAL_BUCKET_KEYS[bin]));
        // store the center point of this log normal bin in the result set
        double binCenter = logMean + logStdDev * (bin - 2);
        result.setData(row, 1, num(Math.exp(binCenter)));
        // determine the ranges of this log normal bin
        double binLow = binCenter - logStdDevHalf;
        double binHigh = binCenter + logStdDevHalf;
        result.setData(row, 2, num(Math.exp(binLow)));
        result.setData(row, 3, num(Math.exp(binHigh)));
        // count the number of items that fall into this bin
        int count = 0;
        for (int i = 0; i < n; i++) {
            if ((bin == 0 || binLow < logValues[i]) && (bin == numBins - 1 || logValues[i] <= binHigh))
                count++;
        }
        result.setData(row, 4, num(count));
    }
    // store column headers
    result.setColName(0, resources.getString(rangeKey));
    result.setColName(1, colName);
    result.setColName(2, resources.getString("Plan.Distribution.Range_Min"));
    result.setColName(3, resources.getString("Plan.Distribution.Range_Max"));
    result.setColName(4, resources.getString("Plan.Distribution.Count"));
    // store labels for extreme range boundaries
    result.setData(1, 2, StringData.create("> 0"));
    result.setData(numBins, 3, StringData.create("∞"));
    return result;
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet)

Example 7 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class ChartData method getEnactmentResultSet.

public ResultSet getEnactmentResultSet(int numColumns) {
    List<Enactment> enactments = histData.getEnactments();
    ResultSet result = new ResultSet(enactments.size(), numColumns);
    result.setColName(0, getRes("Project/Task"));
    for (int i = enactments.size(); i-- > 0; ) result.setRowName(i + 1, enactments.get(i));
    return result;
}
Also used : Enactment(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.Enactment) ResultSet(net.sourceforge.processdash.data.util.ResultSet)

Example 8 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class QualityAnalysisPage method getDefectsVsYield.

@//
Chart(//
id = "defectsVsYield", //
type = "xy", //
params = "phase", titleKey = "Process.Defects_Vs_Yield_Title_FMT")
public ResultSet getDefectsVsYield(ChartData chartData) {
    ResultSet data = chartData.getEnactmentResultSet(2);
    writeYield(data, 1);
    writePhaseDefectDensity(chartData, data, 2, chartData.chartArgs[0]);
    return data;
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet)

Example 9 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class QualityAnalysisPage method getFailureCostOfQuality.

@//
Chart(//
id = "failureCOQ", //
type = "line", titleKey = "Quality.Failure_COQ_Title")
public ResultSet getFailureCostOfQuality(ChartData chartData) {
    ResultSet data = //
    chartData.getEnactmentResultSet("Quality.Failure_COQ_Label");
    writePhaseTimePct(data, 1, PhaseType.Failure);
    return data;
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet)

Example 10 with ResultSet

use of net.sourceforge.processdash.data.util.ResultSet in project processdash by dtuma.

the class QualityAnalysisPage method getAppraisalVsFailureCost.

@//
Chart(//
id = "appraisalVsFailure", //
type = "xy", titleKey = "Quality.Appraisal_vs_Failure_Title")
public ResultSet getAppraisalVsFailureCost(ChartData chartData) {
    ResultSet data = chartData.getEnactmentResultSet("Quality.Appraisal_COQ_Label", "Quality.Failure_COQ_Label");
    writePhaseTimePct(data, 1, PhaseType.Appraisal, PhaseType.Failure);
    return data;
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet)

Aggregations

ResultSet (net.sourceforge.processdash.data.util.ResultSet)57 Enactment (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.Enactment)11 DoubleData (net.sourceforge.processdash.data.DoubleData)5 ArrayList (java.util.ArrayList)4 ListData (net.sourceforge.processdash.data.ListData)3 DataPair (net.sourceforge.processdash.util.DataPair)3 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2 PDashQuery (net.sourceforge.processdash.api.PDashQuery)2 PhaseType (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.PhaseType)2 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ServletException (javax.servlet.ServletException)1 DataContext (net.sourceforge.processdash.data.DataContext)1 StringData (net.sourceforge.processdash.data.StringData)1