Search in sources :

Example 11 with DQScore

use of org.openlca.core.model.DQScore in project olca-modules by GreenDelta.

the class DQSystemImport method mapScores.

private void mapScores(JsonObject json, DQIndicator i) {
    JsonArray scores = Json.getArray(json, "scores");
    if (scores == null || scores.size() == 0)
        return;
    for (JsonElement e : scores) {
        if (!e.isJsonObject())
            continue;
        JsonObject s = e.getAsJsonObject();
        DQScore score = new DQScore();
        score.position = Json.getInt(s, "position", 0);
        score.label = Json.getString(s, "label");
        score.description = Json.getString(s, "description");
        score.uncertainty = Json.getDouble(s, "uncertainty", 0);
        i.scores.add(score);
    }
}
Also used : JsonArray(com.google.gson.JsonArray) DQScore(org.openlca.core.model.DQScore) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject)

Example 12 with DQScore

use of org.openlca.core.model.DQScore in project olca-app by GreenDelta.

the class DataQualityShell method initSelection.

private void initSelection(Double baseUncertainty) {
    if (dqEntry == null)
        return;
    int[] values = system.toValues(dqEntry);
    if (values == null)
        return;
    for (int i = 1; i <= values.length; i++) {
        if (values[i - 1] == 0)
            continue;
        DQIndicator indicator = system.getIndicator(i);
        if (indicator == null)
            continue;
        DQScore score = indicator.getScore(values[i - 1]);
        if (score == null)
            continue;
        select(indicator, score);
    }
    if (!system.hasUncertainties)
        return;
    if (baseUncertainty == null)
        baseUncertainty = 1d;
    if (// check for issue #21
    baseUncertaintyText != null)
        baseUncertaintyText.setText(Double.toString(baseUncertainty));
    updateSigmaG();
}
Also used : DQScore(org.openlca.core.model.DQScore) DQIndicator(org.openlca.core.model.DQIndicator)

Example 13 with DQScore

use of org.openlca.core.model.DQScore in project olca-app by GreenDelta.

the class DataQualityShell method getSelection.

public String getSelection() {
    boolean anySelected = false;
    int[] values = new int[system.indicators.size()];
    for (DQIndicator indicator : system.indicators) {
        DQScore selection = getSelection(indicator);
        int value = 0;
        if (selection != null) {
            value = selection.position;
            anySelected = true;
        }
        values[indicator.position - 1] = value;
    }
    if (!anySelected)
        return null;
    return system.toString(values);
}
Also used : DQScore(org.openlca.core.model.DQScore) DQIndicator(org.openlca.core.model.DQIndicator)

Example 14 with DQScore

use of org.openlca.core.model.DQScore in project olca-app by GreenDelta.

the class QualityPanel method initSelection.

private void initSelection() {
    if (aspect.quality == null)
        return;
    int[] values = system.toValues(aspect.quality);
    if (values == null)
        return;
    for (int i = 1; i <= values.length; i++) {
        if (values[i - 1] == 0)
            continue;
        DQIndicator indicator = system.getIndicator(i);
        if (indicator == null)
            continue;
        DQScore score = indicator.getScore(values[i - 1]);
        if (score == null)
            continue;
        select(indicator, score, false);
    }
}
Also used : DQScore(org.openlca.core.model.DQScore) DQIndicator(org.openlca.core.model.DQIndicator)

Example 15 with DQScore

use of org.openlca.core.model.DQScore in project olca-app by GreenDelta.

the class DQSystemInfoPage method createUncertaintyMatrix.

private void createUncertaintyMatrix(Composite composite) {
    UI.gridLayout(composite, 2 * getModel().getScoreCount() + 1);
    createHeader(composite, false);
    for (DQIndicator indicator : getModel().indicators) {
        String name = indicator.name != null ? indicator.name : "";
        Label label = toolkit.createLabel(composite, name);
        label.setToolTipText(name);
        setGridData(label, 1, 15);
        Text indicatorText = indicatorTexts.get(indicator.position);
        indicatorText.addModifyListener((e) -> {
            label.setText(indicatorText.getText());
            label.setToolTipText(indicatorText.getText());
        });
        for (DQScore score : indicator.scores) {
            Text uncertaintyText = createTextCell(composite, 1, 8);
            getBinding().onDouble(() -> score, "uncertainty", uncertaintyText);
            commentControl(composite, "indicators[" + indicator.position + "].scores[" + score.position + "].uncertainty");
        }
    }
}
Also used : DQScore(org.openlca.core.model.DQScore) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) DQIndicator(org.openlca.core.model.DQIndicator)

Aggregations

DQScore (org.openlca.core.model.DQScore)16 DQIndicator (org.openlca.core.model.DQIndicator)12 Button (org.eclipse.swt.widgets.Button)3 JsonArray (com.google.gson.JsonArray)2 JsonObject (com.google.gson.JsonObject)2 Text (org.eclipse.swt.widgets.Text)2 DQSystem (org.openlca.core.model.DQSystem)2 JsonElement (com.google.gson.JsonElement)1 ArrayList (java.util.ArrayList)1 Label (org.eclipse.swt.widgets.Label)1 DQSystemDao (org.openlca.core.database.DQSystemDao)1