Search in sources :

Example 41 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class MethodsPage method getNum.

protected SimpleData getNum(String qual, String name, double mult) {
    String inputFieldName = qual + name;
    String inputFieldValue = (String) params.get(inputFieldName);
    SimpleData result = N_A;
    try {
        double value = Double.parseDouble(inputFieldValue);
        if (!Double.isInfinite(value) && !Double.isNaN(value))
            result = new DoubleData(value * mult);
    } catch (NumberFormatException nfe) {
    }
    return result;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) DoubleData(net.sourceforge.processdash.data.DoubleData) ImmutableDoubleData(net.sourceforge.processdash.data.ImmutableDoubleData)

Example 42 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class ProbeData method shouldOnlyIncludeCompletedProjects.

private boolean shouldOnlyIncludeCompletedProjects(DataRepository data, String prefix) {
    String dataName = DataRepository.createDataName(prefix, PROBE_ONLY_COMPLETED_NAME);
    SimpleData d = data.getSimpleValue(dataName);
    if (d != null && d.test() == false)
        return false;
    else
        return true;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 43 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class ProbeData method saveLastRunValue.

private void saveLastRunValue(int col) {
    String elem = getDataName(col, true);
    String dataName = DataRepository.createDataName(prefix, elem);
    SimpleData sd = data.getSimpleValue(dataName);
    dataName = DataRepository.createDataName(prefix, PROBE_LAST_RUN_PREFIX + elem);
    data.userPutValue(dataName, sd);
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 44 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class GenericPlanSummaryForm method writeContents.

protected void writeContents() throws IOException {
    StringBuffer uri = new StringBuffer((String) env.get("SCRIPT_PATH"));
    uri.setLength(uri.length() - 6);
    uri.append(".shtm");
    String unit, units;
    DataRepository data = getDataRepository();
    String prefix = getPrefix();
    SimpleData d = data.getSimpleValue(prefix + "/" + UNITS_NAME);
    units = (d != null ? d.format() : null);
    if (units == null || units.trim().length() == 0)
        units = resources.getString("Default_Units");
    int semicolonPos = units.indexOf(';');
    if (semicolonPos > -1) {
        unit = units.substring(0, semicolonPos);
        units = units.substring(semicolonPos + 1);
    } else if (units.endsWith("s")) {
        unit = units.substring(0, units.length() - 1);
    } else {
        unit = units;
    }
    HTMLUtils.appendQuery(uri, "Unit", unit);
    HTMLUtils.appendQuery(uri, "Units", units);
    DashHierarchy props = getPSPProperties();
    PropertyKey self = props.findExistingKey(getPrefix());
    int numPhases = props.getNumChildren(self);
    for (int i = 0; i < numPhases; i++) HTMLUtils.appendQuery(uri, "Phases", props.getChildKey(self, i).name());
    String text = getRequestAsString(uri.toString());
    out.write(text);
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 45 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class StudentProfileValidator method checkValues.

private boolean checkValues() {
    String owner = getOwner();
    if (owner == null || owner.trim().length() == 0)
        return false;
    DataContext c = getDataContext();
    for (String name : NAMES_TO_CHECK) {
        SimpleData sd = c.getSimpleValue(name);
        if (sd == null || !sd.test() || sd.format().trim().length() == 0)
            return false;
    }
    c.putValue("../Student_Profile_Complete", ImmutableDoubleData.TRUE);
    if (c.getSimpleValue("Completed") == null)
        c.putValue("Completed", new DateData());
    return true;
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) DateData(net.sourceforge.processdash.data.DateData) SimpleData(net.sourceforge.processdash.data.SimpleData)

Aggregations

SimpleData (net.sourceforge.processdash.data.SimpleData)164 ListData (net.sourceforge.processdash.data.ListData)20 DoubleData (net.sourceforge.processdash.data.DoubleData)15 SaveableData (net.sourceforge.processdash.data.SaveableData)14 StringData (net.sourceforge.processdash.data.StringData)13 IOException (java.io.IOException)11 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)11 DateData (net.sourceforge.processdash.data.DateData)10 Iterator (java.util.Iterator)9 List (java.util.List)7 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)6 NumberData (net.sourceforge.processdash.data.NumberData)6 Element (org.w3c.dom.Element)6 Map (java.util.Map)5 DataContext (net.sourceforge.processdash.data.DataContext)5 EscapeString (net.sourceforge.processdash.util.EscapeString)5 File (java.io.File)4