use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.
the class SelectWBSFilterTeamFrame method initMaxDepth.
private void initMaxDepth(String prefix) {
if (!parameters.containsKey("EXPORT")) {
// if we aren't currently exporting, display nodes to any arbitrary
// depth for drill-down.
maxDepth = -1;
} else {
// when exporting, check to see if the user has configured
// a desired depth for drill-down
String dataName = DataRepository.createDataName(prefix, MAX_EXPORT_DEPTH_DATA_NAME);
SimpleData data = getDataRepository().getSimpleValue(dataName);
if (data instanceof DoubleData) {
DoubleData doubleVal = (DoubleData) data;
maxDepth = doubleVal.getInteger();
} else {
maxDepth = DEFAULT_MAX_EXPORT_DEPTH;
}
}
}
use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.
the class Sumfor method call.
/** Perform a procedure call.
*
* This method <b>must</b> be thread-safe.
*/
public Object call(List arguments, ExpressionContext context) {
double result = 0.0, val;
String name = asString(getArg(arguments, 0));
if (name == null)
return null;
Iterator i = collapseLists(arguments, 1).iterator();
String path, dataName, alias;
alias = NO_ALIAS_YET;
SimpleData sVal = null;
while (i.hasNext()) {
path = asStringVal(i.next());
if (path == null)
continue;
dataName = DataRepository.createDataName(path, name);
if (alias == NO_ALIAS_YET)
alias = dataName;
else
alias = null;
sVal = context.get(dataName);
val = asDouble(sVal);
if (!Double.isNaN(val) && !Double.isInfinite(val))
result += val;
}
if (alias != null && alias != NO_ALIAS_YET && sVal != null)
return new DescribedValue(sVal, context.resolveName(alias));
else if (result == 0)
return ImmutableDoubleData.READ_ONLY_ZERO;
else
return new DoubleData(result);
}
use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.
the class WorkflowPlanSummary method writePhaseChart.
private void writePhaseChart(boolean plan, String titleRes, String columnRes, double factor, Map<String, DataPair> phaseData) throws IOException {
int numRows = phaseData.size() - 1;
ResultSet data = new ResultSet(numRows, 1);
int row = 0;
for (Entry<String, DataPair> e : phaseData.entrySet()) {
if (++row > numRows)
break;
data.setRowName(row, e.getKey());
double value = plan ? e.getValue().plan : e.getValue().actual;
data.setData(row, 1, new DoubleData(value / factor));
}
writeChart((plan ? "Plan" : "Actual"), titleRes, columnRes, data);
}
use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.
the class ProcessAnalysisPage method writePhaseTime.
public static void writePhaseTime(ResultSet resultSet, boolean pct, int firstCol, Object... phases) {
for (int i = phases.length; i-- > 0; ) {
int col = firstCol + i;
Object onePhase = phases[i];
if (onePhase instanceof String)
resultSet.setColName(col, (String) onePhase);
if (pct)
resultSet.setFormat(col, "100%");
for (int row = resultSet.numRows(); row > 0; row--) {
Enactment e = (Enactment) resultSet.getRowObj(row);
double phaseTime = e.actualTime(onePhase);
double finalTime = phaseTime / (pct ? e.actualTime() : 60);
resultSet.setData(row, col, new DoubleData(finalTime));
}
}
}
Aggregations