All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cqframework.cql.elm.requirements.ElmConjunctiveRequirement Maven / Gradle / Ivy

package org.cqframework.cql.elm.requirements;

import java.util.ArrayList;
import java.util.List;
import org.hl7.elm.r1.Expression;
import org.hl7.elm.r1.VersionedIdentifier;

public class ElmConjunctiveRequirement extends ElmExpressionRequirement {
    public ElmConjunctiveRequirement(VersionedIdentifier libraryIdentifier, Expression expression) {
        super(libraryIdentifier, expression);
    }

    private List arguments = new ArrayList();

    public List getArguments() {
        return arguments;
    }

    @Override
    public ElmExpressionRequirement combine(ElmRequirement requirement) {
        if (requirement instanceof ElmConjunctiveRequirement) {
            for (ElmExpressionRequirement argument : ((ElmConjunctiveRequirement) requirement).getArguments()) {
                arguments.add(argument);
            }
        } else if (requirement instanceof ElmDisjunctiveRequirement) {
            // Conjunction of disjunctions, too complex for analysis (i.e. not in DNF)
            return new ElmExpressionRequirement(this.libraryIdentifier, this.getExpression());
        } else if (requirement instanceof ElmExpressionRequirement) {
            arguments.add((ElmExpressionRequirement) requirement);
        } else if (requirement instanceof ElmRequirements) {
            for (ElmRequirement r : ((ElmRequirements) requirement).getRequirements()) {
                combine(r);
            }
        }
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy