Search in sources :

Example 21 with StringData

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

the class ProbeData method markExclusions.

private void markExclusions(DataRepository data, String prefix, boolean clearOutlierMarks) {
    SimpleData d = null;
    ListData l = null;
    if (!clearOutlierMarks) {
        String dataName = DataRepository.createDataName(prefix, PROBE_LIST_NAME);
        d = data.getSimpleValue(dataName);
        if (d instanceof ListData)
            l = (ListData) d;
        else if (d instanceof StringData)
            l = ((StringData) d).asList();
    }
    if (clearOutlierMarks || l == null) {
        for (int row = resultSet.numRows(); row > 0; row--) resultSet.setData(row, EXCLUDE, null);
    } else {
        for (int row = resultSet.numRows(); row > 0; row--) {
            prefix = getRowId(row);
            resultSet.setData(row, EXCLUDE, l.contains(prefix) ? null : TagData.getInstance());
        }
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) ListData(net.sourceforge.processdash.data.ListData)

Example 22 with StringData

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

the class DataNameCollector method getList.

private static List getList(DataContext data, String prefix, String name) {
    name = DataRepository.createDataName(prefix, name);
    SimpleData phaseDataElem = data.getSimpleValue(name);
    if (phaseDataElem instanceof ListData)
        return ((ListData) phaseDataElem).asList();
    else if (phaseDataElem instanceof StringData)
        return ((StringData) phaseDataElem).asList().asList();
    return Collections.EMPTY_LIST;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) ListData(net.sourceforge.processdash.data.ListData)

Example 23 with StringData

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

the class EstErrorScatterChartSnippet method buildData.

private void buildData(Resources res) throws IOException {
    // query data from the database
    String[] hql = getTinyWebServer().getRequestAsString("/dash/snippets/estErrorScatter.hql").split(";\\s*");
    PDashQuery query = getPdash().getQuery();
    List enactmentKeys = query.query(hql[0], getProjectKeys(), CURRENT);
    List<Object[]> taskStatus = query.query(hql[1], enactmentKeys, CURRENT);
    List<Object[]> sizeData = query.query(hql[2], enactmentKeys, CURRENT);
    // create a result set to hold the data
    ResultSet data = new ResultSet(taskStatus.size(), 7);
    data.setColName(0, res.getString("Component"));
    data.setColName(1, res.getString("Size_Units"));
    data.setColName(2, res.getString("Plan_Size"));
    data.setColName(3, res.getString("Actual_Size"));
    data.setColName(4, res.getString("Size_Est_Error"));
    data.setColName(5, res.getString("Plan_Time"));
    data.setColName(6, res.getString("Actual_Time"));
    data.setColName(7, res.getString("Time_Est_Error"));
    data.setFormat(4, "100%");
    data.setFormat(7, "100%");
    // load time data into the result set
    for (int i = 0; i < taskStatus.size(); i++) {
        Object[] oneTask = taskStatus.get(i);
        int row = i + 1;
        data.setRowName(row, (String) oneTask[1]);
        double planTime = ((Number) oneTask[2]).doubleValue();
        double actualTime = ((Number) oneTask[3]).doubleValue();
        data.setData(row, 5, StringData.create(formatTime(planTime)));
        data.setData(row, 6, StringData.create(formatTime(actualTime)));
        if (planTime > 0) {
            double timeErr = (actualTime - planTime) / planTime;
            data.setData(row, 7, new DoubleData(timeErr));
        }
    }
    // load size data into the result set
    for (Object[] oneSize : sizeData) {
        int row = getRow(taskStatus, oneSize[0]);
        if (row != -1) {
            String units = (String) oneSize[1];
            StringData currentUnits = (StringData) data.getData(row, 1);
            if (currentUnits == null)
                data.setData(row, 1, StringData.create(units));
            else if (!units.equals(currentUnits.format()))
                continue;
            int col = "Plan".equals(oneSize[2]) ? 2 : 3;
            double size = ((Number) oneSize[3]).doubleValue();
            data.setData(row, col, new DoubleData(size));
        }
    }
    // go back and calculate size estimating errors
    boolean requireSize = parameters.containsKey("RequireSize");
    for (int i = data.numRows(); i > 0; i--) {
        DoubleData plan = (DoubleData) data.getData(i, 2);
        DoubleData actual = (DoubleData) data.getData(i, 3);
        if (hasValue(plan) && hasValue(actual)) {
            double sizeError = (actual.getDouble() - plan.getDouble()) / plan.getDouble();
            data.setData(i, 4, new DoubleData(sizeError));
        } else if (requireSize) {
            data.removeRow(i);
        }
    }
    // store the result set into the repository
    ListData l = new ListData();
    l.add(data);
    getDataContext().putValue(DATA_NAME, l);
}
Also used : PDashQuery(net.sourceforge.processdash.api.PDashQuery) DoubleData(net.sourceforge.processdash.data.DoubleData) ListData(net.sourceforge.processdash.data.ListData) ResultSet(net.sourceforge.processdash.data.util.ResultSet) List(java.util.List) ArrayList(java.util.ArrayList) StringData(net.sourceforge.processdash.data.StringData)

Example 24 with StringData

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

the class AnalysisPage method saveSizeUnits.

protected void saveSizeUnits(HttpServletRequest req, String units) {
    WorkflowHistDataHelper histData = getChartData(req, false).histData;
    DataRepository data = (DataRepository) PDashServletUtils.buildEnvironment(req).get(TinyCGI.DATA_REPOSITORY);
    StringData sd = StringData.create(units);
    data.putValue("/Workflow_Prefs/" + histData.getWorkflowID() + "/Size_Units", sd);
    data.putValue("/Workflow_Prefs/" + histData.getWorkflowName() + "/Size_Units", sd);
}
Also used : DataRepository(net.sourceforge.processdash.data.repository.DataRepository) WorkflowHistDataHelper(net.sourceforge.processdash.tool.db.WorkflowHistDataHelper) StringData(net.sourceforge.processdash.data.StringData)

Example 25 with StringData

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

the class SelectWBSFilterTeamData method putValue.

private void putValue(String name, String value) {
    String dataName = DataRepository.createDataName(getPrefix(), name);
    // save the value of the new filter
    StringData val = (value == null ? null : StringData.create(value));
    getDataRepository().putValue(dataName, val);
    // add a listener to prevent the data element from being disposed
    getDataRepository().addDataListener(dataName, WBS_FILTER_KEEPER, false);
}
Also used : StringData(net.sourceforge.processdash.data.StringData)

Aggregations

StringData (net.sourceforge.processdash.data.StringData)26 ListData (net.sourceforge.processdash.data.ListData)15 SimpleData (net.sourceforge.processdash.data.SimpleData)13 ArrayList (java.util.ArrayList)3 List (java.util.List)3 DoubleData (net.sourceforge.processdash.data.DoubleData)3 ImmutableStringData (net.sourceforge.processdash.data.ImmutableStringData)3 MalformedValueException (net.sourceforge.processdash.data.MalformedValueException)3 SaveableData (net.sourceforge.processdash.data.SaveableData)3 EscapeString (net.sourceforge.processdash.util.EscapeString)3 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)2 EVTaskListData (net.sourceforge.processdash.ev.EVTaskListData)2 LocalizedString (net.sourceforge.processdash.util.LocalizedString)2 NodeList (org.w3c.dom.NodeList)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1