Search in sources :

Example 21 with DoubleData

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();
    }
}
Also used : MalformedValueException(net.sourceforge.processdash.data.MalformedValueException) DoubleData(net.sourceforge.processdash.data.DoubleData) MalformedValueException(net.sourceforge.processdash.data.MalformedValueException) ParseException(java.text.ParseException)

Example 22 with DoubleData

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));
}
Also used : NumberData(net.sourceforge.processdash.data.NumberData) DoubleData(net.sourceforge.processdash.data.DoubleData)

Example 23 with DoubleData

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;
}
Also used : DoubleData(net.sourceforge.processdash.data.DoubleData) ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData)

Example 24 with DoubleData

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++;
}
Also used : ParseException(net.sourceforge.processdash.tool.probe.SizePerItemTable.ParseException) DoubleData(net.sourceforge.processdash.data.DoubleData)

Example 25 with DoubleData

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;
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) ResultSet(net.sourceforge.processdash.data.util.ResultSet) DoubleData(net.sourceforge.processdash.data.DoubleData) ListData(net.sourceforge.processdash.data.ListData)

Aggregations

DoubleData (net.sourceforge.processdash.data.DoubleData)39 SimpleData (net.sourceforge.processdash.data.SimpleData)15 Iterator (java.util.Iterator)7 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)7 ListData (net.sourceforge.processdash.data.ListData)5 NumberData (net.sourceforge.processdash.data.NumberData)5 ResultSet (net.sourceforge.processdash.data.util.ResultSet)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 SaveableData (net.sourceforge.processdash.data.SaveableData)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 NumberFunction (net.sourceforge.processdash.data.NumberFunction)3 StringData (net.sourceforge.processdash.data.StringData)3 CompiledScript (net.sourceforge.processdash.data.compiler.CompiledScript)3 IOException (java.io.IOException)2 DateData (net.sourceforge.processdash.data.DateData)2 MalformedValueException (net.sourceforge.processdash.data.MalformedValueException)2 StudyGroupManager (net.sourceforge.processdash.tool.db.StudyGroupManager)2