use of org.openlca.core.model.DQScore 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.DQScore 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.DQScore in project olca-app by GreenDelta.
the class DQSystemInfoPage method createAddScoreButton.
private void createAddScoreButton(Composite parent) {
Button button = toolkit.createButton(parent, M.AddScore, SWT.NONE);
if (getModel().indicators.size() == 0) {
button.setEnabled(false);
return;
}
Controls.onSelect(button, (e) -> {
int newScore = getModel().getScoreCount() + 1;
for (DQIndicator indicator : getModel().indicators) {
DQScore score = new DQScore();
score.position = newScore;
score.label = "Score " + newScore;
score.description = indicator.name + " - score " + newScore;
indicator.scores.add(score);
}
getEditor().setDirty(true);
redraw();
});
}
use of org.openlca.core.model.DQScore in project olca-app by GreenDelta.
the class DQSystemInfoPage method createAddIndicatorButton.
private void createAddIndicatorButton(Composite parent) {
Button button = toolkit.createButton(parent, M.AddIndicator, SWT.NONE);
Controls.onSelect(button, (e) -> {
DQIndicator indicator = new DQIndicator();
indicator.name = "Indicator " + (getModel().indicators.size() + 1);
indicator.position = getModel().indicators.size() + 1;
for (int i = 1; i <= getModel().getScoreCount(); i++) {
DQScore score = new DQScore();
score.position = i;
score.label = getModel().getScoreLabel(i);
score.description = indicator.name + " - score " + i;
indicator.scores.add(score);
}
getModel().indicators.add(indicator);
getEditor().setDirty(true);
redraw();
});
}
use of org.openlca.core.model.DQScore in project olca-app by GreenDelta.
the class DQSystemInfoPage method createRemoveScoreButton.
private void createRemoveScoreButton(Composite parent, int position) {
Button button = toolkit.createButton(parent, M.RemoveScore, SWT.NONE);
Controls.onSelect(button, (e) -> {
for (DQIndicator indicator : getModel().indicators) {
for (DQScore score : new ArrayList<>(indicator.scores)) {
if (score.position < position)
continue;
if (score.position == position) {
indicator.scores.remove(score);
continue;
}
score.position--;
}
}
getEditor().setDirty(true);
redraw();
});
}
Aggregations