Search in sources :

Example 36 with DoubleData

use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.

the class SelectWBSFilterTeamFrame method initMaxDepth.

private void initMaxDepth(String prefix) {
    if (!parameters.containsKey("EXPORT")) {
        // if we aren't currently exporting, display nodes to any arbitrary
        // depth for drill-down.
        maxDepth = -1;
    } else {
        // when exporting, check to see if the user has configured
        // a desired depth for drill-down
        String dataName = DataRepository.createDataName(prefix, MAX_EXPORT_DEPTH_DATA_NAME);
        SimpleData data = getDataRepository().getSimpleValue(dataName);
        if (data instanceof DoubleData) {
            DoubleData doubleVal = (DoubleData) data;
            maxDepth = doubleVal.getInteger();
        } else {
            maxDepth = DEFAULT_MAX_EXPORT_DEPTH;
        }
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) DoubleData(net.sourceforge.processdash.data.DoubleData)

Example 37 with DoubleData

use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.

the class Sumfor method call.

/** Perform a procedure call.
     *
     * This method <b>must</b> be thread-safe.
     */
public Object call(List arguments, ExpressionContext context) {
    double result = 0.0, val;
    String name = asString(getArg(arguments, 0));
    if (name == null)
        return null;
    Iterator i = collapseLists(arguments, 1).iterator();
    String path, dataName, alias;
    alias = NO_ALIAS_YET;
    SimpleData sVal = null;
    while (i.hasNext()) {
        path = asStringVal(i.next());
        if (path == null)
            continue;
        dataName = DataRepository.createDataName(path, name);
        if (alias == NO_ALIAS_YET)
            alias = dataName;
        else
            alias = null;
        sVal = context.get(dataName);
        val = asDouble(sVal);
        if (!Double.isNaN(val) && !Double.isInfinite(val))
            result += val;
    }
    if (alias != null && alias != NO_ALIAS_YET && sVal != null)
        return new DescribedValue(sVal, context.resolveName(alias));
    else if (result == 0)
        return ImmutableDoubleData.READ_ONLY_ZERO;
    else
        return new DoubleData(result);
}
Also used : Iterator(java.util.Iterator) SimpleData(net.sourceforge.processdash.data.SimpleData) DoubleData(net.sourceforge.processdash.data.DoubleData) ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData)

Example 38 with DoubleData

use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.

the class WorkflowPlanSummary method writePhaseChart.

private void writePhaseChart(boolean plan, String titleRes, String columnRes, double factor, Map<String, DataPair> phaseData) throws IOException {
    int numRows = phaseData.size() - 1;
    ResultSet data = new ResultSet(numRows, 1);
    int row = 0;
    for (Entry<String, DataPair> e : phaseData.entrySet()) {
        if (++row > numRows)
            break;
        data.setRowName(row, e.getKey());
        double value = plan ? e.getValue().plan : e.getValue().actual;
        data.setData(row, 1, new DoubleData(value / factor));
    }
    writeChart((plan ? "Plan" : "Actual"), titleRes, columnRes, data);
}
Also used : ResultSet(net.sourceforge.processdash.data.util.ResultSet) DoubleData(net.sourceforge.processdash.data.DoubleData) DataPair(net.sourceforge.processdash.util.DataPair)

Example 39 with DoubleData

use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.

the class ProcessAnalysisPage method writePhaseTime.

public static void writePhaseTime(ResultSet resultSet, boolean pct, int firstCol, Object... phases) {
    for (int i = phases.length; i-- > 0; ) {
        int col = firstCol + i;
        Object onePhase = phases[i];
        if (onePhase instanceof String)
            resultSet.setColName(col, (String) onePhase);
        if (pct)
            resultSet.setFormat(col, "100%");
        for (int row = resultSet.numRows(); row > 0; row--) {
            Enactment e = (Enactment) resultSet.getRowObj(row);
            double phaseTime = e.actualTime(onePhase);
            double finalTime = phaseTime / (pct ? e.actualTime() : 60);
            resultSet.setData(row, col, new DoubleData(finalTime));
        }
    }
}
Also used : Enactment(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper.Enactment) DoubleData(net.sourceforge.processdash.data.DoubleData)

Aggregations

DoubleData (net.sourceforge.processdash.data.DoubleData)39 SimpleData (net.sourceforge.processdash.data.SimpleData)15 Iterator (java.util.Iterator)7 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)7 ListData (net.sourceforge.processdash.data.ListData)5 NumberData (net.sourceforge.processdash.data.NumberData)5 ResultSet (net.sourceforge.processdash.data.util.ResultSet)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 SaveableData (net.sourceforge.processdash.data.SaveableData)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 NumberFunction (net.sourceforge.processdash.data.NumberFunction)3 StringData (net.sourceforge.processdash.data.StringData)3 CompiledScript (net.sourceforge.processdash.data.compiler.CompiledScript)3 IOException (java.io.IOException)2 DateData (net.sourceforge.processdash.data.DateData)2 MalformedValueException (net.sourceforge.processdash.data.MalformedValueException)2 StudyGroupManager (net.sourceforge.processdash.tool.db.StudyGroupManager)2