use of uk.ac.ed.ph.jqtiplus.node.shared.FieldValue in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendAssociationMatchResponseDeclaration.
public static ResponseDeclaration appendAssociationMatchResponseDeclaration(ResponseDeclaration responseDeclaration, Map<Identifier, List<Identifier>> associations) {
responseDeclaration.setCardinality(Cardinality.MULTIPLE);
responseDeclaration.setBaseType(BaseType.DIRECTED_PAIR);
// correct response
CorrectResponse correctResponse = new CorrectResponse(responseDeclaration);
responseDeclaration.setCorrectResponse(correctResponse);
for (Map.Entry<Identifier, List<Identifier>> association : associations.entrySet()) {
Identifier sourceChoiceId = association.getKey();
List<Identifier> targetChoiceIds = association.getValue();
for (Identifier targetChoiceId : targetChoiceIds) {
DirectedPairValue dpValue = new DirectedPairValue(sourceChoiceId, targetChoiceId);
FieldValue fValue = new FieldValue(correctResponse, dpValue);
correctResponse.getFieldValues().add(fValue);
}
}
return responseDeclaration;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.FieldValue in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createOutcomeDeclarationForFeedbackBasic.
public static OutcomeDeclaration createOutcomeDeclarationForFeedbackBasic(AssessmentItem assessmentItem) {
OutcomeDeclaration feedbackOutcomeDeclaration = new OutcomeDeclaration(assessmentItem);
feedbackOutcomeDeclaration.setIdentifier(QTI21Constants.FEEDBACKBASIC_IDENTIFIER);
feedbackOutcomeDeclaration.setCardinality(Cardinality.SINGLE);
feedbackOutcomeDeclaration.setBaseType(BaseType.IDENTIFIER);
DefaultValue feedbackDefaultVal = new DefaultValue(feedbackOutcomeDeclaration);
feedbackOutcomeDeclaration.setDefaultValue(feedbackDefaultVal);
FieldValue feedbackDefaultFieldVal = new FieldValue(feedbackDefaultVal, new IdentifierValue("none"));
feedbackDefaultVal.getFieldValues().add(feedbackDefaultFieldVal);
List<View> views = new ArrayList<>();
views.add(View.TEST_CONSTRUCTOR);
feedbackOutcomeDeclaration.setViews(views);
return feedbackOutcomeDeclaration;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.FieldValue in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createOutcomeDeclarationForMinScore.
public static OutcomeDeclaration createOutcomeDeclarationForMinScore(AssessmentItem assessmentItem, double minScore) {
OutcomeDeclaration maxScoreOutcomeDeclaration = new OutcomeDeclaration(assessmentItem);
maxScoreOutcomeDeclaration.setIdentifier(QTI21Constants.MINSCORE_IDENTIFIER);
maxScoreOutcomeDeclaration.setCardinality(Cardinality.SINGLE);
maxScoreOutcomeDeclaration.setBaseType(BaseType.FLOAT);
List<View> views = new ArrayList<>();
views.add(View.TEST_CONSTRUCTOR);
maxScoreOutcomeDeclaration.setViews(views);
DefaultValue maxScoreDefaultVal = new DefaultValue(maxScoreOutcomeDeclaration);
maxScoreOutcomeDeclaration.setDefaultValue(maxScoreDefaultVal);
FieldValue maxScoreDefaultFieldVal = new FieldValue(maxScoreDefaultVal, new FloatValue(minScore));
maxScoreDefaultVal.getFieldValues().add(maxScoreDefaultFieldVal);
return maxScoreOutcomeDeclaration;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.FieldValue in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendStringValue.
private static void appendStringValue(CorrectResponse correctResponse, String response) {
FieldValue fieldValue = new FieldValue(correctResponse);
StringValue identifierValue = new StringValue(response);
fieldValue.setSingleValue(identifierValue);
correctResponse.getFieldValues().add(fieldValue);
}
use of uk.ac.ed.ph.jqtiplus.node.shared.FieldValue in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createOutcomeDeclarationForScore.
/**
* Create an outcome declaration with SCORE as identifier, single and float
* and 0 as default value.
*
* @param assessmentItem
* @return
*/
public static OutcomeDeclaration createOutcomeDeclarationForScore(AssessmentItem assessmentItem) {
OutcomeDeclaration scoreOutcomeDeclaration = new OutcomeDeclaration(assessmentItem);
scoreOutcomeDeclaration.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
scoreOutcomeDeclaration.setCardinality(Cardinality.SINGLE);
scoreOutcomeDeclaration.setBaseType(BaseType.FLOAT);
DefaultValue scoreDefaultVal = new DefaultValue(scoreOutcomeDeclaration);
scoreOutcomeDeclaration.setDefaultValue(scoreDefaultVal);
FieldValue scoreDefaultFieldVal = new FieldValue(scoreDefaultVal, FloatValue.ZERO);
scoreDefaultVal.getFieldValues().add(scoreDefaultFieldVal);
return scoreOutcomeDeclaration;
}
Aggregations