Package net.sourceforge.processdash.data

Examples of net.sourceforge.processdash.data.ListData


        }

        // Iterate over the children of this element.
        NodeList children = node.getChildNodes();
        int numChildren = children.getLength();
        ListData childList = newEmptyList();
        Node c; Element child;
        for (int i=0;  i<numChildren;  i++) {
            c = children.item(i);
            if (c instanceof Element && isProcessNode((Element) c) &&
                !noAutoDataNode((Element) c)) {
                child = (Element) c;
                String childName =
                    pathConcat(path, child.getAttribute(NAME_ATTR));
                childList.add(childName);
                buildDefaultData(child, childName, data, definitions,
                                 localDataLength, nodeDefinitions);
            }
        }
        childList.setImmutable();

        // truncate the nodeDefinitions StringBuffer so it only
        // contains the global data definitions plus the local size
        // definition (probably unnecessary, but a wise and safe thing
        // to do).
        nodeDefinitions.setLength(localDataLength);

        if (XMLUtils.hasValue(path))
            nodeDefinitions.append("#define ").append(PATH_MACRO)
                .append(" ").append(esc(path)).append("\n");
        if (node.hasAttribute(DashHierarchy.IMAGINARY_NODE_ATTR))
            nodeDefinitions.append("#define IS_IMAGINARY_NODE\n");

        if (childList.size() > 0) {
            definitions.put(pathConcat(path, CHILD_LIST_ELEM), childList);
            nodeDefinitions.append(NODE_DATA);
        } else {
            // This is a phase.
View Full Code Here


        int extraRows = padRows;
        if (parameters.get(queryArg) != null && !isExporting())
            extraRows = addRows;

        ListData rows = configureSETList(getDataRepository(), prefix,
            dataElements, minRows, extraRows, !isExporting());
        writeTableRows(template, rows);
    }
View Full Code Here

            boolean saveList) {
        String [] dataNames = new String[dataElements.length];
        for (int e = dataElements.length; e-- > 0; )
            dataNames[e] = prefix + "/" + dataElements[e];

        ListData populatedRows = new ListData();

        int rowNum, lastPopulatedRow, i;
        rowNum = lastPopulatedRow = -1;
    ROW:
        while (true) {
            rowNum++;
            i = dataNames.length;
            while (i-- > 1)
                if (data.getValue(replaceNum(dataNames[i], rowNum)) != null) {
                    lastPopulatedRow = rowNum;
                    populatedRows.add(Integer.toString(rowNum));
                    continue ROW;
                }
            // if we haven't seen any data for 20 consecutive rows,
            // we can safely conclude that there is no more data.
            if (rowNum - lastPopulatedRow > 20)
                break ROW;
        }

        int extraRows = Math.max(padRows, minRows - populatedRows.size());
        for (int e = 0;  e < extraRows;   e++)
            populatedRows.add(Integer.toString(lastPopulatedRow+e+1));

        if (saveList) {
            String listName = dataNames[0];
            String activeName = listName + "//Active";
            ListData currentActiveElements = ListData.asListData(data
                    .getValue(activeName));

            ListData newActiveElements = new ListData(populatedRows);
            newActiveElements.setAddAll(currentActiveElements);

            data.putValue(listName, newActiveElements);
            data.putValue(activeName, newActiveElements);
        }
View Full Code Here

        // data repository.
        DataRepository data = getDataRepository();
        String pfx = getPrefix();
        if (pfx == null) pfx = "/";
        StringBuffer prefix = new StringBuffer(pfx);
        ListData list;
        Element result = null;
        SaveableData val;
        for (val = data.getInheritableValue(prefix, FILE_XML_DATANAME);
             val != null;
             val = data.getInheritableValue(chop(prefix), FILE_XML_DATANAME)) {

            if (val != null && !(val instanceof SimpleData))
                val = val.getSimpleValue();

            if (val instanceof StringData)
                list = ((StringData) val).asList();
            else if (val instanceof ListData)
                list = (ListData) val;
            else
                list = null;

            if (list != null)
                for (int i=0;   i < list.size();  i++) {
                    String url = (String) list.get(i);
                    Document docList = getDocumentTree(url);
                    if (docList != null) {
                        result = (new FileFinder(name, docList)).file;
                        if (result != null)
                            return result;
View Full Code Here

    @Override
    protected void buildData() {
        int[] histogram = new int[SIZE_NAMES.size()];

        DataContext data = getDataContext();
        ListData partsAdditions = ListData.asListData(data
                .getSimpleValue(PARTS_LIST));
        if (partsAdditions != null) {
            for (int i = 0; i < partsAdditions.size(); i++) {
                String path = asString(partsAdditions.get(i));
                double itemCount = asDoubleData(data.getSimpleValue(path
                        + METHODS));
                String relSize = asString(data.getSimpleValue(path + REL_SIZE));
                if (!StringUtils.hasValue(relSize) && itemCount == 0)
                    continue;
View Full Code Here

            defns.put(prefix + OWNER_ATTR, StringData.create(owner));

        if (exportTimestamp != null)
            defns.put(prefix + WHEN_ATTR, new DateData(exportTimestamp, false));

        ListData packageList = new ListData();
        String packagePrefix = prefix + PACKAGE_ELEM + "/";
        for (Map.Entry<String, String> e : packageIDs.entrySet()) {
            String id = e.getKey();
            String version = e.getValue();
            packageList.add(id);
            packageList.add(version);
            defns.put(packagePrefix + id, StringData.create(version));
        }
        defns.put(prefix + PACKAGE_ELEM, packageList);
    }
View Full Code Here

    private static Vector stringToPaths(String paths) {
        if (paths == null || paths.length() == 0)
            return new Vector();

        ListData list = new ListData(paths);
        Vector result = new Vector();
        for (int i = 0; i < list.size(); i++)
            result.add(list.get(i));
        return result;
    }
View Full Code Here

    private void addTaskListNames(ExportedDataValue val) {
        SimpleData d = val.getSimpleValue();
        if (!d.test())
            return;
       
        ListData list = null;
        if (d instanceof ListData)
            list = (ListData) d;
        else if (d instanceof StringData)
            list = ((StringData) d).asList();
       
        if (list != null)
            for (int i = 0;  i < list.size();  i++)
                taskListNames.add(list.get(i));
    }
View Full Code Here

        recalcNodeTypeSpecs((EVTask) root, result);
        nodeTypeSpecs = result;
    }
   
    private void recalcNodeTypeSpecs(EVTask task, Set result) {
        ListData l = task.nodeTypeSpec;
        if (l != null && l.size() > 0)
            result.add(l.asList());
        for (int i = task.getNumChildren();  i-- > 0; )
            recalcNodeTypeSpecs(task.getChild(i), result);
    }
View Full Code Here

            return;
       
        String dataName = DataRepository.createDataName(taskPath,
                TASK_ID_DATA_NAME);
        SimpleData currentValue = data.getSimpleValue(dataName);
        ListData newValue;
        if (currentValue instanceof ListData)
            newValue = (ListData) currentValue;
        else if (currentValue instanceof StringData)
            newValue = ((StringData) currentValue).asList();
        else
            newValue = new ListData();
       
        boolean valueChanged = false;
        String[] idList = id.split(",");
        for (int i = 0; i < idList.length; i++) {
            if (newValue.setAdd(idList[i]))
                valueChanged = true;
        }
        if (valueChanged)
            data.putValue(dataName, newValue);
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.data.ListData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.