Search in sources :

Example 1 with ResponseElseIf

use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf in project OpenOLAT by OpenOLAT.

the class KPrimAssessmentItemBuilder method buildMainKPrimScoreRule.

/**
 * The score is 100% if 4 correct responses, 50% if 3 correct
 * responses and 0 otherwise.
 *
 * @param rule
 */
private void buildMainKPrimScoreRule(ResponseCondition rule) {
    /*
	<responseCondition>
		<responseIf>
			<isNull>
				<variable identifier="RESPONSE"/>
			</isNull>
			<setOutcomeValue identifier="SCORE">
				<baseValue baseType="float">0.0</baseValue>
			</setOutcomeValue>
		</responseIf>
		<responseElse>
			<setOutcomeValue identifier="SCORE">
				<mapResponse identifier="RESPONSE"/>
			</setOutcomeValue>
		</responseElse>
	</responseCondition>
		 */
    ResponseIf responseIf = new ResponseIf(rule);
    rule.setResponseIf(responseIf);
    {
        // if no response
        IsNull isNull = new IsNull(responseIf);
        responseIf.getExpressions().add(isNull);
        Variable variable = new Variable(isNull);
        variable.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        isNull.getExpressions().add(variable);
        SetOutcomeValue incorrectOutcomeValue = new SetOutcomeValue(responseIf);
        incorrectOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseIf.getResponseRules().add(incorrectOutcomeValue);
        BaseValue incorrectValue = new BaseValue(incorrectOutcomeValue);
        incorrectValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        incorrectValue.setSingleValue(QTI21Constants.EMPTY_IDENTIFIER_VALUE);
        incorrectOutcomeValue.setExpression(incorrectValue);
    }
    ResponseElseIf responseElseIf = new ResponseElseIf(rule);
    rule.getResponseElseIfs().add(responseElseIf);
    {
        // match the correct answers -> 100%
        Match match = new Match(responseElseIf);
        responseElseIf.getExpressions().add(match);
        Variable scoreVar = new Variable(match);
        ComplexReferenceIdentifier choiceResponseIdentifier = ComplexReferenceIdentifier.parseString(matchInteraction.getResponseIdentifier().toString());
        scoreVar.setIdentifier(choiceResponseIdentifier);
        match.getExpressions().add(scoreVar);
        Correct correct = new Correct(match);
        correct.setIdentifier(choiceResponseIdentifier);
        match.getExpressions().add(correct);
    }
    {
        // outcome score
        SetOutcomeValue scoreOutcomeValue = new SetOutcomeValue(responseIf);
        scoreOutcomeValue.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        responseElseIf.getResponseRules().add(scoreOutcomeValue);
        Sum sum = new Sum(scoreOutcomeValue);
        scoreOutcomeValue.getExpressions().add(sum);
        Variable scoreVar = new Variable(sum);
        scoreVar.setIdentifier(QTI21Constants.SCORE_CLX_IDENTIFIER);
        sum.getExpressions().add(scoreVar);
        Variable maxScoreVar = new Variable(sum);
        maxScoreVar.setIdentifier(QTI21Constants.MAXSCORE_CLX_IDENTIFIER);
        sum.getExpressions().add(maxScoreVar);
    }
    {
        // set outcome
        SetOutcomeValue correctOutcomeValue = new SetOutcomeValue(responseIf);
        correctOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseElseIf.getResponseRules().add(correctOutcomeValue);
        BaseValue correctValue = new BaseValue(correctOutcomeValue);
        correctValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        correctValue.setSingleValue(QTI21Constants.CORRECT_IDENTIFIER_VALUE);
        correctOutcomeValue.setExpression(correctValue);
    }
    ResponseElse responseElse = new ResponseElse(rule);
    rule.setResponseElse(responseElse);
    /* Not perfect ->
		 	<setOutcomeValue identifier="SCORE">
          		<sum>
            		<mapResponse identifier="KPRIM_RESPONSE_1"/>
          		</sum>
        	</setOutcomeValue>
		*/
    {
        // outcome feedback
        SetOutcomeValue halfScoreOutcomeValue = new SetOutcomeValue(responseIf);
        halfScoreOutcomeValue.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        responseElse.getResponseRules().add(halfScoreOutcomeValue);
        Sum sum = new Sum(halfScoreOutcomeValue);
        halfScoreOutcomeValue.setExpression(sum);
        MapResponse mapResponse = new MapResponse(sum);
        mapResponse.setIdentifier(responseIdentifier);
        sum.getExpressions().add(mapResponse);
        SetOutcomeValue incorrectOutcomeValue = new SetOutcomeValue(responseIf);
        incorrectOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseElse.getResponseRules().add(incorrectOutcomeValue);
        BaseValue incorrectValue = new BaseValue(incorrectOutcomeValue);
        incorrectValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        incorrectValue.setSingleValue(QTI21Constants.INCORRECT_IDENTIFIER_VALUE);
        incorrectOutcomeValue.setExpression(incorrectValue);
    }
}
Also used : ComplexReferenceIdentifier(uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier) MapResponse(uk.ac.ed.ph.jqtiplus.node.expression.general.MapResponse) Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) ResponseElse(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElse) ResponseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf) IsNull(uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull) Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) ResponseElseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf) Correct(uk.ac.ed.ph.jqtiplus.node.expression.general.Correct) Match(uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)

Example 2 with ResponseElseIf

use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf in project OpenOLAT by OpenOLAT.

the class LobAssessmentItemBuilder method buildMainEssayFeedbackRule.

private void buildMainEssayFeedbackRule(ResponseCondition rule) {
    /*
		 <responseCondition>
			<responseIf>
				<isNull>
					<variable identifier="RESPONSE_1" />
				</isNull>
				<setOutcomeValue identifier="FEEDBACKBASIC">
					<baseValue baseType="identifier">
						empty
					</baseValue>
				</setOutcomeValue>
			</responseIf>
		</responseCondition>
		 */
    ResponseIf responseIf = new ResponseIf(rule);
    rule.setResponseIf(responseIf);
    {
        IsNull isNull = new IsNull(responseIf);
        responseIf.getExpressions().add(isNull);
        Variable variable = new Variable(isNull);
        variable.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        isNull.getExpressions().add(variable);
        SetOutcomeValue feedbackOutcomeValue = new SetOutcomeValue(responseIf);
        feedbackOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseIf.getResponseRules().add(feedbackOutcomeValue);
        BaseValue incorrectValue = new BaseValue(feedbackOutcomeValue);
        incorrectValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        incorrectValue.setSingleValue(QTI21Constants.EMPTY_IDENTIFIER_VALUE);
        feedbackOutcomeValue.setExpression(incorrectValue);
    }
    ResponseElseIf responseElseIf = new ResponseElseIf(rule);
    rule.getResponseElseIfs().add(responseElseIf);
    {
        Not not = new Not(responseElseIf);
        responseElseIf.getExpressions().add(not);
        IsNull isNull = new IsNull(responseIf);
        not.getExpressions().add(isNull);
        Variable variable = new Variable(isNull);
        variable.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        isNull.getExpressions().add(variable);
        SetOutcomeValue feedbackOutcomeValue = new SetOutcomeValue(responseIf);
        feedbackOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseElseIf.getResponseRules().add(feedbackOutcomeValue);
        BaseValue answeredValue = new BaseValue(feedbackOutcomeValue);
        answeredValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        answeredValue.setSingleValue(QTI21Constants.ANSWERED_IDENTIFIER_VALUE);
        feedbackOutcomeValue.setExpression(answeredValue);
    }
}
Also used : Not(uk.ac.ed.ph.jqtiplus.node.expression.operator.Not) Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) ResponseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf) IsNull(uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull) ResponseElseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf)

Example 3 with ResponseElseIf

use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf in project openolat by klemens.

the class KPrimAssessmentItemBuilder method buildMainKPrimScoreRule.

/**
 * The score is 100% if 4 correct responses, 50% if 3 correct
 * responses and 0 otherwise.
 *
 * @param rule
 */
private void buildMainKPrimScoreRule(ResponseCondition rule) {
    /*
	<responseCondition>
		<responseIf>
			<isNull>
				<variable identifier="RESPONSE"/>
			</isNull>
			<setOutcomeValue identifier="SCORE">
				<baseValue baseType="float">0.0</baseValue>
			</setOutcomeValue>
		</responseIf>
		<responseElse>
			<setOutcomeValue identifier="SCORE">
				<mapResponse identifier="RESPONSE"/>
			</setOutcomeValue>
		</responseElse>
	</responseCondition>
		 */
    ResponseIf responseIf = new ResponseIf(rule);
    rule.setResponseIf(responseIf);
    {
        // if no response
        IsNull isNull = new IsNull(responseIf);
        responseIf.getExpressions().add(isNull);
        Variable variable = new Variable(isNull);
        variable.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        isNull.getExpressions().add(variable);
        SetOutcomeValue incorrectOutcomeValue = new SetOutcomeValue(responseIf);
        incorrectOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseIf.getResponseRules().add(incorrectOutcomeValue);
        BaseValue incorrectValue = new BaseValue(incorrectOutcomeValue);
        incorrectValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        incorrectValue.setSingleValue(QTI21Constants.EMPTY_IDENTIFIER_VALUE);
        incorrectOutcomeValue.setExpression(incorrectValue);
    }
    ResponseElseIf responseElseIf = new ResponseElseIf(rule);
    rule.getResponseElseIfs().add(responseElseIf);
    {
        // match the correct answers -> 100%
        Match match = new Match(responseElseIf);
        responseElseIf.getExpressions().add(match);
        Variable scoreVar = new Variable(match);
        ComplexReferenceIdentifier choiceResponseIdentifier = ComplexReferenceIdentifier.parseString(matchInteraction.getResponseIdentifier().toString());
        scoreVar.setIdentifier(choiceResponseIdentifier);
        match.getExpressions().add(scoreVar);
        Correct correct = new Correct(match);
        correct.setIdentifier(choiceResponseIdentifier);
        match.getExpressions().add(correct);
    }
    {
        // outcome score
        SetOutcomeValue scoreOutcomeValue = new SetOutcomeValue(responseIf);
        scoreOutcomeValue.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        responseElseIf.getResponseRules().add(scoreOutcomeValue);
        Sum sum = new Sum(scoreOutcomeValue);
        scoreOutcomeValue.getExpressions().add(sum);
        Variable scoreVar = new Variable(sum);
        scoreVar.setIdentifier(QTI21Constants.SCORE_CLX_IDENTIFIER);
        sum.getExpressions().add(scoreVar);
        Variable maxScoreVar = new Variable(sum);
        maxScoreVar.setIdentifier(QTI21Constants.MAXSCORE_CLX_IDENTIFIER);
        sum.getExpressions().add(maxScoreVar);
    }
    {
        // set outcome
        SetOutcomeValue correctOutcomeValue = new SetOutcomeValue(responseIf);
        correctOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseElseIf.getResponseRules().add(correctOutcomeValue);
        BaseValue correctValue = new BaseValue(correctOutcomeValue);
        correctValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        correctValue.setSingleValue(QTI21Constants.CORRECT_IDENTIFIER_VALUE);
        correctOutcomeValue.setExpression(correctValue);
    }
    ResponseElse responseElse = new ResponseElse(rule);
    rule.setResponseElse(responseElse);
    /* Not perfect ->
		 	<setOutcomeValue identifier="SCORE">
          		<sum>
            		<mapResponse identifier="KPRIM_RESPONSE_1"/>
          		</sum>
        	</setOutcomeValue>
		*/
    {
        // outcome feedback
        SetOutcomeValue halfScoreOutcomeValue = new SetOutcomeValue(responseIf);
        halfScoreOutcomeValue.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        responseElse.getResponseRules().add(halfScoreOutcomeValue);
        Sum sum = new Sum(halfScoreOutcomeValue);
        halfScoreOutcomeValue.setExpression(sum);
        MapResponse mapResponse = new MapResponse(sum);
        mapResponse.setIdentifier(responseIdentifier);
        sum.getExpressions().add(mapResponse);
        SetOutcomeValue incorrectOutcomeValue = new SetOutcomeValue(responseIf);
        incorrectOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseElse.getResponseRules().add(incorrectOutcomeValue);
        BaseValue incorrectValue = new BaseValue(incorrectOutcomeValue);
        incorrectValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        incorrectValue.setSingleValue(QTI21Constants.INCORRECT_IDENTIFIER_VALUE);
        incorrectOutcomeValue.setExpression(incorrectValue);
    }
}
Also used : ComplexReferenceIdentifier(uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier) MapResponse(uk.ac.ed.ph.jqtiplus.node.expression.general.MapResponse) Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) ResponseElse(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElse) ResponseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf) IsNull(uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull) Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) ResponseElseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf) Correct(uk.ac.ed.ph.jqtiplus.node.expression.general.Correct) Match(uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)

Example 4 with ResponseElseIf

use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf in project openolat by klemens.

the class LobAssessmentItemBuilder method buildMainEssayFeedbackRule.

private void buildMainEssayFeedbackRule(ResponseCondition rule) {
    /*
		 <responseCondition>
			<responseIf>
				<isNull>
					<variable identifier="RESPONSE_1" />
				</isNull>
				<setOutcomeValue identifier="FEEDBACKBASIC">
					<baseValue baseType="identifier">
						empty
					</baseValue>
				</setOutcomeValue>
			</responseIf>
		</responseCondition>
		 */
    ResponseIf responseIf = new ResponseIf(rule);
    rule.setResponseIf(responseIf);
    {
        IsNull isNull = new IsNull(responseIf);
        responseIf.getExpressions().add(isNull);
        Variable variable = new Variable(isNull);
        variable.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        isNull.getExpressions().add(variable);
        SetOutcomeValue feedbackOutcomeValue = new SetOutcomeValue(responseIf);
        feedbackOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseIf.getResponseRules().add(feedbackOutcomeValue);
        BaseValue incorrectValue = new BaseValue(feedbackOutcomeValue);
        incorrectValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        incorrectValue.setSingleValue(QTI21Constants.EMPTY_IDENTIFIER_VALUE);
        feedbackOutcomeValue.setExpression(incorrectValue);
    }
    ResponseElseIf responseElseIf = new ResponseElseIf(rule);
    rule.getResponseElseIfs().add(responseElseIf);
    {
        Not not = new Not(responseElseIf);
        responseElseIf.getExpressions().add(not);
        IsNull isNull = new IsNull(responseIf);
        not.getExpressions().add(isNull);
        Variable variable = new Variable(isNull);
        variable.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        isNull.getExpressions().add(variable);
        SetOutcomeValue feedbackOutcomeValue = new SetOutcomeValue(responseIf);
        feedbackOutcomeValue.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        responseElseIf.getResponseRules().add(feedbackOutcomeValue);
        BaseValue answeredValue = new BaseValue(feedbackOutcomeValue);
        answeredValue.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        answeredValue.setSingleValue(QTI21Constants.ANSWERED_IDENTIFIER_VALUE);
        feedbackOutcomeValue.setExpression(answeredValue);
    }
}
Also used : Not(uk.ac.ed.ph.jqtiplus.node.expression.operator.Not) Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) ResponseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf) IsNull(uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull) ResponseElseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf)

Example 5 with ResponseElseIf

use of uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf in project openolat by klemens.

the class SingleChoiceAssessmentItemBuilder method buildMainScoreRuleAllCorrectAnswers.

private void buildMainScoreRuleAllCorrectAnswers(ResponseCondition rule) {
    ensureFeedbackBasicOutcomeDeclaration();
    /*
			<responseIf>
				<isNull>
					<variable identifier="RESPONSE_1" />
				</isNull>
				<setOutcomeValue identifier="FEEDBACKBASIC">
					<baseValue baseType="identifier">
						empty
					</baseValue>
				</setOutcomeValue>
			</responseIf>
		*/
    // if no response
    ResponseIf responseIf = new ResponseIf(rule);
    rule.setResponseIf(responseIf);
    IsNull isNull = new IsNull(responseIf);
    responseIf.getExpressions().add(isNull);
    Variable variable = new Variable(isNull);
    variable.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
    isNull.getExpressions().add(variable);
    {
        SetOutcomeValue feedbackVar = new SetOutcomeValue(responseIf);
        feedbackVar.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        BaseValue feedbackVal = new BaseValue(feedbackVar);
        feedbackVal.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        feedbackVal.setSingleValue(new IdentifierValue("empty"));
        feedbackVar.setExpression(feedbackVal);
        responseIf.getResponseRules().add(feedbackVar);
    }
    /*
			<responseElseIf>
				<match>
					<variable identifier="RESPONSE_1" />
					<correct identifier="RESPONSE_1" />
				</match>
				<setOutcomeValue identifier="SCORE">
					<sum>
						<variable identifier="SCORE" />
						<variable identifier="MAXSCORE" />
					</sum>
				</setOutcomeValue>
				<setOutcomeValue identifier="FEEDBACKBASIC">
					<baseValue baseType="identifier">
						correct
					</baseValue>
				</setOutcomeValue>
			</responseElseIf>
		*/
    // else if correct response
    ResponseElseIf responseElseIf = new ResponseElseIf(rule);
    rule.getResponseElseIfs().add(responseElseIf);
    // match
    {
        Match match = new Match(responseElseIf);
        responseElseIf.getExpressions().add(match);
        Variable responseVar = new Variable(match);
        responseVar.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        match.getExpressions().add(responseVar);
        Correct correct = new Correct(match);
        correct.setIdentifier(ComplexReferenceIdentifier.parseString(responseIdentifier.toString()));
        match.getExpressions().add(correct);
    }
    // outcome score
    {
        SetOutcomeValue scoreOutcomeVar = new SetOutcomeValue(responseIf);
        scoreOutcomeVar.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        responseElseIf.getResponseRules().add(scoreOutcomeVar);
        Sum sum = new Sum(scoreOutcomeVar);
        scoreOutcomeVar.getExpressions().add(sum);
        Variable scoreVar = new Variable(sum);
        scoreVar.setIdentifier(QTI21Constants.SCORE_CLX_IDENTIFIER);
        sum.getExpressions().add(scoreVar);
        Variable maxScoreVar = new Variable(sum);
        maxScoreVar.setIdentifier(QTI21Constants.MAXSCORE_CLX_IDENTIFIER);
        sum.getExpressions().add(maxScoreVar);
    }
    // outcome feedback
    {
        SetOutcomeValue correctFeedbackVar = new SetOutcomeValue(responseIf);
        correctFeedbackVar.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        BaseValue correctFeedbackVal = new BaseValue(correctFeedbackVar);
        correctFeedbackVal.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        correctFeedbackVal.setSingleValue(QTI21Constants.CORRECT_IDENTIFIER_VALUE);
        correctFeedbackVar.setExpression(correctFeedbackVal);
        responseElseIf.getResponseRules().add(correctFeedbackVar);
    }
    /*
			<responseElse>
				<setOutcomeValue identifier="FEEDBACKBASIC">
					<baseValue baseType="identifier">
						incorrect
					</baseValue>
				</setOutcomeValue>
			</responseElse>
		</responseCondition>
		*/
    ResponseElse responseElse = new ResponseElse(rule);
    rule.setResponseElse(responseElse);
    {
        // feedback incorrect
        SetOutcomeValue incorrectFeedbackVar = new SetOutcomeValue(responseIf);
        incorrectFeedbackVar.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
        BaseValue incorrectFeedbackVal = new BaseValue(incorrectFeedbackVar);
        incorrectFeedbackVal.setBaseTypeAttrValue(BaseType.IDENTIFIER);
        incorrectFeedbackVal.setSingleValue(QTI21Constants.INCORRECT_IDENTIFIER_VALUE);
        incorrectFeedbackVar.setExpression(incorrectFeedbackVal);
        responseElse.getResponseRules().add(incorrectFeedbackVar);
    }
}
Also used : Variable(uk.ac.ed.ph.jqtiplus.node.expression.general.Variable) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) ResponseElse(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElse) ResponseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf) IsNull(uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull) IdentifierValue(uk.ac.ed.ph.jqtiplus.value.IdentifierValue) Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) ResponseElseIf(uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf) Correct(uk.ac.ed.ph.jqtiplus.node.expression.general.Correct) Match(uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)

Aggregations

BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)10 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)10 IsNull (uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull)10 ResponseElseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf)10 ResponseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf)10 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue)10 Correct (uk.ac.ed.ph.jqtiplus.node.expression.general.Correct)8 Match (uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)8 Sum (uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum)8 ResponseElse (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElse)8 ComplexReferenceIdentifier (uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier)4 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)4 MapResponse (uk.ac.ed.ph.jqtiplus.node.expression.general.MapResponse)2 Not (uk.ac.ed.ph.jqtiplus.node.expression.operator.Not)2 ResponseCondition (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)2 ResponseProcessing (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing)2