use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project OpenOLAT by OpenOLAT.
the class AssessmentTestFactory method createOutcomeDeclaration.
public static OutcomeDeclaration createOutcomeDeclaration(AssessmentTest assessmentTest, Identifier identifier, boolean defaultValue) {
OutcomeDeclaration outcomeDeclaration = new OutcomeDeclaration(assessmentTest);
outcomeDeclaration.setIdentifier(identifier);
outcomeDeclaration.setCardinality(Cardinality.SINGLE);
outcomeDeclaration.setBaseType(BaseType.BOOLEAN);
DefaultValue defaultVal = new DefaultValue(outcomeDeclaration);
outcomeDeclaration.setDefaultValue(defaultVal);
FieldValue fieldValue = new FieldValue(defaultVal);
BooleanValue booleanValue = defaultValue ? BooleanValue.TRUE : BooleanValue.FALSE;
fieldValue.setSingleValue(booleanValue);
defaultVal.getFieldValues().add(fieldValue);
return outcomeDeclaration;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project OpenOLAT by OpenOLAT.
the class AssessmentTestFactory method createOutcomeDeclaration.
public static OutcomeDeclaration createOutcomeDeclaration(AssessmentTest assessmentTest, Identifier identifier, Double defaultValue) {
OutcomeDeclaration outcomeDeclaration = new OutcomeDeclaration(assessmentTest);
outcomeDeclaration.setIdentifier(identifier);
outcomeDeclaration.setCardinality(Cardinality.SINGLE);
outcomeDeclaration.setBaseType(BaseType.FLOAT);
DefaultValue defaultVal = new DefaultValue(outcomeDeclaration);
outcomeDeclaration.setDefaultValue(defaultVal);
FieldValue fieldValue = new FieldValue(defaultVal);
FloatValue identifierValue = new FloatValue(defaultValue);
fieldValue.setSingleValue(identifierValue);
defaultVal.getFieldValues().add(fieldValue);
return outcomeDeclaration;
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project openolat by klemens.
the class AssessmentItemBuilder method extractMinScore.
private void extractMinScore() {
OutcomeDeclaration outcomeDeclaration = assessmentItem.getOutcomeDeclaration(MINSCORE_IDENTIFIER);
if (outcomeDeclaration != null) {
DefaultValue defaultValue = outcomeDeclaration.getDefaultValue();
if (defaultValue != null) {
Value minScoreValue = defaultValue.evaluate();
if (minScoreValue instanceof FloatValue) {
Double minScore = new Double(((FloatValue) minScoreValue).doubleValue());
minScoreBuilder = new ScoreBuilder(minScore, outcomeDeclaration);
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project openolat by klemens.
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 klemens.
the class AssessmentTestFactory method createOutcomeDeclaration.
public static OutcomeDeclaration createOutcomeDeclaration(AssessmentTest assessmentTest, Identifier identifier, Double defaultValue) {
OutcomeDeclaration outcomeDeclaration = new OutcomeDeclaration(assessmentTest);
outcomeDeclaration.setIdentifier(identifier);
outcomeDeclaration.setCardinality(Cardinality.SINGLE);
outcomeDeclaration.setBaseType(BaseType.FLOAT);
DefaultValue defaultVal = new DefaultValue(outcomeDeclaration);
outcomeDeclaration.setDefaultValue(defaultVal);
FieldValue fieldValue = new FieldValue(defaultVal);
FloatValue identifierValue = new FloatValue(defaultValue);
fieldValue.setSingleValue(identifierValue);
defaultVal.getFieldValues().add(fieldValue);
return outcomeDeclaration;
}
Aggregations