Search in sources :

Example 11 with Contribution

use of org.openlca.core.results.Contribution in project olca-app by GreenDelta.

the class ImpactChecksPage method flatNodes.

/**
 * Returns a flat list of flow nodes that have no characterization factor in any
 * of the LCIA categories.
 */
private List<Contribution<?>> flatNodes() {
    List<Contribution<?>> nodes = new ArrayList<>();
    for (var flow : result.getFlows()) {
        boolean allZero = true;
        for (ImpactDescriptor impact : result.getImpacts()) {
            double f = result.getImpactFactor(impact, flow);
            if (f != 0) {
                allZero = false;
                break;
            }
        }
        if (allZero) {
            Contribution<?> c = Contribution.of(flow);
            c.amount = result.getTotalFlowResult(flow);
            nodes.add(c);
        }
    }
    return nodes;
}
Also used : ArrayList(java.util.ArrayList) ImpactDescriptor(org.openlca.core.model.descriptors.ImpactDescriptor) Contribution(org.openlca.core.results.Contribution)

Aggregations

Contribution (org.openlca.core.results.Contribution)11 ArrayList (java.util.ArrayList)9 List (java.util.List)8 ImpactDescriptor (org.openlca.core.model.descriptors.ImpactDescriptor)7 FlowDescriptor (org.openlca.core.model.descriptors.FlowDescriptor)6 ProcessDescriptor (org.openlca.core.model.descriptors.ProcessDescriptor)6 RootDescriptor (org.openlca.core.model.descriptors.RootDescriptor)6 EnviFlow (org.openlca.core.matrix.index.EnviFlow)5 ContributionResult (org.openlca.core.results.ContributionResult)5 JsonArray (com.google.gson.JsonArray)4 Composite (org.eclipse.swt.widgets.Composite)4 UpstreamNode (org.openlca.core.results.UpstreamNode)4 UpstreamTree (org.openlca.core.results.UpstreamTree)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Collectors (java.util.stream.Collectors)3 Action (org.eclipse.jface.action.Action)3 ITreeContentProvider (org.eclipse.jface.viewers.ITreeContentProvider)3 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)3 LocationDescriptor (org.openlca.core.model.descriptors.LocationDescriptor)3