use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project openolat by klemens.
the class AssessmentItemFactory method createOutcomeDeclarationForMaxScore.
public static OutcomeDeclaration createOutcomeDeclarationForMaxScore(AssessmentItem assessmentItem, double maxScore) {
OutcomeDeclaration maxScoreOutcomeDeclaration = new OutcomeDeclaration(assessmentItem);
maxScoreOutcomeDeclaration.setIdentifier(QTI21Constants.MAXSCORE_IDENTIFIER);
maxScoreOutcomeDeclaration.setCardinality(Cardinality.SINGLE);
maxScoreOutcomeDeclaration.setBaseType(BaseType.FLOAT);
DefaultValue maxScoreDefaultVal = new DefaultValue(maxScoreOutcomeDeclaration);
maxScoreOutcomeDeclaration.setDefaultValue(maxScoreDefaultVal);
FieldValue maxScoreDefaultFieldVal = new FieldValue(maxScoreDefaultVal, new FloatValue(maxScore));
maxScoreDefaultVal.getFieldValues().add(maxScoreDefaultFieldVal);
return maxScoreOutcomeDeclaration;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project openolat by klemens.
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;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createOutcomeDeclarationForScoreResponse.
/*
<outcomeDeclaration identifier="SCORE_RESPONSE_2" cardinality="single" baseType="float" view="testConstructor">
<defaultValue>
<value>0</value>
</defaultValue>
</outcomeDeclaration>
*/
public static OutcomeDeclaration createOutcomeDeclarationForScoreResponse(AssessmentItem assessmentItem, String scoreIdentifier) {
OutcomeDeclaration scoreOutcomeDeclaration = new OutcomeDeclaration(assessmentItem);
scoreOutcomeDeclaration.setIdentifier(Identifier.parseString(scoreIdentifier));
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;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createOutcomeDeclarationForMaxScore.
public static OutcomeDeclaration createOutcomeDeclarationForMaxScore(AssessmentItem assessmentItem, double maxScore) {
OutcomeDeclaration maxScoreOutcomeDeclaration = new OutcomeDeclaration(assessmentItem);
maxScoreOutcomeDeclaration.setIdentifier(QTI21Constants.MAXSCORE_IDENTIFIER);
maxScoreOutcomeDeclaration.setCardinality(Cardinality.SINGLE);
maxScoreOutcomeDeclaration.setBaseType(BaseType.FLOAT);
DefaultValue maxScoreDefaultVal = new DefaultValue(maxScoreOutcomeDeclaration);
maxScoreOutcomeDeclaration.setDefaultValue(maxScoreDefaultVal);
FieldValue maxScoreDefaultFieldVal = new FieldValue(maxScoreDefaultVal, new FloatValue(maxScore));
maxScoreDefaultVal.getFieldValues().add(maxScoreDefaultFieldVal);
return maxScoreOutcomeDeclaration;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project OpenOLAT by OpenOLAT.
the class AssessmentTestFactory method updateDefaultValue.
public static void updateDefaultValue(OutcomeDeclaration outcomeDeclaration, Double defaultValue) {
outcomeDeclaration.setBaseType(BaseType.FLOAT);
DefaultValue defaultVal = outcomeDeclaration.getDefaultValue();
defaultVal.getFieldValues().clear();
FieldValue fieldValue = new FieldValue(defaultVal);
FloatValue identifierValue = new FloatValue(defaultValue);
fieldValue.setSingleValue(identifierValue);
defaultVal.getFieldValues().add(fieldValue);
}
Aggregations