Search in sources :

Example 1 with TestVariables

use of uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables in project OpenOLAT by OpenOLAT.

the class AssessmentTestFactory method appendSumOfTestVariables.

/*
	<sum>
		<testVariables variableIdentifier="SCORE" />
	</sum>
	 */
public static Sum appendSumOfTestVariables(ExpressionParent parent) {
    Sum sum = new Sum(parent);
    parent.getExpressions().add(sum);
    TestVariables testVariables = new TestVariables(sum);
    sum.getExpressions().add(testVariables);
    testVariables.setVariableIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    return sum;
}
Also used : Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) TestVariables(uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables)

Example 2 with TestVariables

use of uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables in project OpenOLAT by OpenOLAT.

the class AssessmentTestFactory method createAssessmentTest.

/**
 * Create an assessmentTest object but without items
 *
 * @param title
 * @return
 */
public static AssessmentTest createAssessmentTest(String title, String sectionTitle) {
    AssessmentTest assessmentTest = new AssessmentTest();
    assessmentTest.setIdentifier(IdentifierGenerator.newAsString("test"));
    assessmentTest.setTitle(title);
    assessmentTest.setToolName(QTI21Constants.TOOLNAME);
    assessmentTest.setToolVersion(Settings.getVersion());
    // outcome score
    OutcomeDeclaration scoreOutcomeDeclaration = new OutcomeDeclaration(assessmentTest);
    scoreOutcomeDeclaration.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    scoreOutcomeDeclaration.setCardinality(Cardinality.SINGLE);
    scoreOutcomeDeclaration.setBaseType(BaseType.FLOAT);
    assessmentTest.getOutcomeDeclarations().add(scoreOutcomeDeclaration);
    // test part
    TestPart part = createTestPart(assessmentTest);
    appendAssessmentSection(sectionTitle, part);
    // outcome processing
    OutcomeProcessing outcomeProcessing = new OutcomeProcessing(assessmentTest);
    assessmentTest.setOutcomeProcessing(outcomeProcessing);
    SetOutcomeValue outcomeRule = new SetOutcomeValue(outcomeProcessing);
    outcomeRule.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    Sum sum = new Sum(outcomeRule);
    outcomeRule.getExpressions().add(sum);
    TestVariables testVariables = new TestVariables(sum);
    testVariables.setVariableIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    sum.getExpressions().add(testVariables);
    outcomeProcessing.getOutcomeRules().add(outcomeRule);
    return assessmentTest;
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeProcessing(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeProcessing) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) TestVariables(uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Example 3 with TestVariables

use of uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables in project openolat by klemens.

the class AssessmentTestBuilder method buildTestScore.

/* Overall score of this test
	<setOutcomeValue identifier="SCORE">
		<sum>
			<testVariables variableIdentifier="SCORE" />
		</sum>
	</setOutcomeValue>
	*/
private void buildTestScore() {
    if (testScoreRule == null) {
        SetOutcomeValue scoreRule = new SetOutcomeValue(assessmentTest);
        scoreRule.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        Sum sum = new Sum(scoreRule);
        scoreRule.getExpressions().add(sum);
        TestVariables testVariables = new TestVariables(sum);
        sum.getExpressions().add(testVariables);
        testVariables.setVariableIdentifier(QTI21Constants.SCORE_IDENTIFIER);
        assessmentTest.getOutcomeProcessing().getOutcomeRules().add(0, scoreRule);
        testScoreRule = scoreRule;
    }
    if (minScoreRule == null) {
        OutcomeCondition scoreRule = AssessmentTestFactory.createMinScoreRule(assessmentTest);
        assessmentTest.getOutcomeProcessing().getOutcomeRules().add(1, scoreRule);
        minScoreRule = scoreRule;
    }
}
Also used : SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeCondition(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition) Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) TestVariables(uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables)

Example 4 with TestVariables

use of uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables in project openolat by klemens.

the class AssessmentTestFactory method appendSumOfTestVariables.

/*
	<sum>
		<testVariables variableIdentifier="SCORE" />
	</sum>
	 */
public static Sum appendSumOfTestVariables(ExpressionParent parent) {
    Sum sum = new Sum(parent);
    parent.getExpressions().add(sum);
    TestVariables testVariables = new TestVariables(sum);
    sum.getExpressions().add(testVariables);
    testVariables.setVariableIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    return sum;
}
Also used : Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) TestVariables(uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables)

Example 5 with TestVariables

use of uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables in project openolat by klemens.

the class AssessmentTestFactory method createAssessmentTest.

/**
 * Create an assessmentTest object but without items
 *
 * @param title
 * @return
 */
public static AssessmentTest createAssessmentTest(String title, String sectionTitle) {
    AssessmentTest assessmentTest = new AssessmentTest();
    assessmentTest.setIdentifier(IdentifierGenerator.newAsString("test"));
    assessmentTest.setTitle(title);
    assessmentTest.setToolName(QTI21Constants.TOOLNAME);
    assessmentTest.setToolVersion(Settings.getVersion());
    // outcome score
    OutcomeDeclaration scoreOutcomeDeclaration = new OutcomeDeclaration(assessmentTest);
    scoreOutcomeDeclaration.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    scoreOutcomeDeclaration.setCardinality(Cardinality.SINGLE);
    scoreOutcomeDeclaration.setBaseType(BaseType.FLOAT);
    assessmentTest.getOutcomeDeclarations().add(scoreOutcomeDeclaration);
    // test part
    TestPart part = createTestPart(assessmentTest);
    appendAssessmentSection(sectionTitle, part);
    // outcome processing
    OutcomeProcessing outcomeProcessing = new OutcomeProcessing(assessmentTest);
    assessmentTest.setOutcomeProcessing(outcomeProcessing);
    SetOutcomeValue outcomeRule = new SetOutcomeValue(outcomeProcessing);
    outcomeRule.setIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    Sum sum = new Sum(outcomeRule);
    outcomeRule.getExpressions().add(sum);
    TestVariables testVariables = new TestVariables(sum);
    testVariables.setVariableIdentifier(QTI21Constants.SCORE_IDENTIFIER);
    sum.getExpressions().add(testVariables);
    outcomeProcessing.getOutcomeRules().add(outcomeRule);
    return assessmentTest;
}
Also used : AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) SetOutcomeValue(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue) OutcomeProcessing(uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeProcessing) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) Sum(uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum) TestVariables(uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables) OutcomeDeclaration(uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)

Aggregations

Sum (uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum)6 TestVariables (uk.ac.ed.ph.jqtiplus.node.expression.outcome.TestVariables)6 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.SetOutcomeValue)4 OutcomeDeclaration (uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration)2 AssessmentTest (uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest)2 TestPart (uk.ac.ed.ph.jqtiplus.node.test.TestPart)2 OutcomeCondition (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeCondition)2 OutcomeProcessing (uk.ac.ed.ph.jqtiplus.node.test.outcome.processing.OutcomeProcessing)2