use of uk.ac.ed.ph.jqtiplus.node.shared.BaseTypeAndCardinality in project OpenOLAT by OpenOLAT.
the class QtiNodesExtractor method extractIdentifiersFromCorrectResponse.
public static void extractIdentifiersFromCorrectResponse(CorrectResponse correctResponse, List<Identifier> correctAnswers) {
BaseTypeAndCardinality responseDeclaration = correctResponse.getParent();
if (responseDeclaration.hasCardinality(Cardinality.MULTIPLE)) {
Value value = FieldValue.computeValue(Cardinality.MULTIPLE, correctResponse.getFieldValues());
if (value instanceof MultipleValue) {
MultipleValue multiValue = (MultipleValue) value;
for (SingleValue sValue : multiValue.getAll()) {
if (sValue instanceof IdentifierValue) {
IdentifierValue identifierValue = (IdentifierValue) sValue;
Identifier correctAnswer = identifierValue.identifierValue();
correctAnswers.add(correctAnswer);
}
}
}
} else if (responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
Value value = FieldValue.computeValue(Cardinality.SINGLE, correctResponse.getFieldValues());
if (value instanceof IdentifierValue) {
IdentifierValue identifierValue = (IdentifierValue) value;
correctAnswers.add(identifierValue.identifierValue());
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.shared.BaseTypeAndCardinality in project openolat by klemens.
the class QtiNodesExtractor method extractIdentifiersFromCorrectResponse.
public static void extractIdentifiersFromCorrectResponse(CorrectResponse correctResponse, List<Identifier> correctAnswers) {
BaseTypeAndCardinality responseDeclaration = correctResponse.getParent();
if (responseDeclaration.hasCardinality(Cardinality.MULTIPLE)) {
Value value = FieldValue.computeValue(Cardinality.MULTIPLE, correctResponse.getFieldValues());
if (value instanceof MultipleValue) {
MultipleValue multiValue = (MultipleValue) value;
for (SingleValue sValue : multiValue.getAll()) {
if (sValue instanceof IdentifierValue) {
IdentifierValue identifierValue = (IdentifierValue) sValue;
Identifier correctAnswer = identifierValue.identifierValue();
correctAnswers.add(correctAnswer);
}
}
}
} else if (responseDeclaration.hasCardinality(Cardinality.SINGLE)) {
Value value = FieldValue.computeValue(Cardinality.SINGLE, correctResponse.getFieldValues());
if (value instanceof IdentifierValue) {
IdentifierValue identifierValue = (IdentifierValue) value;
correctAnswers.add(identifierValue.identifierValue());
}
}
}
Aggregations