use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project openolat by klemens.
the class AssessmentItemFactory method appendMatchInteractionTrueFalse.
public static MatchInteraction appendMatchInteractionTrueFalse(ItemBody itemBody, String unanswered, String right, String wrong, Identifier responseDeclarationId) {
MatchInteraction matchInteraction = new MatchInteraction(itemBody);
matchInteraction.setResponseIdentifier(responseDeclarationId);
matchInteraction.setMaxAssociations(4);
matchInteraction.setShuffle(false);
itemBody.getBlocks().add(matchInteraction);
PromptGroup prompts = new PromptGroup(matchInteraction);
matchInteraction.getNodeGroups().add(prompts);
SimpleMatchSet sourceMatchSet = new SimpleMatchSet(matchInteraction);
matchInteraction.getSimpleMatchSets().add(sourceMatchSet);
String[] sources = new String[] { "A", "B" };
for (int i = 0; i < sources.length; i++) {
appendSimpleAssociableChoice(sourceMatchSet, sources[i], 1, 1);
}
SimpleMatchSet targetMatchSet = new SimpleMatchSet(matchInteraction);
matchInteraction.getSimpleMatchSets().add(targetMatchSet);
String[] targets = new String[] { unanswered, right, wrong };
for (int i = 0; i < targets.length; i++) {
appendSimpleAssociableChoice(targetMatchSet, targets[i], 0, 0);
}
return matchInteraction;
}
use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project openolat by klemens.
the class AssessmentItemFactory method createSingleChoiceInteraction.
public static ChoiceInteraction createSingleChoiceInteraction(AssessmentItem assessmentItem, Identifier responseDeclarationId, Orientation orientation, List<String> classAtrr) {
ChoiceInteraction choiceInteraction = new ChoiceInteraction(assessmentItem.getItemBody());
choiceInteraction.setMaxChoices(1);
choiceInteraction.setShuffle(true);
if (orientation != null) {
choiceInteraction.setOrientation(orientation);
}
choiceInteraction.setResponseIdentifier(responseDeclarationId);
if (classAtrr != null && classAtrr.size() > 0) {
choiceInteraction.setClassAttr(classAtrr);
}
PromptGroup prompts = new PromptGroup(choiceInteraction);
choiceInteraction.getNodeGroups().add(prompts);
SimpleChoiceGroup singleChoices = new SimpleChoiceGroup(choiceInteraction);
choiceInteraction.getNodeGroups().add(singleChoices);
return choiceInteraction;
}
use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendMatchInteractionTrueFalse.
public static MatchInteraction appendMatchInteractionTrueFalse(ItemBody itemBody, String unanswered, String right, String wrong, Identifier responseDeclarationId) {
MatchInteraction matchInteraction = new MatchInteraction(itemBody);
matchInteraction.setResponseIdentifier(responseDeclarationId);
matchInteraction.setMaxAssociations(4);
matchInteraction.setShuffle(false);
itemBody.getBlocks().add(matchInteraction);
PromptGroup prompts = new PromptGroup(matchInteraction);
matchInteraction.getNodeGroups().add(prompts);
SimpleMatchSet sourceMatchSet = new SimpleMatchSet(matchInteraction);
matchInteraction.getSimpleMatchSets().add(sourceMatchSet);
String[] sources = new String[] { "A", "B" };
for (int i = 0; i < sources.length; i++) {
appendSimpleAssociableChoice(sourceMatchSet, sources[i], 1, 1);
}
SimpleMatchSet targetMatchSet = new SimpleMatchSet(matchInteraction);
matchInteraction.getSimpleMatchSets().add(targetMatchSet);
String[] targets = new String[] { unanswered, right, wrong };
for (int i = 0; i < targets.length; i++) {
appendSimpleAssociableChoice(targetMatchSet, targets[i], 0, 0);
}
return matchInteraction;
}
use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method createMultipleChoiceInteraction.
public static ChoiceInteraction createMultipleChoiceInteraction(AssessmentItem assessmentItem, Identifier responseDeclarationId, Orientation orientation, List<String> classAtrr) {
ChoiceInteraction choiceInteraction = new ChoiceInteraction(assessmentItem.getItemBody());
choiceInteraction.setMaxChoices(0);
choiceInteraction.setShuffle(true);
if (orientation != null) {
choiceInteraction.setOrientation(orientation);
}
if (classAtrr != null && classAtrr.size() > 0) {
choiceInteraction.setClassAttr(classAtrr);
}
choiceInteraction.setResponseIdentifier(responseDeclarationId);
PromptGroup prompts = new PromptGroup(choiceInteraction);
choiceInteraction.getNodeGroups().add(prompts);
SimpleChoiceGroup singleChoices = new SimpleChoiceGroup(choiceInteraction);
choiceInteraction.getNodeGroups().add(singleChoices);
return choiceInteraction;
}
use of uk.ac.ed.ph.jqtiplus.group.item.interaction.PromptGroup in project OpenOLAT by OpenOLAT.
the class AssessmentItemFactory method appendMatchInteractionForKPrim.
public static MatchInteraction appendMatchInteractionForKPrim(ItemBody itemBody, Identifier responseDeclarationId, String defaultAnswer) {
MatchInteraction matchInteraction = new MatchInteraction(itemBody);
matchInteraction.setResponseIdentifier(responseDeclarationId);
matchInteraction.setMaxAssociations(4);
matchInteraction.setShuffle(false);
itemBody.getBlocks().add(matchInteraction);
PromptGroup prompts = new PromptGroup(matchInteraction);
matchInteraction.getNodeGroups().add(prompts);
SimpleMatchSet questionMatchSet = new SimpleMatchSet(matchInteraction);
matchInteraction.getSimpleMatchSets().add(questionMatchSet);
String[] classic = new String[] { "a", "b", "c", "d" };
for (int i = 0; i < 4; i++) {
SimpleAssociableChoice correctChoice = new SimpleAssociableChoice(questionMatchSet);
correctChoice.setMatchMax(1);
correctChoice.setMatchMin(1);
correctChoice.setIdentifier(IdentifierGenerator.newNumberAsIdentifier(classic[i]));
P question = getParagraph(correctChoice, defaultAnswer + " " + classic[i]);
correctChoice.getFlowStatics().add(question);
questionMatchSet.getSimpleAssociableChoices().add(correctChoice);
}
SimpleMatchSet correctWrongMatchSet = new SimpleMatchSet(matchInteraction);
matchInteraction.getSimpleMatchSets().add(correctWrongMatchSet);
SimpleAssociableChoice correctChoice = new SimpleAssociableChoice(correctWrongMatchSet);
correctChoice.setMatchMax(4);
correctChoice.setFixed(Boolean.TRUE);
correctChoice.setIdentifier(QTI21Constants.CORRECT_IDENTIFIER);
correctChoice.getFlowStatics().add(new TextRun(correctChoice, "+"));
correctWrongMatchSet.getSimpleAssociableChoices().add(correctChoice);
SimpleAssociableChoice wrongChoice = new SimpleAssociableChoice(correctWrongMatchSet);
wrongChoice.setMatchMax(4);
wrongChoice.setFixed(Boolean.TRUE);
wrongChoice.setIdentifier(QTI21Constants.WRONG_IDENTIFIER);
wrongChoice.getFlowStatics().add(new TextRun(correctChoice, "-"));
correctWrongMatchSet.getSimpleAssociableChoices().add(wrongChoice);
return matchInteraction;
}
Aggregations