use of uk.ac.ed.ph.jqtiplus.node.expression.general.Variable in project openolat by klemens.
the class AssessmentItemFactory method createMinScoreBoundLimitRule.
/**
* Rule which ensure that the final score is not under the min. score value.
*/
public static ResponseRule createMinScoreBoundLimitRule(ResponseProcessing responseProcessing) {
/*
<responseCondition>
<responseIf>
<lt>
<variable identifier="SCORE" /><variable identifier="MINSCORE" />
</lt>
<setOutcomeValue identifier="SCORE">
<variable identifier="MINSCORE" />
</setOutcomeValue>
</responseIf>
</responseCondition>
*/
ResponseCondition rule = new ResponseCondition(responseProcessing);
ResponseIf responseIf = new ResponseIf(rule);
rule.setResponseIf(responseIf);
Lt lt = new Lt(responseIf);
responseIf.setExpression(lt);
Variable scoreVar = new Variable(lt);
scoreVar.setIdentifier(SCORE_CLX_IDENTIFIER);
lt.getExpressions().add(scoreVar);
Variable minScoreVar = new Variable(lt);
minScoreVar.setIdentifier(MINSCORE_CLX_IDENTIFIER);
lt.getExpressions().add(minScoreVar);
SetOutcomeValue setOutcomeValue = new SetOutcomeValue(responseIf);
setOutcomeValue.setIdentifier(SCORE_IDENTIFIER);
Variable minScoreOutcomeVar = new Variable(setOutcomeValue);
minScoreOutcomeVar.setIdentifier(MINSCORE_CLX_IDENTIFIER);
setOutcomeValue.setExpression(minScoreOutcomeVar);
responseIf.getResponseRules().add(setOutcomeValue);
return rule;
}
use of uk.ac.ed.ph.jqtiplus.node.expression.general.Variable in project openolat by klemens.
the class AssessmentTestFactory method createMinScoreRule.
/*
<outcomeCondition>
<outcomeIf>
<lt>
<variable identifier="SCORE"/>
<variable identifier="MINSCORE"/>
</lt>
<setOutcomeValue identifier="SCORE">
<variable identifier="MINSCORE"/>
</setOutcomeValue>
</outcomeIf>
</outcomeCondition>
*/
public static OutcomeCondition createMinScoreRule(AssessmentTest assessmentTest) {
OutcomeCondition outcomeCondition = new OutcomeCondition(assessmentTest);
OutcomeIf outcomeIf = new OutcomeIf(outcomeCondition);
outcomeCondition.setOutcomeIf(outcomeIf);
Lt lt = new Lt(outcomeIf);
outcomeIf.setExpression(lt);
Variable scoreVar = new Variable(lt);
scoreVar.setIdentifier(SCORE_CLX_IDENTIFIER);
lt.getExpressions().add(scoreVar);
Variable minScoreVar = new Variable(lt);
minScoreVar.setIdentifier(MINSCORE_CLX_IDENTIFIER);
lt.getExpressions().add(minScoreVar);
SetOutcomeValue setOutcomeValue = new SetOutcomeValue(outcomeIf);
setOutcomeValue.setIdentifier(SCORE_IDENTIFIER);
Variable minScoreOutcomeVar = new Variable(setOutcomeValue);
minScoreOutcomeVar.setIdentifier(MINSCORE_CLX_IDENTIFIER);
setOutcomeValue.setExpression(minScoreOutcomeVar);
outcomeIf.getOutcomeRules().add(setOutcomeValue);
return outcomeCondition;
}
Aggregations