Search in sources :

Example 21 with OutcomeCondition

use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition in project openolat by klemens.

the class QtiNodesExtractor method extractCutValue.

public static Double extractCutValue(AssessmentTest assessmentTest) {
    Double cutValue = null;
    if (assessmentTest.getOutcomeProcessing() != null) {
        List<OutcomeRule> outcomeRules = assessmentTest.getOutcomeProcessing().getOutcomeRules();
        for (OutcomeRule outcomeRule : outcomeRules) {
            if (outcomeRule instanceof OutcomeCondition) {
                OutcomeCondition outcomeCondition = (OutcomeCondition) outcomeRule;
                boolean findIf = findSetOutcomeValue(outcomeCondition.getOutcomeIf(), QTI21Constants.PASS_IDENTIFIER);
                boolean findElse = findSetOutcomeValue(outcomeCondition.getOutcomeElse(), QTI21Constants.PASS_IDENTIFIER);
                if (findIf && findElse) {
                    cutValue = extractCutValue(outcomeCondition.getOutcomeIf());
                }
            }
        }
    }
    return cutValue;
}
Also used : OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) OutcomeRule(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)

Example 22 with OutcomeCondition

use of uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition in project openolat by klemens.

the class TestFeedbackBuilder method findFeedbackMatch.

private boolean findFeedbackMatch(OutcomeRule outcomeRule, boolean pass, ComplexReferenceIdentifier id) {
    if (outcomeRule instanceof OutcomeCondition) {
        OutcomeCondition outcomeCondition = (OutcomeCondition) outcomeRule;
        OutcomeIf outcomeIf = outcomeCondition.getOutcomeIf();
        if (outcomeIf != null && outcomeIf.getExpressions().size() == 1) {
            Expression mustBeAnd = outcomeIf.getExpressions().get(0);
            if (mustBeAnd instanceof And && mustBeAnd.getExpressions().size() == 1) {
                Expression mustBeMatch = mustBeAnd.getExpressions().get(0);
                if (mustBeMatch instanceof Match && mustBeMatch.getExpressions().size() == 2) {
                    return findFeedbackMatch((Match) mustBeMatch, pass, id);
                }
            }
        }
    }
    return false;
}
Also used : Expression(uk.ac.ed.ph.jqtiplus.node.expression.Expression) OutcomeIf(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeIf) And(uk.ac.ed.ph.jqtiplus.node.expression.operator.And) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) Match(uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)

Aggregations

OutcomeCondition (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition)22 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue)14 OutcomeIf (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeIf)10 OutcomeRule (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeRule)10 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)4 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)4 And (uk.ac.ed.ph.jqtiplus.node.expression.operator.And)4 Match (uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)4 Expression (uk.ac.ed.ph.jqtiplus.node.expression.Expression)2 Gte (uk.ac.ed.ph.jqtiplus.node.expression.operator.Gte)2 Lt (uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt)2 Multiple (uk.ac.ed.ph.jqtiplus.node.expression.operator.Multiple)2 Sum (uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum)2 TestVariables (uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables)2 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)2 TestFeedback (uk.ac.ed.ph.jqtiplus.node.test.TestFeedback)2 OutcomeElse (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeElse)2 FloatValue (uk.ac.ed.ph.jqtiplus.value.FloatValue)2 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)2