Search in sources :

Example 11 with NumericDataValue

use of teamdash.wbs.NumericDataValue 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);
    }
}
Also used : NumericDataValue(teamdash.wbs.NumericDataValue) WBSNode(teamdash.wbs.WBSNode)

Example 12 with NumericDataValue

use of teamdash.wbs.NumericDataValue in project processdash by dtuma.

the class ProxySizeColumn method getSizeValueAt.

public static NumericDataValue getSizeValueAt(WBSNode bucket) {
    if (!hasSizeMetric(bucket) || !ProxyWBSModel.isBucket(bucket))
        return null;
    double value = bucket.getNumericAttribute(ATTR_NAME);
    if (value > 0)
        return new NumericDataValue(value);
    value = bucket.getNumericAttribute(EXTRAPOLATED_ATTR_NAME);
    if (value > 0)
        return new NumericDataValue(value, true, false, EXTRAPOLATED_TOOLTIP);
    return null;
}
Also used : NumericDataValue(teamdash.wbs.NumericDataValue)

Example 13 with NumericDataValue

use of teamdash.wbs.NumericDataValue 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;
}
Also used : NumericDataValue(teamdash.wbs.NumericDataValue) WBSNode(teamdash.wbs.WBSNode)

Aggregations

NumericDataValue (teamdash.wbs.NumericDataValue)13 WBSNode (teamdash.wbs.WBSNode)2 Component (java.awt.Component)1 Date (java.util.Date)1 JLabel (javax.swing.JLabel)1 HSSFRichTextString (org.apache.poi.hssf.usermodel.HSSFRichTextString)1 TeamMemberTime (teamdash.wbs.TeamMemberTime)1