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, 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 klemens.
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);
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project openolat by klemens.
the class AssessmentItemBuilder method extractMaxScore.
private void extractMaxScore() {
OutcomeDeclaration outcomeDeclaration = assessmentItem.getOutcomeDeclaration(MAXSCORE_IDENTIFIER);
if (outcomeDeclaration != null) {
DefaultValue defaultValue = outcomeDeclaration.getDefaultValue();
if (defaultValue != null) {
Value maxScoreValue = defaultValue.evaluate();
if (maxScoreValue instanceof FloatValue) {
Double maxScore = new Double(((FloatValue) maxScoreValue).doubleValue());
maxScoreBuilder = new ScoreBuilder(maxScore, outcomeDeclaration);
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue in project openolat by klemens.
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.declaration.DefaultValue in project openolat by klemens.
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;
}
Aggregations