Search in sources :

Example 6 with NumberData

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

the class EVTask method loadStructuralData.

private void loadStructuralData() {
    SimpleData d = getValue(TASK_ORDINAL_PREFIX + taskListName);
    if (d instanceof NumberData)
        taskOrdinal = savedTaskOrdinal = ((NumberData) d).getInteger();
    d = getValue(TASK_PRUNING_PREFIX + taskListName);
    if (d instanceof NumberData)
        pruningFlag = savedPruningFlag = ((NumberData) d).getInteger();
}
Also used : NumberData(net.sourceforge.processdash.data.NumberData) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 7 with NumberData

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

the class TimingMetricsRecorder method storeNumberIfChanged.

private void storeNumberIfChanged(String dataName, SaveableData currentVal, long[] pathValue) {
    long pathTime = (pathValue)[0];
    if (currentVal instanceof NumberData && ((NumberData) currentVal).getDouble() == pathTime)
        return;
    data.putValue(dataName, new DoubleData(pathTime, false));
}
Also used : NumberData(net.sourceforge.processdash.data.NumberData) DoubleData(net.sourceforge.processdash.data.DoubleData)

Example 8 with NumberData

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

the class TimingMetricsRecorderTest method assertTime.

private void assertTime(String path, int i) {
    String dataName = path + "/Time";
    SimpleData d = data.getSimpleValue(dataName);
    if (d == null && i == 0)
        return;
    assertNotNull("Missing time data for " + path, d);
    assertTrue("Time data for " + path + " is not NumberData", d instanceof NumberData);
    NumberData n = (NumberData) d;
    assertEquals("Wrong time for path " + path, i, n.getDouble(), 0);
}
Also used : NumberData(net.sourceforge.processdash.data.NumberData) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 9 with NumberData

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

the class DefaultTimeLoggingModelTest method assertTime.

protected void assertTime(String path, int i) {
    String dataName = path + "/Time";
    SimpleData d = data.getSimpleValue(dataName);
    if (d == null && i == 0)
        return;
    assertNotNull("Missing time data for " + path, d);
    assertTrue("Time data for " + path + " is not NumberData", d instanceof NumberData);
    NumberData n = (NumberData) d;
    assertEquals("Wrong time for path " + path, i, n.getDouble(), 0);
}
Also used : NumberData(net.sourceforge.processdash.data.NumberData) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 10 with NumberData

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

the class AbstractSyncWorker method putValue.

public void putValue(String name, SaveableData newValue) {
    SaveableData currVal = getValue(name);
    SaveableData lastRevSyncVal = lastReverseSyncedValue;
    lastReverseSyncedValue = null;
    if (lastRevSyncVal == null && !(newValue instanceof NumberData)) {
        // in a positive match (while the reverse order would return false)
        if (dataEquals(newValue, currVal))
            // no need to store the new value if it matches the current value.
            return;
        else {
            // the value has changed. save the new value.
            doPutValue(name, newValue);
            noteDataChange(name);
            return;
        }
    }
    String syncName = syncDataName(name);
    SimpleData lastSyncVal = getSimpleValue(syncName);
    if (dataEquals(newValue, currVal) && (currVal instanceof SimpleData)) {
        if (dataEquals(newValue, lastSyncVal)) {
            // all three values are in agreement. Nothing needs to be done.
            return;
        } else {
            // the new and old values match, but the sync doesn't.  This
            // would occur if:
            //   (a) the user has synced a value manually,
            //   (b) the WBS was updated via reverse sync, or
            //   (c) the sync occurred before sync records were kept.
            // The right action is to store the sync value for future
            // reference.  We will do this silently, even in what-if mode,
            // and won't report any change having been made.
            doPutValueForce(syncName, newValue);
        }
    } else if (isFalseSimpleValue(currVal) || !(currVal instanceof SimpleData) || dataEquals(currVal, lastSyncVal) || dataEquals(currVal, lastRevSyncVal)) {
        // Update the value, and make a note of the value we're syncing.
        doPutValue(name, newValue);
        doPutValue(syncName, newValue);
        noteDataChange(name);
    }
}
Also used : NumberData(net.sourceforge.processdash.data.NumberData) SimpleData(net.sourceforge.processdash.data.SimpleData) SaveableData(net.sourceforge.processdash.data.SaveableData)

Aggregations

NumberData (net.sourceforge.processdash.data.NumberData)10 SimpleData (net.sourceforge.processdash.data.SimpleData)6 DoubleData (net.sourceforge.processdash.data.DoubleData)5 SaveableData (net.sourceforge.processdash.data.SaveableData)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ListData (net.sourceforge.processdash.data.ListData)2 StudyGroupManager (net.sourceforge.processdash.tool.db.StudyGroupManager)2 DateData (net.sourceforge.processdash.data.DateData)1