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);
}
}
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();
}
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);
}
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);
}
}
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");
}
}
}
Aggregations