Search in sources :

Example 16 with DefaultValue

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

Example 17 with DefaultValue

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;
}
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 18 with DefaultValue

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);
            }
        }
    }
}
Also used : DefaultValue(uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) DefaultValue(uk.ac.ed.ph.jqtiplus.node.shared.declaration.DefaultValue) IdentifierValue(uk.ac.ed.ph.jqtiplus.value.IdentifierValue) FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue) Value(uk.ac.ed.ph.jqtiplus.value.Value) FloatValue(uk.ac.ed.ph.jqtiplus.value.FloatValue) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Example 19 with DefaultValue

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;
}
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 20 with DefaultValue

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;
}
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)

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