use of uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt in project OpenOLAT by OpenOLAT.
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.operator.Lt 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.Lt in project OpenOLAT by OpenOLAT.
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;
}
use of uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt 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.Lt 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;
}
Aggregations