Package net.sourceforge.processdash.util

Examples of net.sourceforge.processdash.util.HashTree


    private DataFile guessDataFile(String name, boolean requireWritable) {

        int pos = name.indexOf("//");
        if (pos == -1 || isLegacyDoubleSlashDataName(name, pos))
            synchronized (datafiles) {
                HashTree t = datafilePrefixMap.getDeepestExistingSubtree(name);
                for ( ; t != null; t = t.getParent()) {
                    DataFile datafile = (DataFile) t.get(DATAFILE_MAP_VAL_NAME);
                    if (datafile != null) {
                        if (requireWritable) {
                            if (datafile.file == null)
                                continue;
                            if (!datafile.canWrite)
View Full Code Here


    private NumberFormat numberFormat = new XmlNumberFormatter();

    public void export(OutputStream out, Iterator dataElements)
            throws IOException {
        HashTree sorted = sortDataElements(dataElements);
        writeDataElements(new OutputStreamWriter(out, ENCODING), sorted);
    }
View Full Code Here

        HashTree sorted = sortDataElements(dataElements);
        writeDataElements(new OutputStreamWriter(out, ENCODING), sorted);
    }

    private HashTree sortDataElements(Iterator dataElements) {
        HashTree result = new HashTree(TreeMap.class);
        while (dataElements.hasNext()) {
            ExportedDataValue v = (ExportedDataValue) dataElements.next();
            String name = v.getName();
            SimpleData simpleValue = v.getSimpleValue();
            if (simpleValue != null)
                result.put(name, simpleValue);
        }
        return result;
    }
View Full Code Here

        // finally, write all the children.
        for (Iterator iter = data.getChildren(); iter.hasNext();) {
            Map.Entry e = (Map.Entry) iter.next();
            String childName = (String) e.getKey();
            HashTree child = (HashTree) e.getValue();
            writeChildElement(xml, childName, child, depth);
        }

    }
View Full Code Here

     *
     * @param prefix the prefix where the defects should be mounted
     * @param defects a List of {@link ImportedDefect} objects
     */
    public synchronized static void importDefects(String prefix, List defects) {
        HashTree context = getContext(importedDefects, prefix + "/");
        for (Iterator iter = defects.iterator(); iter.hasNext();) {
            ImportedDefect d = (ImportedDefect) iter.next();
            List l = getList(context, d.path);
            l.add(d.defect);
        }
View Full Code Here

    }

    private static HashTree getContext(HashTree base, String path) {
        String fakeItem = path + "foo";
        base.put(fakeItem, "bar");
        HashTree result = (HashTree) base.get(path);
        base.remove(fakeItem);
        return result;
    }
View Full Code Here

        Set keys = new HashSet();

        for (int i = 0; i < prefixes.length; i++) {
            String prefix = prefixes[i] + "/";
            HashTree context = (HashTree) importedDefects.get(prefix);
            if (context != null) {
                if (includeChildren) {
                    Iterator j = context.getAllKeys();
                    while (j.hasNext())
                        keys.add(prefix + j.next());
                } else {
                    if (context.get(DEFECT_LIST_ELEM) != null)
                        keys.add(prefix + DEFECT_LIST_ELEM);
                }
            }
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.util.HashTree

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.