use of uk.ac.ed.ph.jqtiplus.node.expression.operator.Gt 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.Gt in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createMaxScoreBoundLimitRule.
/**
* Rule which ensure that the final score is not above the max. score value.
*/
public static ResponseRule createMaxScoreBoundLimitRule(ResponseProcessing responseProcessing) {
/*
<responseCondition>
<responseIf>
<gt>
<variable identifier="SCORE" /><variable identifier="MAXSCORE" />
</gt>
<setOutcomeValue identifier="SCORE">
<variable identifier="MAXSCORE" />
</setOutcomeValue>
</responseIf>
</responseCondition>
*/
ResponseCondition rule = new ResponseCondition(responseProcessing);
ResponseIf responseIf = new ResponseIf(rule);
rule.setResponseIf(responseIf);
Gt gt = new Gt(responseIf);
responseIf.setExpression(gt);
Variable scoreVar = new Variable(gt);
scoreVar.setIdentifier(SCORE_CLX_IDENTIFIER);
gt.getExpressions().add(scoreVar);
Variable maxScoreVar = new Variable(gt);
maxScoreVar.setIdentifier(MAXSCORE_CLX_IDENTIFIER);
gt.getExpressions().add(maxScoreVar);
SetOutcomeValue setOutcomeValue = new SetOutcomeValue(responseIf);
setOutcomeValue.setIdentifier(SCORE_IDENTIFIER);
Variable maxScoreOutcomeVar = new Variable(setOutcomeValue);
maxScoreOutcomeVar.setIdentifier(MAXSCORE_CLX_IDENTIFIER);
setOutcomeValue.setExpression(maxScoreOutcomeVar);
responseIf.getResponseRules().add(setOutcomeValue);
return rule;
}
use of uk.ac.ed.ph.jqtiplus.node.expression.operator.Gt 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;
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.expression.operator.Gt in project openolat by klemens.
the class AssessmentItemFactory method createMaxScoreBoundLimitRule.
/**
* Rule which ensure that the final score is not above the max. score value.
*/
public static ResponseRule createMaxScoreBoundLimitRule(ResponseProcessing responseProcessing) {
/*
<responseCondition>
<responseIf>
<gt>
<variable identifier="SCORE" /><variable identifier="MAXSCORE" />
</gt>
<setOutcomeValue identifier="SCORE">
<variable identifier="MAXSCORE" />
</setOutcomeValue>
</responseIf>
</responseCondition>
*/
ResponseCondition rule = new ResponseCondition(responseProcessing);
ResponseIf responseIf = new ResponseIf(rule);
rule.setResponseIf(responseIf);
Gt gt = new Gt(responseIf);
responseIf.setExpression(gt);
Variable scoreVar = new Variable(gt);
scoreVar.setIdentifier(SCORE_CLX_IDENTIFIER);
gt.getExpressions().add(scoreVar);
Variable maxScoreVar = new Variable(gt);
maxScoreVar.setIdentifier(MAXSCORE_CLX_IDENTIFIER);
gt.getExpressions().add(maxScoreVar);
SetOutcomeValue setOutcomeValue = new SetOutcomeValue(responseIf);
setOutcomeValue.setIdentifier(SCORE_IDENTIFIER);
Variable maxScoreOutcomeVar = new Variable(setOutcomeValue);
maxScoreOutcomeVar.setIdentifier(MAXSCORE_CLX_IDENTIFIER);
setOutcomeValue.setExpression(maxScoreOutcomeVar);
responseIf.getResponseRules().add(setOutcomeValue);
return rule;
}
Aggregations