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();
}
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));
}
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);
}
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);
}
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);
}
}
Aggregations