Search in sources :

Example 1 with DataPair

use of net.sourceforge.processdash.util.DataPair in project processdash by dtuma.

the class WorkflowHistDataHelper method cum.

private Map<String, DataPair> cum(Map<String, DataPair> phaseData) {
    Map<String, DataPair> result = new LinkedHashMap<String, DataPair>();
    DataPair cum = new DataPair();
    for (Entry<String, DataPair> e : phaseData.entrySet()) {
        cum.add(e.getValue());
        result.put(e.getKey(), new DataPair(cum));
    }
    result.remove(TOTAL_PHASE_KEY);
    return result;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) DataPair(net.sourceforge.processdash.util.DataPair)

Example 2 with DataPair

use of net.sourceforge.processdash.util.DataPair in project processdash by dtuma.

the class WorkflowHistDataHelper method getTotalTimeInPhase.

public Map<String, DataPair> getTotalTimeInPhase() {
    Map<String, DataPair> result = new LinkedHashMap();
    List<String> stepNames = QueryUtils.pluckColumn(getPhaseData(), PhaseCol.PhaseName);
    for (String step : stepNames) result.put(step, new DataPair());
    for (Object[] row : getTimeInPhaseData()) {
        String stepName = get(row, TimeCol.PhaseName);
        DataPair dataPair = result.get(stepName);
        if (dataPair == null) {
            stepName = "(" + stepName + ")";
            dataPair = new DataPair();
            result.put(stepName, dataPair);
        }
        dataPair.plan += ((Number) get(row, TimeCol.PlanTime)).doubleValue();
        dataPair.actual += ((Number) get(row, TimeCol.ActTime)).doubleValue();
    }
    DataPair total = new DataPair();
    for (DataPair phasePair : result.values()) total.add(phasePair);
    result.put(TOTAL_PHASE_KEY, total);
    return result;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) DataPair(net.sourceforge.processdash.util.DataPair)

Example 3 with DataPair

use of net.sourceforge.processdash.util.DataPair in project processdash by dtuma.

the class WorkflowHistDataHelper method getAddedAndModifiedSizes.

public Map<String, DataPair> getAddedAndModifiedSizes() {
    Map<String, DataPair> result = new TreeMap();
    for (Object[] row : getSizeData()) {
        String sizeUnits = get(row, SizeCol.Units);
        String measurementType = get(row, SizeCol.MType);
        double sizeValue = ((Number) get(row, SizeCol.Size)).doubleValue();
        DataPair dataPair = result.get(sizeUnits);
        if (dataPair == null)
            result.put(sizeUnits, dataPair = new DataPair());
        if ("Plan".equals(measurementType))
            dataPair.plan += sizeValue;
        else if ("Actual".equals(measurementType))
            dataPair.actual += sizeValue;
    }
    return result;
}
Also used : TreeMap(java.util.TreeMap) DataPair(net.sourceforge.processdash.util.DataPair)

Example 4 with DataPair

use of net.sourceforge.processdash.util.DataPair in project processdash by dtuma.

the class WorkflowHistDataHelper method getDefectsByPhase.

private Map<String, DataPair>[] getDefectsByPhase(Enactment e) {
    List<String> stepNames = QueryUtils.pluckColumn(getPhaseData(), PhaseCol.PhaseName);
    Map<String, DataPair>[] result = new Map[3];
    result[INJ] = new LinkedHashMap<String, DataPair>();
    result[REM] = new LinkedHashMap<String, DataPair>();
    result[INJ].put(Defect.BEFORE_DEVELOPMENT, new DataPair());
    for (String step : stepNames) {
        result[INJ].put(step, new DataPair());
        result[REM].put(step, new DataPair());
    }
    result[REM].put(Defect.AFTER_DEVELOPMENT, new DataPair());
    DataPair unrecognized = new DataPair();
    result[UNK] = Collections.singletonMap(TOTAL_PHASE_KEY, unrecognized);
    DataPair total = new DataPair();
    result[INJ].put(TOTAL_PHASE_KEY, total);
    result[REM].put(TOTAL_PHASE_KEY, total);
    addDefectData(result, unrecognized, total, e);
    return result;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) TreeMap(java.util.TreeMap) Map(java.util.Map) DataPair(net.sourceforge.processdash.util.DataPair)

Example 5 with DataPair

use of net.sourceforge.processdash.util.DataPair in project processdash by dtuma.

the class WorkflowPlanSummary method printTable.

private void printTable(String titleRes, String subtitleRes, Map<String, DataPair> data, Format fmt, boolean showActualPercent) {
    if (data.isEmpty())
        return;
    double percentOf = 0;
    if (showActualPercent) {
        DataPair d = data.get(TOTAL_KEY);
        if (d != null)
            percentOf = d.actual;
    }
    showActualPercent = percentOf > 0;
    out.print("<h2>" + esc(res(titleRes)) + "</h2>\n");
    out.print("<table>\n");
    printTableHeader(subtitleRes, showActualPercent);
    for (Entry<String, DataPair> e : data.entrySet()) {
        printTableRow(e.getKey(), e.getValue(), fmt, false, percentOf);
    }
    out.print("</table>\n");
}
Also used : DataPair(net.sourceforge.processdash.util.DataPair)

Aggregations

DataPair (net.sourceforge.processdash.util.DataPair)17 LinkedHashMap (java.util.LinkedHashMap)7 Map (java.util.Map)6 ResultSet (net.sourceforge.processdash.data.util.ResultSet)3 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2 HashMap (java.util.HashMap)1 Entry (java.util.Map.Entry)1 DoubleData (net.sourceforge.processdash.data.DoubleData)1 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)1 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)1 WorkflowHistDataHelper (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper)1 Enactment (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.Enactment)1