use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.
the class TimeInterpreter method setString.
public void setString(String s) throws MalformedValueException {
try {
Number n = FMT.parse(s);
value = new DoubleData(n.doubleValue());
} catch (Exception pe) {
throw new MalformedValueException();
}
}
use of net.sourceforge.processdash.data.DoubleData 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.DoubleData in project processdash by dtuma.
the class HierarchySynchronizer method getNextClientId.
private String getNextClientId() {
int maxNum = (int) getDoubleData(getData(projectPath, MAX_CLIENT_ID_DATA_NAME));
int nextNum = maxNum + 1;
forceData(projectPath, MAX_CLIENT_ID_DATA_NAME, new DoubleData(nextNum));
return clientIdPrefix + ":" + nextNum;
}
use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.
the class EditSizePerItemTables method doPost.
protected void doPost() throws IOException {
DashController.checkIP(env.get("REMOTE_ADDR"));
parseFormData();
if (parameters.containsKey(SAVE) && Settings.isReadWrite()) {
try {
save(getParameter(NAME), getParameter(UNITS), getParameter(CONTENTS));
getDataRepository().putValue(CHANGE_DATA_NAME, new DoubleData(uniqueNumber));
} catch (ParseException e) {
writeHeader();
redrawForm(e);
return;
}
}
out.print("Location: " + SCRIPT + "?" + uniqueNumber + "\r\n\r\n");
uniqueNumber++;
}
use of net.sourceforge.processdash.data.DoubleData in project processdash by dtuma.
the class ProbeItemSizeHistogram method buildData.
@Override
protected void buildData() {
int[] histogram = new int[SIZE_NAMES.size()];
DataContext data = getDataContext();
ListData partsAdditions = ListData.asListData(data.getSimpleValue(PARTS_LIST));
if (partsAdditions != null) {
for (int i = 0; i < partsAdditions.size(); i++) {
String path = asString(partsAdditions.get(i));
double itemCount = asDoubleData(data.getSimpleValue(path + METHODS));
String relSize = asString(data.getSimpleValue(path + REL_SIZE));
if (!StringUtils.hasValue(relSize) && itemCount == 0)
continue;
int relSizePos = SIZE_NAMES.indexOf(relSize);
if (relSizePos == -1)
relSizePos = UNCATEGORIZED_POS;
if (itemCount == 0)
itemCount = 1;
histogram[relSizePos]++;
}
}
// if no items were present in the "[BLANK]" category, don't show it.
int len = histogram.length;
if (histogram[len - 1] == 0)
len--;
ResultSet result = new ResultSet(len, 1);
result.setColName(0, "");
result.setColName(1, "Total # Items");
for (int i = 0; i < len; i++) {
result.setRowName(i + 1, SIZE_NAMES.get(i));
result.setData(i + 1, 1, new DoubleData(histogram[i]));
}
this.data = result;
}
Aggregations