Search in sources :

Example 11 with DefaultValue

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;
}
Also used : DefaultValue(uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue) FieldValue(uk.ac.ed.ph.jqtiplus.node.shared.FieldValue) FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Example 12 with DefaultValue

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;
}
Also used : DefaultValue(uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue) FieldValue(uk.ac.ed.ph.jqtiplus.node.shared.FieldValue) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Example 13 with DefaultValue

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;
}
Also used : DefaultValue(uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue) FieldValue(uk.ac.ed.ph.jqtiplus.node.shared.FieldValue) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Example 14 with DefaultValue

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;
}
Also used : DefaultValue(uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue) FieldValue(uk.ac.ed.ph.jqtiplus.node.shared.FieldValue) FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Example 15 with DefaultValue

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);
}
Also used : DefaultValue(uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue) FieldValue(uk.ac.ed.ph.jqtiplus.node.shared.FieldValue) FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue)

Aggregations

DefaultValue (uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue)20 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)18 FieldValue (uk.ac.ed.ph.jqtiplus.node.shared.FieldValue)16 FloatValue (uk.ac.ed.ph.jqtiplus.value.FloatValue)12 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)6 ArrayList (java.util.ArrayList)4 BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)4 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue)4 View (uk.ac.ed.ph.jqtiplus.node.test.View)4 Value (uk.ac.ed.ph.jqtiplus.value.Value)4 BooleanValue (uk.ac.ed.ph.jqtiplus.value.BooleanValue)2