Search in sources :

Example 6 with SaveableData

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

the class DataRepository method remapDataNames.

/** this renames data values in the global datafile. */
private void remapDataNames(String oldPrefix, String newPrefix) {
    String name, newName;
    DataElement element;
    SaveableData value;
    oldPrefix = oldPrefix + "/";
    newPrefix = newPrefix + "/";
    int oldPrefixLen = oldPrefix.length();
    Iterator k = getInternalKeys();
    while (k.hasNext()) {
        name = (String) k.next();
        if (!name.startsWith(oldPrefix))
            continue;
        element = (DataElement) data.get(name);
        if (element == null || element.isDefaultName() || element.datafile == null || element.datafile.prefix == null || element.datafile.prefix.length() > 0)
            // only remap data which lives in the global datafile.
            continue;
        value = element.getValue();
        // move - but none of that stuff should be moving.
        if (value instanceof SimpleData) {
            newName = newPrefix + name.substring(oldPrefixLen);
            newName = intern(newName, false);
            //System.out.println("renaming " + name + " to " + newName);
            putValue(newName, value.getSimpleValue(), IS_NOT_DEFAULT_VAL);
            putValue(name, null, IS_NOT_DEFAULT_VAL);
        }
    }
}
Also used : Iterator(java.util.Iterator) SimpleData(net.sourceforge.processdash.data.SimpleData) EscapeString(net.sourceforge.processdash.util.EscapeString) SaveableData(net.sourceforge.processdash.data.SaveableData)

Example 7 with SaveableData

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

the class UserDataWriter method getInheritedWbsIdForPath.

private String getInheritedWbsIdForPath(String path) {
    String result = getWbsOrClientIdForPath(path);
    if (hasValue(result))
        return result;
    SaveableData sd = getDataRepository().getInheritableValue(path, TeamDataConstants.WBS_ID_DATA_NAME);
    return (sd == null ? null : getStringData(sd.getSimpleValue()));
}
Also used : SaveableData(net.sourceforge.processdash.data.SaveableData)

Example 8 with SaveableData

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

the class SyncWorkerWhatIf method getSimpleValue.

public SimpleData getSimpleValue(String name) {
    name = getOriginalPath(name);
    SaveableData result = (SaveableData) localData.get(name);
    if (result != null)
        return result.getSimpleValue();
    else
        return data.getSimpleValue(name);
}
Also used : SaveableData(net.sourceforge.processdash.data.SaveableData)

Example 9 with SaveableData

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

the class SyncWorkerWhatIf method getValue.

public SaveableData getValue(String name) {
    name = getOriginalPath(name);
    SaveableData result = (SaveableData) localData.get(name);
    if (result != null)
        return result;
    else
        return data.getValue(name);
}
Also used : SaveableData(net.sourceforge.processdash.data.SaveableData)

Example 10 with SaveableData

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

the class RadarChart method maybeScaleDataAxes.

private void maybeScaleDataAxes() {
    for (int i = 0; i < data.numCols(); i++) {
        int n = i + 1;
        String target = getParameter("t" + n);
        if (!StringUtils.hasValue(target))
            continue;
        double targetVal = 0;
        try {
            targetVal = FormatUtil.parseNumber(target);
        } catch (Exception e) {
            SaveableData val = getDataRepository().getInheritableValue(getPrefix(), target);
            if (val != null) {
                SimpleData sVal = val.getSimpleValue();
                if (sVal instanceof NumberData)
                    targetVal = ((NumberData) sVal).getDouble();
            }
        }
        if (targetVal == 0)
            continue;
        boolean reverse = parameters.containsKey("r" + n);
        SimpleData d = data.getData(1, n);
        if (d instanceof NumberData) {
            NumberData num = (NumberData) d;
            double val = num.getDouble();
            if (Double.isInfinite(val) || Double.isNaN(val))
                val = 1.0;
            else if (reverse)
                val = 2.0 / (1.0 + (val / targetVal));
            else
                val = val / targetVal;
            data.setData(1, n, new DoubleData(val));
        }
    }
}
Also used : NumberData(net.sourceforge.processdash.data.NumberData) SimpleData(net.sourceforge.processdash.data.SimpleData) SaveableData(net.sourceforge.processdash.data.SaveableData) DoubleData(net.sourceforge.processdash.data.DoubleData)

Aggregations

SaveableData (net.sourceforge.processdash.data.SaveableData)38 SimpleData (net.sourceforge.processdash.data.SimpleData)14 EscapeString (net.sourceforge.processdash.util.EscapeString)11 MalformedValueException (net.sourceforge.processdash.data.MalformedValueException)6 Iterator (java.util.Iterator)5 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 ConcurrentModificationException (java.util.ConcurrentModificationException)4 HashMap (java.util.HashMap)4 PatternSyntaxException (java.util.regex.PatternSyntaxException)4 DoubleData (net.sourceforge.processdash.data.DoubleData)4 CompilationException (net.sourceforge.processdash.data.compiler.CompilationException)4 ExecutionException (net.sourceforge.processdash.data.compiler.ExecutionException)4 LexerException (net.sourceforge.processdash.data.compiler.lexer.LexerException)4 ParserException (net.sourceforge.processdash.data.compiler.parser.ParserException)4 Map (java.util.Map)3 WeakHashMap (java.util.WeakHashMap)3 DateData (net.sourceforge.processdash.data.DateData)3 NumberData (net.sourceforge.processdash.data.NumberData)3 StringData (net.sourceforge.processdash.data.StringData)3