Search in sources :

Example 61 with Variable

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;
}
Also used : Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) Lt(uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt) ResponseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf) ResponseCondition(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)

Example 62 with Variable

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;
}
Also used : Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeIf(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeIf) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) Lt(uk.ac.ed.ph.jqtiplus.node.expression.operator.Lt)

Aggregations

Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)62 ResponseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf)48 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue)46 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)40 Match (uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)30 Sum (uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum)28 ResponseElse (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElse)26 Correct (uk.ac.ed.ph.jqtiplus.node.expression.general.Correct)24 ComplexReferenceIdentifier (uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier)24 IsNull (uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull)22 ResponseCondition (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)22 MapResponse (uk.ac.ed.ph.jqtiplus.node.expression.general.MapResponse)16 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)16 And (uk.ac.ed.ph.jqtiplus.node.expression.operator.And)14 ResponseElseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf)10 Multiple (uk.ac.ed.ph.jqtiplus.node.expression.operator.Multiple)8 Not (uk.ac.ed.ph.jqtiplus.node.expression.operator.Not)6 FloatValue (uk.ac.ed.ph.jqtiplus.value.FloatValue)6 ArrayList (java.util.ArrayList)4 AssessmentItemFactory.appendSetOutcomeFeedbackCorrect (org.olat.ims.qti21.model.xml.AssessmentItemFactory.appendSetOutcomeFeedbackCorrect)4