use of teamdash.wbs.WBSNode in project processdash by dtuma.
the class ProxyRateColumn method recalcInheritedRates.
void recalcInheritedRates() {
// scan the list of proxy tables.
WBSNode[] proxies = proxyModel.getChildren(proxyModel.getRoot());
for (WBSNode proxy : proxies) {
// determine whether this table has a size and a default rate.
boolean hasSize = ProxySizeColumn.hasSizeMetric(proxy);
double rate = hasSize ? proxy.getNumericAttribute(ATTR_NAME) : Double.NaN;
// Now scan the relative size buckets in this proxy table.
WBSNode[] buckets = proxyModel.getChildren(proxy);
for (WBSNode bucket : buckets) {
// set the inherited rate for this bucket.
bucket.setNumericAttribute(INHERITED_ATTR_NAME, rate);
// if the explicit rate is equal to the inherited rate, remove
// the explicit entry.
double explicit = bucket.getNumericAttribute(ATTR_NAME);
if (equal(rate, explicit))
bucket.removeAttribute(ATTR_NAME);
// clear the "calculated" rate for now (it will be set later
// in the recalculation process).
bucket.removeAttribute(CALC_ATTR_NAME);
}
}
}
use of teamdash.wbs.WBSNode in project processdash by dtuma.
the class ProxySizeColumn method extrapolateMissingValues.
/**
* Look at the values for a set of buckets, and fill in missing values with
* a log-normal extrapolation.
*/
static void extrapolateMissingValues(AbstractNumericColumn col, WBSNode[] buckets, String extrapolatedAttr) {
// retrieve the current value for each bucket.
int numValuesFound = 0;
double[] values = new double[buckets.length];
for (int i = buckets.length; i-- > 0; ) {
WBSNode b = buckets[i];
b.setAttribute(extrapolatedAttr, null);
NumericDataValue v = (NumericDataValue) col.getValueAt(b);
if (v != null && v.value > 0) {
values[i] = v.value;
numValuesFound++;
}
}
// if no buckets have values, or if all buckets have values, exit.
if (numValuesFound == 0 || numValuesFound == buckets.length) {
return;
} else // scaling factor
if (numValuesFound == 1) {
int pos = findFirstValue(values, 0);
extrapolateDown(buckets, values, extrapolatedAttr, pos, DEFAULT_SCALING_FACTOR);
extrapolateUp(buckets, values, extrapolatedAttr, pos, DEFAULT_SCALING_FACTOR);
} else // if we have two or more values, extrapolate between and around them
if (numValuesFound > 1) {
// find the first pair of values, and extrapolate between them
int low = findFirstValue(values, 0);
int high = findFirstValue(values, low + 1);
double factor = extrapolateBetween(buckets, values, extrapolatedAttr, low, high);
// use the same factor to extrapolate down below that first pair
extrapolateDown(buckets, values, extrapolatedAttr, low, factor);
// find additional pairs and extrapolate between them too
while (true) {
low = high;
high = findFirstValue(values, low + 1);
if (high == -1)
break;
factor = extrapolateBetween(buckets, values, extrapolatedAttr, low, high);
}
// extrapolate up from the last pair
extrapolateUp(buckets, values, extrapolatedAttr, low, factor);
}
}
use of teamdash.wbs.WBSNode in project processdash by dtuma.
the class ProxyTimeColumn method recalculate.
public boolean recalculate() {
// give the rate column a chance to record state of inherited values
rateColumn.recalcInheritedRates();
// recalculate data for each proxy category, one at a time.
WBSNode[] proxies = proxyModel.getChildren(proxyModel.getRoot());
for (WBSNode proxy : proxies) recalculateProxy(proxy);
return true;
}
use of teamdash.wbs.WBSNode in project processdash by dtuma.
the class ProxyTimeColumn method recalculateProxy.
private void recalculateProxy(WBSNode proxy) {
WBSNode[] buckets = proxyModel.getChildren(proxy);
boolean proxyHasSizeMetric = ProxySizeColumn.hasSizeMetric(proxy);
// scan the buckets and calculate rate-driven times where appropriate
for (WBSNode bucket : buckets) {
bucket.removeAttribute(RATE_CALC_ATTR_NAME);
if (proxyHasSizeMetric) {
double explicitTime = bucket.getNumericAttribute(ATTR_NAME);
if (!(explicitTime > 0)) {
double size = parseNum(sizeColumn.getValueAt(bucket));
double rate = parseNum(rateColumn.getValueAt(bucket));
if (size > 0 && rate > 0) {
double time = size / rate;
bucket.setNumericAttribute(RATE_CALC_ATTR_NAME, time);
}
}
}
}
// fill in missing cells with an extrapolation
ProxySizeColumn.extrapolateMissingValues(this, buckets, EXTRAPOLATED_ATTR_NAME);
// finally, calculate effective rates for applicable buckets
if (proxyHasSizeMetric) {
for (WBSNode bucket : buckets) {
double time = bucket.getNumericAttribute(ATTR_NAME);
if (!(time > 0))
time = bucket.getNumericAttribute(EXTRAPOLATED_ATTR_NAME);
double size = parseNum(sizeColumn.getValueAt(bucket));
if (time > 0 && size > 0) {
double rate = size / time;
rateColumn.storeCalculatedRate(bucket, rate);
}
}
}
}
use of teamdash.wbs.WBSNode in project processdash by dtuma.
the class SizeActualDataColumn method recalc.
protected double recalc(WBSNode node) {
double result = safe(node.getNumericAttribute(nodeAttrName));
for (WBSNode child : wbsModel.getChildren(node)) {
double childVal = recalc(child);
if (shouldFilterFromCalculations(child) == false)
result += childVal;
}
Object value = null;
if (result > 0)
value = new NumericDataValue(result, false);
node.setAttribute(resultAttrName, value);
return result;
}
Aggregations