Search in sources :

Example 1 with ResultDao

use of org.openlca.core.database.ResultDao in project olca-modules by GreenDelta.

the class TechIndex method fillFrom.

private void fillFrom(IDatabase db, ProductSystem system) {
    var systems = new ProductSystemDao(db).descriptorMap();
    var processes = new ProcessDao(db).descriptorMap();
    var results = new ResultDao(db).descriptorMap();
    var flows = new FlowDao(db).descriptorMap();
    for (var link : system.processLinks) {
        RootDescriptor p = processes.get(link.providerId);
        if (p == null) {
            p = systems.get(link.providerId);
            if (p == null) {
                p = results.get(link.providerId);
            }
        }
        if (p == null)
            continue;
        var flow = flows.get(link.flowId);
        if (flow == null)
            continue;
        // the tech-index checks for duplicates of products and links
        var provider = TechFlow.of(p, flow);
        add(provider);
        var exchange = new LongPair(link.processId, link.exchangeId);
        putLink(exchange, provider);
    }
}
Also used : FlowDao(org.openlca.core.database.FlowDao) ProcessDao(org.openlca.core.database.ProcessDao) ResultDao(org.openlca.core.database.ResultDao) RootDescriptor(org.openlca.core.model.descriptors.RootDescriptor) ProductSystemDao(org.openlca.core.database.ProductSystemDao)

Aggregations

FlowDao (org.openlca.core.database.FlowDao)1 ProcessDao (org.openlca.core.database.ProcessDao)1 ProductSystemDao (org.openlca.core.database.ProductSystemDao)1 ResultDao (org.openlca.core.database.ResultDao)1 RootDescriptor (org.openlca.core.model.descriptors.RootDescriptor)1