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;
}
}
}
}
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;
}
}
}
}
Aggregations