Search in sources :

Example 1 with Member

use of uk.ac.ed.ph.jqtiplus.node.expression.operator.Member in project OpenOLAT by OpenOLAT.

the class AssessmentItemFactory method appendModalFeedbackCondition.

private static void appendModalFeedbackCondition(ModalFeedbackCondition condition, Identifier responseIdentifier, Cardinality cardinality, And and) {
    ModalFeedbackCondition.Variable var = condition.getVariable();
    ModalFeedbackCondition.Operator operator = condition.getOperator();
    String value = condition.getValue();
    if (var == ModalFeedbackCondition.Variable.response) {
        if (cardinality == Cardinality.MULTIPLE) {
            if (operator == ModalFeedbackCondition.Operator.equals) {
                Member member = new Member(and);
                and.getExpressions().add(member);
                appendVariableBaseValue(var, value, responseIdentifier, member, true);
            } else if (operator == ModalFeedbackCondition.Operator.notEquals) {
                Not not = new Not(and);
                and.getExpressions().add(not);
                Member member = new Member(not);
                not.getExpressions().add(member);
                appendVariableBaseValue(var, value, responseIdentifier, member, true);
            }
        } else {
            if (operator == ModalFeedbackCondition.Operator.equals) {
                Match match = new Match(and);
                and.getExpressions().add(match);
                appendVariableBaseValue(var, value, responseIdentifier, match, false);
            } else if (operator == ModalFeedbackCondition.Operator.notEquals) {
                Not not = new Not(and);
                and.getExpressions().add(not);
                Match match = new Match(not);
                not.getExpressions().add(match);
                appendVariableBaseValue(var, value, responseIdentifier, match, false);
            }
        }
    } else {
        switch(operator) {
            case bigger:
                {
                    Gt gt = new Gt(and);
                    and.getExpressions().add(gt);
                    appendVariableBaseValue(var, value, responseIdentifier, gt, false);
                    break;
                }
            case biggerEquals:
                {
                    Gte gte = new Gte(and);
                    and.getExpressions().add(gte);
                    appendVariableBaseValue(var, value, responseIdentifier, gte, false);
                    break;
                }
            case equals:
                {
                    Equal equal = new Equal(and);
                    equal.setToleranceMode(ToleranceMode.EXACT);
                    and.getExpressions().add(equal);
                    appendVariableBaseValue(var, value, responseIdentifier, equal, false);
                    break;
                }
            case notEquals:
                {
                    Not not = new Not(and);
                    and.getExpressions().add(not);
                    Equal equal = new Equal(not);
                    equal.setToleranceMode(ToleranceMode.EXACT);
                    not.getExpressions().add(equal);
                    appendVariableBaseValue(var, value, responseIdentifier, equal, false);
                    break;
                }
            case smaller:
                {
                    Lt lt = new Lt(and);
                    and.getExpressions().add(lt);
                    appendVariableBaseValue(var, value, responseIdentifier, lt, false);
                    break;
                }
            case smallerEquals:
                {
                    Lte lte = new Lte(and);
                    and.getExpressions().add(lte);
                    appendVariableBaseValue(var, value, responseIdentifier, lte, false);
                    break;
                }
        }
    }
}
Also used : Not(uk.ac.ed.ph.jqtiplus.node.expression.operator.Not) Equal(uk.ac.ed.ph.jqtiplus.node.expression.operator.Equal) Lt(uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt) Gte(uk.ac.ed.ph.jqtiplus.node.expression.operator.Gte) Lte(uk.ac.ed.ph.jqtiplus.node.expression.operator.Lte) Member(uk.ac.ed.ph.jqtiplus.node.expression.operator.Member) Gt(uk.ac.ed.ph.jqtiplus.node.expression.operator.Gt) Match(uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)

Example 2 with Member

use of uk.ac.ed.ph.jqtiplus.node.expression.operator.Member in project openolat by klemens.

the class AssessmentItemFactory method appendModalFeedbackCondition.

private static void appendModalFeedbackCondition(ModalFeedbackCondition condition, Identifier responseIdentifier, Cardinality cardinality, And and) {
    ModalFeedbackCondition.Variable var = condition.getVariable();
    ModalFeedbackCondition.Operator operator = condition.getOperator();
    String value = condition.getValue();
    if (var == ModalFeedbackCondition.Variable.response) {
        if (cardinality == Cardinality.MULTIPLE) {
            if (operator == ModalFeedbackCondition.Operator.equals) {
                Member member = new Member(and);
                and.getExpressions().add(member);
                appendVariableBaseValue(var, value, responseIdentifier, member, true);
            } else if (operator == ModalFeedbackCondition.Operator.notEquals) {
                Not not = new Not(and);
                and.getExpressions().add(not);
                Member member = new Member(not);
                not.getExpressions().add(member);
                appendVariableBaseValue(var, value, responseIdentifier, member, true);
            }
        } else {
            if (operator == ModalFeedbackCondition.Operator.equals) {
                Match match = new Match(and);
                and.getExpressions().add(match);
                appendVariableBaseValue(var, value, responseIdentifier, match, false);
            } else if (operator == ModalFeedbackCondition.Operator.notEquals) {
                Not not = new Not(and);
                and.getExpressions().add(not);
                Match match = new Match(not);
                not.getExpressions().add(match);
                appendVariableBaseValue(var, value, responseIdentifier, match, false);
            }
        }
    } else {
        switch(operator) {
            case bigger:
                {
                    Gt gt = new Gt(and);
                    and.getExpressions().add(gt);
                    appendVariableBaseValue(var, value, responseIdentifier, gt, false);
                    break;
                }
            case biggerEquals:
                {
                    Gte gte = new Gte(and);
                    and.getExpressions().add(gte);
                    appendVariableBaseValue(var, value, responseIdentifier, gte, false);
                    break;
                }
            case equals:
                {
                    Equal equal = new Equal(and);
                    equal.setToleranceMode(ToleranceMode.EXACT);
                    and.getExpressions().add(equal);
                    appendVariableBaseValue(var, value, responseIdentifier, equal, false);
                    break;
                }
            case notEquals:
                {
                    Not not = new Not(and);
                    and.getExpressions().add(not);
                    Equal equal = new Equal(not);
                    equal.setToleranceMode(ToleranceMode.EXACT);
                    not.getExpressions().add(equal);
                    appendVariableBaseValue(var, value, responseIdentifier, equal, false);
                    break;
                }
            case smaller:
                {
                    Lt lt = new Lt(and);
                    and.getExpressions().add(lt);
                    appendVariableBaseValue(var, value, responseIdentifier, lt, false);
                    break;
                }
            case smallerEquals:
                {
                    Lte lte = new Lte(and);
                    and.getExpressions().add(lte);
                    appendVariableBaseValue(var, value, responseIdentifier, lte, false);
                    break;
                }
        }
    }
}
Also used : Not(uk.ac.ed.ph.jqtiplus.node.expression.operator.Not) Equal(uk.ac.ed.ph.jqtiplus.node.expression.operator.Equal) Lt(uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt) Gte(uk.ac.ed.ph.jqtiplus.node.expression.operator.Gte) Lte(uk.ac.ed.ph.jqtiplus.node.expression.operator.Lte) Member(uk.ac.ed.ph.jqtiplus.node.expression.operator.Member) Gt(uk.ac.ed.ph.jqtiplus.node.expression.operator.Gt) Match(uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)

Aggregations

Equal (uk.ac.ed.ph.jqtiplus.node.expression.operator.Equal)2 Gt (uk.ac.ed.ph.jqtiplus.node.expression.operator.Gt)2 Gte (uk.ac.ed.ph.jqtiplus.node.expression.operator.Gte)2 Lt (uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt)2 Lte (uk.ac.ed.ph.jqtiplus.node.expression.operator.Lte)2 Match (uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)2 Member (uk.ac.ed.ph.jqtiplus.node.expression.operator.Member)2 Not (uk.ac.ed.ph.jqtiplus.node.expression.operator.Not)2