use of org.openlca.core.model.DQIndicator in project olca-modules by GreenDelta.
the class CellWriter method dataQualityHeader.
/**
* Writes the data quality indicators of the given system into the given
* row, starting with column col.
*/
public int dataQualityHeader(Sheet sheet, int row, int col, DQSystem system) {
Collections.sort(system.indicators);
for (DQIndicator indicator : system.indicators) {
String name = Integer.toString(indicator.position);
if (!Strings.isNullOrEmpty(indicator.name)) {
name = indicator.name.substring(0, 1);
}
cell(sheet, row, col++, name, true);
}
return col;
}
use of org.openlca.core.model.DQIndicator in project olca-modules by GreenDelta.
the class DQResultTest method createDQSystem.
private void createDQSystem() {
dqSystem = new DQSystem();
for (int i = 1; i <= 5; i++) {
DQIndicator indicator = new DQIndicator();
indicator.position = i;
dqSystem.indicators.add(indicator);
for (int j = 1; j <= 5; j++) {
DQScore score = new DQScore();
score.position = j;
indicator.scores.add(score);
}
}
dqSystem = new DQSystemDao(db).insert(dqSystem);
}
use of org.openlca.core.model.DQIndicator in project olca-modules by GreenDelta.
the class DQSystemImport method mapIndicators.
private void mapIndicators(JsonObject json, DQSystem s) {
JsonArray indicators = Json.getArray(json, "indicators");
if (indicators == null || indicators.size() == 0)
return;
for (JsonElement e : indicators) {
if (!e.isJsonObject())
continue;
JsonObject i = e.getAsJsonObject();
DQIndicator indicator = new DQIndicator();
indicator.name = Json.getString(i, "name");
indicator.position = Json.getInt(i, "position", 0);
mapScores(i, indicator);
s.indicators.add(indicator);
}
}
use of org.openlca.core.model.DQIndicator in project olca-modules by GreenDelta.
the class DQSystems method ecoinvent.
/**
* Creates an instance of the ecoinvent data quality system.
*/
public static DQSystem ecoinvent() {
DQSystem system = new DQSystem();
system.name = "ecoinvent data quality system";
system.refId = EI_DQS;
system.hasUncertainties = true;
String[] indicators = eiIndicators();
String[][] scores = eiScores();
double[][] uncertainties = eiUncertainties();
for (int i = 0; i < indicators.length; i++) {
DQIndicator indicator = new DQIndicator();
indicator.name = indicators[i];
indicator.position = i + 1;
for (int j = 0; j < scores[i].length; j++) {
DQScore score = new DQScore();
score.description = scores[i][j];
score.position = j + 1;
score.uncertainty = uncertainties[i][j];
indicator.scores.add(score);
}
system.indicators.add(indicator);
}
return system;
}
use of org.openlca.core.model.DQIndicator in project olca-app by GreenDelta.
the class DQSystemInfoPage method createRemoveIndicatorButton.
private void createRemoveIndicatorButton(Composite parent, int position) {
Button button = toolkit.createButton(parent, M.RemoveIndicator, SWT.NONE);
Controls.onSelect(button, (e) -> {
for (DQIndicator indicator : new ArrayList<>(getModel().indicators)) {
if (indicator.position < position)
continue;
if (indicator.position == position) {
getModel().indicators.remove(indicator);
continue;
}
indicator.position--;
}
getEditor().setDirty(true);
redraw();
});
}
Aggregations