From 873890343dad017206cb1ae51cf85613d7e156d2 Mon Sep 17 00:00:00 2001 From: Zachary Pierce Date: Fri, 16 Aug 2013 18:00:10 -0700 Subject: [PATCH 1/5] Model representation and XML reading support for core apipAccessibility features --- .../ph/jqtiplus/attribute/AttributeList.java | 5 + .../attribute/value/IdentifierAttribute.java | 2 +- .../value/IdentifierReferenceAttribute.java | 77 +++ .../ed/ph/jqtiplus/group/NodeGroupList.java | 387 ++++++++++++++- .../accessibility/AccessElementGroup.java | 68 +++ .../accessibility/AccessibilityInfoGroup.java | 70 +++ .../accessibility/ApipAccessibilityGroup.java | 69 +++ .../companion/CalculatorInfoGroup.java | 71 +++ .../companion/CalculatorTypeGroup.java | 77 +++ .../companion/CompanionMaterialGroup.java | 61 +++ .../CompanionMaterialsInfoGroup.java | 69 +++ .../companion/DescriptionGroup.java | 90 ++++ .../companion/LinearRuleSystemGroup.java | 89 ++++ .../MajorIncrementLinearSIGroup.java | 63 +++ .../MajorIncrementLinearUSGroup.java | 63 +++ .../MajorIncrementRadialSIGroup.java | 63 +++ .../MajorIncrementRadialUSGroup.java | 63 +++ .../companion/MinimumLengthGroup.java | 74 +++ .../MinorIncrementLinearSIGroup.java | 63 +++ .../MinorIncrementLinearUSGroup.java | 63 +++ .../MinorIncrementRadialSIGroup.java | 63 +++ .../MinorIncrementRadialUSGroup.java | 63 +++ .../companion/RadialIncrementSystemGroup.java | 89 ++++ .../inclusion/ElementOrderGroup.java | 63 +++ .../inclusion/InclusionOrderGroup.java | 69 +++ .../StandardElementOrderListGroup.java | 132 +++++ .../link/ContentLinkInfoGroup.java | 63 +++ .../group/accessibility/link/LinkGroup.java | 100 ++++ .../accessibility/link/StringLinkGroup.java | 124 +++++ .../related/AnswerReductionGroup.java | 64 +++ .../related/AudioFileInfoGroup.java | 71 +++ .../related/BrailleTextGroup.java | 64 +++ .../accessibility/related/ChunkGroup.java | 72 +++ .../related/DefinitionIdGroup.java | 62 +++ .../accessibility/related/GuidanceGroup.java | 63 +++ .../related/GuidanceSupportGroup.java | 64 +++ .../related/KeyWordEmphasisGroup.java | 72 +++ .../related/KeyWordTranslationGroup.java | 63 +++ .../related/LabelledStringGroup.java | 64 +++ .../related/MarkupFileEmbeddedGroup.java | 64 +++ .../related/NormalizedStringElementGroup.java | 70 +++ .../related/ObjectFileInfoGroup.java | 64 +++ .../related/RelatedElementInfoGroup.java | 63 +++ .../related/RemoveTagGroupGroup.java | 65 +++ .../RevealAlternativeRepresentationGroup.java | 65 +++ .../related/ScaffoldBehaviorGroup.java | 64 +++ .../accessibility/related/ScaffoldGroup.java | 64 +++ .../accessibility/related/SignFileGroup.java | 64 +++ .../accessibility/related/SigningGroup.java | 66 +++ .../related/SingleIntegerElementGroup.java | 86 ++++ .../accessibility/related/SpokenGroup.java | 69 +++ .../related/StructuredMaskGroup.java | 64 +++ .../related/TactileFileGroup.java | 64 +++ .../related/VideoFileInfoGroup.java | 64 +++ .../node/accessibility/AccessElement.java | 88 ++++ .../node/accessibility/AccessibilityInfo.java | 62 +++ .../node/accessibility/ApipAccessibility.java | 91 ++++ .../node/accessibility/EmptyElement.java | 87 ++++ .../jqtiplus/node/accessibility/FileInfo.java | 82 +++ .../NormalizedStringElement.java | 115 +++++ .../accessibility/SingleEnumerateElement.java | 184 +++++++ .../accessibility/SingleIntegerElement.java | 113 +++++ .../accessibility/companion/Calculator.java | 110 ++++ .../companion/CalculatorInfo.java | 54 ++ .../companion/CalculatorType.java | 64 +++ .../companion/CalculatorTypeType.java | 96 ++++ .../companion/CompanionMaterial.java | 48 ++ .../companion/CompanionMaterialType.java | 144 ++++++ .../companion/CompanionMaterialsInfo.java | 136 +++++ .../companion/DecimalUnitElement.java | 139 ++++++ .../accessibility/companion/Description.java | 54 ++ .../companion/DigitalMaterial.java | 53 ++ .../companion/LinearRuleSystem.java | 47 ++ .../accessibility/companion/LinearUnitSI.java | 89 ++++ .../accessibility/companion/LinearUnitUS.java | 89 ++++ .../companion/MajorIncrementLinearSI.java | 61 +++ .../companion/MajorIncrementLinearUS.java | 63 +++ .../companion/MajorIncrementRadialSI.java | 61 +++ .../companion/MajorIncrementRadialUS.java | 61 +++ .../companion/MinimumLength.java | 54 ++ .../companion/MinorIncrementLinearSI.java | 61 +++ .../companion/MinorIncrementLinearUS.java | 61 +++ .../companion/MinorIncrementRadialSI.java | 61 +++ .../companion/MinorIncrementRadialUS.java | 61 +++ .../companion/PhysicalMaterial.java | 54 ++ .../accessibility/companion/Protractor.java | 84 ++++ .../companion/RadialIncrementSystem.java | 47 ++ .../companion/RadialIncrementSystemSI.java | 66 +++ .../companion/RadialIncrementSystemUS.java | 66 +++ .../accessibility/companion/RadialUnitSI.java | 83 ++++ .../accessibility/companion/RadialUnitUS.java | 87 ++++ .../companion/ReadingPassage.java | 54 ++ .../node/accessibility/companion/Rule.java | 84 ++++ .../accessibility/companion/RuleSystemSI.java | 76 +++ .../accessibility/companion/RuleSystemUS.java | 76 +++ .../inclusion/AslDefaultOrder.java | 53 ++ .../inclusion/AslOnDemandOrder.java | 53 ++ .../inclusion/BrailleDefaultOrder.java | 53 ++ .../accessibility/inclusion/ElementOrder.java | 85 ++++ .../inclusion/ElementOrderList.java | 59 +++ .../inclusion/ElementOrderListType.java | 178 +++++++ .../inclusion/GraphicsOnlyOnDemandOrder.java | 53 ++ .../inclusion/InclusionOrder.java | 106 ++++ .../inclusion/NonVisualDefaultOrder.java | 53 ++ .../inclusion/SignedEnglishDefaultOrder.java | 53 ++ .../inclusion/SignedEnglishOnDemandOrder.java | 53 ++ .../inclusion/TextGraphicsDefaultOrder.java | 53 ++ .../inclusion/TextGraphicsOnDemandOrder.java | 53 ++ .../inclusion/TextOnlyDefaultOrder.java | 53 ++ .../inclusion/TextOnlyOnDemandOrder.java | 53 ++ .../accessibility/link/CharacterLink.java | 54 ++ .../link/CharacterStringLink.java | 116 +++++ .../accessibility/link/ContentLinkInfo.java | 97 ++++ .../node/accessibility/link/FullString.java | 54 ++ .../node/accessibility/link/Link.java | 49 ++ .../node/accessibility/link/ObjectLink.java | 54 ++ .../node/accessibility/link/StringLink.java | 51 ++ .../node/accessibility/link/TextLink.java | 97 ++++ .../node/accessibility/link/WordLink.java | 54 ++ .../related/AnswerReduction.java | 66 +++ .../accessibility/related/AudioFileInfo.java | 147 ++++++ .../accessibility/related/BrailleText.java | 70 +++ .../node/accessibility/related/Chunk.java | 53 ++ .../related/ContentLinkIdentifierBearer.java | 50 ++ .../accessibility/related/DefinitionId.java | 80 +++ .../node/accessibility/related/Guidance.java | 77 +++ .../related/GuidanceSupport.java | 80 +++ .../related/KeyWordEmphasis.java | 53 ++ .../related/KeyWordTranslation.java | 65 +++ .../accessibility/related/LabelledString.java | 99 ++++ .../related/MarkupFileEmbedded.java | 57 +++ .../accessibility/related/ObjectFileInfo.java | 72 +++ .../related/RelatedElementInfo.java | 174 +++++++ .../accessibility/related/RemoveTagGroup.java | 81 +++ .../RevealAlternativeRepresentation.java | 146 ++++++ .../node/accessibility/related/Scaffold.java | 82 +++ .../related/ScaffoldBehavior.java | 100 ++++ .../node/accessibility/related/SignFile.java | 76 +++ .../node/accessibility/related/Signing.java | 77 +++ .../node/accessibility/related/Spoken.java | 82 +++ .../accessibility/related/StructuredMask.java | 102 ++++ .../accessibility/related/TactileFile.java | 99 ++++ .../accessibility/related/VideoFileInfo.java | 108 ++++ .../accessibility/related/VoiceSpeed.java | 88 ++++ .../node/accessibility/related/VoiceType.java | 86 ++++ .../ph/jqtiplus/node/item/AssessmentItem.java | 13 + .../serialization/QtiSaxDocumentFirer.java | 2 + .../ed/ph/jqtiplus/types/DataTypeBinder.java | 43 +- .../ac/ed/ph/jqtiplus/utils/QueryUtils.java | 76 ++- .../ph/jqtiplus/xmlutils/XmlParseUtils.java | 114 +++++ .../jqtiplus/reading/QtiObjectReaderTest.java | 469 ++++++++++++++++++ .../resources/reading/accessible-core-qti.xml | 449 +++++++++++++++++ 152 files changed, 12299 insertions(+), 48 deletions(-) create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierReferenceAttribute.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/ApipAccessibilityGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorTypeGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialsInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/DescriptionGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/LinearRuleSystemGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearSIGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearUSGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialSIGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialUSGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearSIGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearUSGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialSIGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialUSGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/RadialIncrementSystemGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/ElementOrderGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/InclusionOrderGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/StandardElementOrderListGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/ContentLinkInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AnswerReductionGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/BrailleTextGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ChunkGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/DefinitionIdGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceSupportGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordEmphasisGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordTranslationGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/LabelledStringGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/MarkupFileEmbeddedGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ObjectFileInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RelatedElementInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RemoveTagGroupGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RevealAlternativeRepresentationGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldBehaviorGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SignFileGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SigningGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SingleIntegerElementGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SpokenGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/StructuredMaskGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/TactileFileGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/VideoFileInfoGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/NormalizedStringElement.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorTypeType.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterial.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialType.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearRuleSystem.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystem.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderListType.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/Link.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/StringLink.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ContentLinkIdentifierBearer.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceSpeed.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceType.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/xmlutils/XmlParseUtils.java create mode 100644 qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java create mode 100644 qtiworks-jqtiplus/src/test/resources/reading/accessible-core-qti.xml diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/AttributeList.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/AttributeList.java index d763a14e6..cfb9377be 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/AttributeList.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/AttributeList.java @@ -58,6 +58,7 @@ import uk.ac.ed.ph.jqtiplus.attribute.value.FloatOrVariableRefMultipleAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierMultipleAttribute; +import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierReferenceAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.IntegerAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.IntegerOrVariableRefAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.LongAttribute; @@ -440,4 +441,8 @@ public FloatOrVariableRefMultipleAttribute getFloatOrVariableRefMultipleAttribut public StringOrVariableRefAttribute getStringOrVariableRefAttribute(final String name) { return (StringOrVariableRefAttribute) get(name); } + + public IdentifierReferenceAttribute getIdentifierRefAttribute(final String localName) { + return (IdentifierReferenceAttribute) get(localName); + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierAttribute.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierAttribute.java index 0b829321e..a4ceebac9 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierAttribute.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierAttribute.java @@ -70,7 +70,7 @@ protected Identifier parseQtiString(final String value) { public void validateBasic(final ValidationContext context) { super.validateBasic(context); - /* Spec suggests a maximum length for identnfiers. We don't enforce this, but will issue a validation warning */ + /* Spec suggests a maximum length for identifiers. We don't enforce this, but will issue a validation warning */ if (value!=null && value.toString().length() > QtiConstants.IDENTIFIER_MAX_LENGTH_RECOMMENDATION) { context.fireAttributeValidationWarning(this, "Identifiers are recommended to be no more than " diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierReferenceAttribute.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierReferenceAttribute.java new file mode 100644 index 000000000..986aad391 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/attribute/value/IdentifierReferenceAttribute.java @@ -0,0 +1,77 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.attribute.value; + +import uk.ac.ed.ph.jqtiplus.attribute.SingleAttribute; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.types.Identifier; +import uk.ac.ed.ph.jqtiplus.validation.ValidationContext; + +/** + * An attribute containing an IDREF (identifier reference). + * + * @author Zack Pierce + */ +public class IdentifierReferenceAttribute extends SingleAttribute { + + private static final long serialVersionUID = 8734729647409256811L; + + public IdentifierReferenceAttribute(final QtiNode parent, final String localName, final boolean required) { + super(parent, localName, required); + } + + public IdentifierReferenceAttribute(final QtiNode parent, final String localName, final Identifier defaultValue, final boolean required) { + super(parent, localName, defaultValue, required); + } + + public IdentifierReferenceAttribute(final QtiNode parent, final String localName, final String namespaceUri, final Identifier defaultValue, final boolean required) { + super(parent, localName, namespaceUri, defaultValue, required); + } + + @Override + protected Identifier parseQtiString(final String value) { + return Identifier.parseString(value); + } + + @Override + protected String toQtiString(final Identifier value) { + return value.toString(); + } + + @Override + public void validateBasic(final ValidationContext context) { + super.validateBasic(context); + // TODO: Ensure that some other portion of the document declares the referenced identifier. + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/NodeGroupList.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/NodeGroupList.java index c3e46d5ad..3835c7b7a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/NodeGroupList.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/NodeGroupList.java @@ -35,6 +35,56 @@ import uk.ac.ed.ph.jqtiplus.exception.QtiIllegalChildException; import uk.ac.ed.ph.jqtiplus.exception.QtiNodeGroupException; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessElementGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.ApipAccessibilityGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CalculatorInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CalculatorTypeGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CompanionMaterialGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CompanionMaterialsInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.LinearRuleSystemGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementLinearSIGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementLinearUSGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialSIGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialUSGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinimumLengthGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearSIGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearUSGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialSIGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialUSGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.RadialIncrementSystemGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.ElementOrderGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.InclusionOrderGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.StandardElementOrderListGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.ContentLinkInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.LinkGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.StringLinkGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AnswerReductionGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.BrailleTextGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ChunkGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.DefinitionIdGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.GuidanceGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.GuidanceSupportGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.KeyWordEmphasisGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.KeyWordTranslationGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.MarkupFileEmbeddedGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.NormalizedStringElementGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ObjectFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RelatedElementInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RemoveTagGroupGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RevealAlternativeRepresentationGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ScaffoldBehaviorGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ScaffoldGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SignFileGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SigningGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SpokenGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.StructuredMaskGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.TactileFileGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.VideoFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.block.InteractionGroup; import uk.ac.ed.ph.jqtiplus.group.content.BlockGroup; import uk.ac.ed.ph.jqtiplus.group.content.BlockStaticGroup; @@ -121,6 +171,50 @@ import uk.ac.ed.ph.jqtiplus.group.test.WeightGroup; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessibilityInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CalculatorInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CalculatorType; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterial; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterialsInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Description; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.LinearRuleSystem; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementLinearSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementLinearUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementRadialSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementRadialUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinimumLength; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementLinearSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementLinearUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementRadialSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementRadialUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystem; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.ElementOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.ElementOrderListType; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.ContentLinkInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.Link; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.StringLink; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.AnswerReduction; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.AudioFileInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.BrailleText; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Chunk; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.DefinitionId; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Guidance; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.KeyWordEmphasis; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.KeyWordTranslation; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.MarkupFileEmbedded; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RemoveTagGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RevealAlternativeRepresentation; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Scaffold; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.ScaffoldBehavior; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Signing; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Spoken; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.StructuredMask; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.TactileFile; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.VideoFileInfo; import uk.ac.ed.ph.jqtiplus.node.content.BodyElement; import uk.ac.ed.ph.jqtiplus.node.content.ItemBody; import uk.ac.ed.ph.jqtiplus.node.content.basic.Block; @@ -216,11 +310,12 @@ import org.w3c.dom.NodeList; /** - * Container for all node groups contained (owned) by a particular {@link QtiNode}. + * Container for all node groups contained (owned) by a particular + * {@link QtiNode}. * * @author Jiri Kajaba */ -public final class NodeGroupList implements Serializable, Iterable> { +public final class NodeGroupList implements Serializable, Iterable> { private static final long serialVersionUID = 4649998181277985510L; @@ -228,11 +323,11 @@ public final class NodeGroupList implements Serializable, Iterable> groups; + private final List> groups; public NodeGroupList(final QtiNode parent) { this.parent = parent; - this.groups = new ArrayList>(); + this.groups = new ArrayList>(); } /** @@ -254,7 +349,7 @@ public int size() { } @Override - public Iterator> iterator() { + public Iterator> iterator() { return groups.iterator(); } @@ -267,7 +362,7 @@ public Iterator> iterator() { * * @param group given group */ - public void add(final NodeGroup group) { + public void add(final NodeGroup group) { groups.add(group); } @@ -279,7 +374,7 @@ public void add(final NodeGroup group) { * @param index position * @param group given group */ - public void add(final int index, final NodeGroup group) { + public void add(final int index, final NodeGroup group) { groups.add(index, group); } @@ -292,10 +387,11 @@ public void add(final int index, final NodeGroup group) { * useful for someone adding a (non-standard) extension to the spec. * * @param group given group - * @throws QtiNodeGroupException if container already contains group with same name + * @throws QtiNodeGroupException if container already contains group with + * same name */ - public void addSafe(final int index, final NodeGroup group) { - for (final NodeGroup child : groups) { + public void addSafe(final int index, final NodeGroup group) { + for (final NodeGroup child : groups) { if (child.getName().equals(group.getName())) { throw new QtiNodeGroupException("Duplicate node group name: " + group.computeXPath()); } @@ -308,20 +404,21 @@ public void addSafe(final int index, final NodeGroup group) { * Loads group's children from given source node. *
    *
  • Unsupported (unknown) children are skipped.
  • - *
  • Wrong order of children is ignored (children are loaded in correct order).
  • + *
  • Wrong order of children is ignored (children are loaded in correct + * order).
  • *
* * @param element source node */ public void load(final Element element, final LoadingContext context) { - for (final NodeGroup group : groups) { + for (final NodeGroup group : groups) { group.getChildren().clear(); } final NodeList childNodes = element.getChildNodes(); - for (int i=0; i group : groups) { + for (final NodeGroup group : groups) { if (group.loadChildIfSupported(childNode, context)) { childLoaded = true; break; @@ -329,12 +426,13 @@ public void load(final Element element, final LoadingContext context) { } if (!childLoaded) { /* No NodeGroup supports this child */ - if (childNode.getNodeType()==Node.TEXT_NODE && childNode.getNodeValue().trim().isEmpty()) { + if (childNode.getNodeType() == Node.TEXT_NODE && childNode.getNodeValue().trim().isEmpty()) { /* Whitespace node, so we'll ignore this */ } else { /* Register error */ - final String childName = childNode.getNodeType()==Node.ELEMENT_NODE ? childNode.getLocalName() : "(text)"; + final String childName = childNode.getNodeType() == Node.ELEMENT_NODE ? childNode.getLocalName() + : "(text)"; context.modelBuildingError(new QtiIllegalChildException(parent, childName), childNode); } } @@ -354,7 +452,7 @@ public void clear() { * @param index index of requested group * @return group at given index */ - public NodeGroup get(final int index) { + public NodeGroup get(final int index) { return groups.get(index); } @@ -365,8 +463,8 @@ public NodeGroup get(final int index) { * @return group with given name * @throws QtiNodeGroupException if group is not found */ - public NodeGroup get(final String name) { - for (final NodeGroup child : groups) { + public NodeGroup get(final String name) { + for (final NodeGroup child : groups) { if (child.getName().equals(name) || child.supportsQtiClass(name)) { return child; } @@ -381,8 +479,8 @@ public NodeGroup get(final String name) { * @return group with given name * @throws QtiNodeGroupException if group is not found */ - public NodeGroup getGroupSupporting(final String qtiClassName) { - for (final NodeGroup child : groups) { + public NodeGroup getGroupSupporting(final String qtiClassName) { + for (final NodeGroup child : groups) { if (child.supportsQtiClass(qtiClassName)) { return child; } @@ -740,7 +838,6 @@ public WeightGroup getWeightGroup() { return (WeightGroup) get(Weight.QTI_CLASS_NAME); } - /** * Gets templateElse group. * @@ -901,7 +998,6 @@ public AreaMapEntryGroup getAreaMapEntryGroup() { return (AreaMapEntryGroup) get(AreaMapEntry.QTI_CLASS_NAME); } - /** * Gets prompt group. * @@ -1231,4 +1327,249 @@ public StylesheetGroup getStylesheetGroup() { public ModalFeedbackGroup getModalFeedbackGroup() { return (ModalFeedbackGroup) get(ModalFeedback.QTI_CLASS_NAME); } + + /** + * Gets apipAccessibility group. + * + * @return apipAccessibility group + * @throws QtiNodeGroupException if group is not found + */ + public ApipAccessibilityGroup getApipAccessibilityGroup() { + return (ApipAccessibilityGroup) get(ApipAccessibility.QTI_CLASS_NAME); + } + + /** + * Gets companionMaterialsInfo group + * + * @throws QtiNodeGroupException if group is not found + */ + public CompanionMaterialsInfoGroup getCompanionMaterialsInfoGroup() { + return (CompanionMaterialsInfoGroup) get(CompanionMaterialsInfo.QTI_CLASS_NAME); + } + + /** + * Gets inclusionOrder group + * + * @throws QtiNodeGroupException if group is not found + */ + public InclusionOrderGroup getInclusionOrderGroup() { + return (InclusionOrderGroup) get(InclusionOrder.QTI_CLASS_NAME); + } + + /** + * Gets accessibilityInfo group + * + * @throws QtiNodeGroupException if group is not found + */ + public AccessibilityInfoGroup getAccessibilityInfoGroup() { + return (AccessibilityInfoGroup) get(AccessibilityInfo.QTI_CLASS_NAME); + } + + public StandardElementOrderListGroup getStandardElementOrderListGroup() { + return (StandardElementOrderListGroup) get(ElementOrderListType.DISPLAY_NAME); + } + + public ElementOrderGroup getElementOrderGroup() { + return (ElementOrderGroup) get(ElementOrder.QTI_CLASS_NAME); + } + + public CalculatorTypeGroup getCalculatorTypeGroup() { + return (CalculatorTypeGroup) get(CalculatorType.QTI_CLASS_NAME); + } + + public DescriptionGroup getDescriptionGroup() { + return (DescriptionGroup) get(Description.QTI_CLASS_NAME); + } + + public CalculatorInfoGroup getCalculatorInfoGroup() { + return (CalculatorInfoGroup) get(CalculatorInfo.QTI_CLASS_NAME); + } + + public MajorIncrementLinearSIGroup getMajorIncrementLinearSIGroup() { + return (MajorIncrementLinearSIGroup) get(MajorIncrementLinearSI.QTI_CLASS_NAME); + } + + public MinorIncrementLinearSIGroup getMinorIncrementLinearSIGroup() { + return (MinorIncrementLinearSIGroup) get(MinorIncrementLinearSI.QTI_CLASS_NAME); + } + + public MajorIncrementLinearUSGroup getMajorIncrementLinearUSGroup() { + return (MajorIncrementLinearUSGroup) get(MajorIncrementLinearUS.QTI_CLASS_NAME); + } + + public MinorIncrementLinearUSGroup getMinorIncrementLinearUSGroup() { + return (MinorIncrementLinearUSGroup) get(MinorIncrementLinearUS.QTI_CLASS_NAME); + } + + public MajorIncrementRadialSIGroup getMajorIncrementRadialSIGroup() { + return (MajorIncrementRadialSIGroup) get(MajorIncrementRadialSI.QTI_CLASS_NAME); + } + + public MinorIncrementRadialSIGroup getMinorIncrementRadialSIGroup() { + return (MinorIncrementRadialSIGroup) get(MinorIncrementRadialSI.QTI_CLASS_NAME); + } + + public MajorIncrementRadialUSGroup getMajorIncrementRadialUSGroup() { + return (MajorIncrementRadialUSGroup) get(MajorIncrementRadialUS.QTI_CLASS_NAME); + } + + public MinorIncrementRadialUSGroup getMinorIncrementRadialUSGroup() { + return (MinorIncrementRadialUSGroup) get(MinorIncrementRadialUS.QTI_CLASS_NAME); + } + + public MinimumLengthGroup getMinimumLengthGroup() { + return (MinimumLengthGroup) get(MinimumLength.QTI_CLASS_NAME); + } + + public CompanionMaterialGroup getCompanionMaterialGroup() { + return (CompanionMaterialGroup) get(CompanionMaterial.DISPLAY_NAME); + } + + public LinearRuleSystemGroup getLinearRuleSystemGroup() { + return (LinearRuleSystemGroup) get(LinearRuleSystem.DISPLAY_NAME); + } + + public RadialIncrementSystemGroup getRadialIncrementSystemGroup() { + return (RadialIncrementSystemGroup) get(RadialIncrementSystem.DISPLAY_NAME); + } + + public AccessElementGroup getAccessElementGroup() { + return (AccessElementGroup) get(AccessElement.QTI_CLASS_NAME); + } + + public ContentLinkInfoGroup getContentLinkInfoGroup() { + return (ContentLinkInfoGroup) get(ContentLinkInfo.QTI_CLASS_NAME); + } + + public RelatedElementInfoGroup getRelatedElementInfoGroup() { + return (RelatedElementInfoGroup) get(RelatedElementInfo.QTI_CLASS_NAME); + } + + public LinkGroup getLinkGroup() { + return (LinkGroup) get(Link.DISPLAY_NAME); + } + + public StringLinkGroup getStringLinkGroup() { + return (StringLinkGroup) get(StringLink.DISPLAY_NAME); + } + + public SpokenGroup getSpokenGroup() { + return (SpokenGroup) get(Spoken.QTI_CLASS_NAME); + } + + public AudioFileInfoGroup getAudioFileInfoGroup() { + return (AudioFileInfoGroup) get(AudioFileInfo.QTI_CLASS_NAME); + } + + public AudioFileInfoGroup getAudioFileInfoGroup(final String localName) { + return (AudioFileInfoGroup) get(localName); + } + + public LabelledStringGroup getLabelledStringGroup(final String localName) { + return (LabelledStringGroup) get(localName); + } + + public LabelledStringGroup getSpokenTextGroup() { + return getLabelledStringGroup(Spoken.ELEM_SPOKEN_TEXT); + } + + public LabelledStringGroup getTextToSpeechPronunciationGroup() { + return getLabelledStringGroup(Spoken.ELEM_TEXT_TO_SPEECH_PRONUNCIATION); + } + + public BrailleTextGroup getBrailleTextGroup() { + return (BrailleTextGroup) get(BrailleText.QTI_CLASS_NAME); + } + + public LabelledStringGroup getBrailleTextStringGroup() { + return getLabelledStringGroup(BrailleText.ELEM_BRAILLE_TEXT_STRING); + } + + public LabelledStringGroup getTactileAudioTextGroup() { + return getLabelledStringGroup(TactileFile.ELEM_TACTILE_AUDIO_TEXT); + } + + public LabelledStringGroup getTactileBrailleTextGroup() { + return getLabelledStringGroup(TactileFile.ELEM_TACTILE_BRAILLE_TEXT); + } + + public TactileFileGroup getTactileFileGroup() { + return (TactileFileGroup) get(TactileFile.QTI_CLASS_NAME); + } + + public KeyWordEmphasisGroup getKeyWordEmphasisGroup() { + return (KeyWordEmphasisGroup) get(KeyWordEmphasis.QTI_CLASS_NAME); + } + + public ChunkGroup getChunkGroup() { + return (ChunkGroup) get(Chunk.QTI_CLASS_NAME); + } + + public SignFileGroup getSignFileGroup(final String localName) { + return (SignFileGroup) get(localName); + } + + public ObjectFileInfoGroup getObjectFileInfoGroup(final String localName) { + return (ObjectFileInfoGroup) get(localName); + } + + public VideoFileInfoGroup getVideoFileInfoGroup() { + return (VideoFileInfoGroup) get(VideoFileInfo.QTI_CLASS_NAME); + } + + public SigningGroup getSigningGroup() { + return (SigningGroup) get(Signing.QTI_CLASS_NAME); + } + + public KeyWordTranslationGroup getKeyWordTranslationGroup() { + return (KeyWordTranslationGroup) get(KeyWordTranslation.QTI_CLASS_NAME); + } + + public DefinitionIdGroup getDefinitionIdGroup() { + return (DefinitionIdGroup) get(DefinitionId.QTI_CLASS_NAME); + } + + public RevealAlternativeRepresentationGroup getRevealAlternativeRepresentationGroup() { + return (RevealAlternativeRepresentationGroup) get(RevealAlternativeRepresentation.QTI_CLASS_NAME); + } + + public MarkupFileEmbeddedGroup getMarkupFileEmbeddedGroup() { + return (MarkupFileEmbeddedGroup) get(MarkupFileEmbedded.QTI_CLASS_NAME); + } + + public GuidanceGroup getGuidanceGroup() { + return (GuidanceGroup) get(Guidance.QTI_CLASS_NAME); + } + + public GuidanceSupportGroup getGuidanceSupportGroup(final String localName) { + return (GuidanceSupportGroup) get(localName); + } + + public SingleIntegerElementGroup getSingleIntegerElementGroup(final String localName){ + return (SingleIntegerElementGroup) get(localName); + } + + public StructuredMaskGroup getStructuredMaskGroup() { + return (StructuredMaskGroup) get(StructuredMask.QTI_CLASS_NAME); + } + + public ScaffoldGroup getScaffoldGroup() { + return (ScaffoldGroup) get(Scaffold.QTI_CLASS_NAME); + } + + public ScaffoldBehaviorGroup getScaffoldBehaviorGroup() { + return (ScaffoldBehaviorGroup) get(ScaffoldBehavior.QTI_CLASS_NAME); + } + + public AnswerReductionGroup getAnswerReductionGroup() { + return (AnswerReductionGroup) get(AnswerReduction.QTI_CLASS_NAME); + } + + public RemoveTagGroupGroup getRemoveTagGroupGroup() { + return (RemoveTagGroupGroup) get(RemoveTagGroup.QTI_CLASS_NAME); + } + + public NormalizedStringElementGroup getNormalizedStringElementGroup(final String localName) { + return (NormalizedStringElementGroup) get(localName); + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java new file mode 100644 index 000000000..00f99478a --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java @@ -0,0 +1,68 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility; + +import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; + +import java.util.List; + +/** + * @author Zack Pierce + */ +public class AccessElementGroup extends SimpleMultipleNodeGroup { + + private static final long serialVersionUID = 8777385626698804683L; + + public AccessElementGroup(final QtiNode parent, final int minimum, final Integer maximum) { + super(parent, AccessElement.QTI_CLASS_NAME, minimum, maximum); + } + + /* + * @see uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup#create() + */ + @Override + public AccessElement create() { + return new AccessElement(getParent()); + } + + /** + * @return mutable list of available access elements + */ + public List getAccessElements() { + return children; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityInfoGroup.java new file mode 100644 index 000000000..2a21bd264 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityInfoGroup.java @@ -0,0 +1,70 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessibilityInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class AccessibilityInfoGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -6241698086450872378L; + + public AccessibilityInfoGroup(final ApipAccessibility parent) { + super(parent, AccessibilityInfo.QTI_CLASS_NAME, false); + } + + public AccessibilityInfo getAccessibilityInfo() { + return getChild(); + } + + public void setAccessibilityInfo(final AccessibilityInfo accessibilityInfo) { + setChild(accessibilityInfo); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public AccessibilityInfo create() { + return new AccessibilityInfo(getParent()); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/ApipAccessibilityGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/ApipAccessibilityGroup.java new file mode 100644 index 000000000..fece3a112 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/ApipAccessibilityGroup.java @@ -0,0 +1,69 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; + +/** + * @author Zack Pierce + */ +public class ApipAccessibilityGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 8363900002161066286L; + + public static final String QTI_CLASS_NAME = "apipAccessibility"; + + public ApipAccessibilityGroup(final QtiNode parent, final boolean required) { + super(parent, QTI_CLASS_NAME, required); + } + + public ApipAccessibility getApipAccessibility() { + return getChild(); + } + + public void setApipAccessibility(final ApipAccessibility apipAccessibility) { + setChild(apipAccessibility); + } + + /* + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public ApipAccessibility create() { + return new ApipAccessibility(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorInfoGroup.java new file mode 100644 index 000000000..adb628633 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorInfoGroup.java @@ -0,0 +1,71 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Calculator; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CalculatorInfo; + +/** + * Group for calculatorInfo element found within calculator elements. + * + * @author Zack Pierce + */ +public class CalculatorInfoGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -4668934108982949135L; + + public CalculatorInfoGroup(final Calculator parent) { + super(parent, CalculatorInfo.QTI_CLASS_NAME, false); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public CalculatorInfo create() { + return new CalculatorInfo(getParent()); + } + + public CalculatorInfo getCalculatorInfo() { + return getChild(); + } + + public void setCalculatorInfo(final CalculatorInfo calculatorInfo) { + setChild(calculatorInfo); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorTypeGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorTypeGroup.java new file mode 100644 index 000000000..1fe369021 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CalculatorTypeGroup.java @@ -0,0 +1,77 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Calculator; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CalculatorType; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CalculatorTypeType; + +/** + * Group for the calculatorType element within Calculator. + * + * @author Zack Pierce + */ +public class CalculatorTypeGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -3828550527146356272L; + + public CalculatorTypeGroup(final Calculator parent) { + super(parent, CalculatorType.QTI_CLASS_NAME, true); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public CalculatorType create() { + return new CalculatorType(getParent()); + } + + public CalculatorTypeType getCalculatorTypeType() { + final CalculatorType child = this.getChild(); + return child != null ? child.getValue() : null; + } + + public void setCalculatorTypeType(final CalculatorTypeType calculatorTypeType) { + CalculatorType child = this.getChild(); + if (child == null) { + child = new CalculatorType(getParent()); + setChild(child); + } + child.setValue(calculatorTypeType); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialGroup.java new file mode 100644 index 000000000..b1550dbaa --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialGroup.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.ComplexNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterial; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterialType; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterialsInfo; + +/** + * Group for the standard children of CompanionMaterialsInfo: + * Calculator, DigitalMaterial, PhysicalMaterial, Protractor, ReadingPassage, + * and Rule + * + * @author Zack Pierce + */ +public class CompanionMaterialGroup extends ComplexNodeGroup { + + private static final long serialVersionUID = 1489830058883293631L; + + public CompanionMaterialGroup(final CompanionMaterialsInfo parent) { + super(parent, CompanionMaterial.DISPLAY_NAME, CompanionMaterialType.getCompanionMaterialNames()); + } + + @Override + public CompanionMaterial create(final String qtiClassName) { + return CompanionMaterialType.getCompanionMaterialInstance(getParent(), qtiClassName); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialsInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialsInfoGroup.java new file mode 100644 index 000000000..699fbb4f1 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/CompanionMaterialsInfoGroup.java @@ -0,0 +1,69 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterialsInfo; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class CompanionMaterialsInfoGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 786155078628624431L; + + public CompanionMaterialsInfoGroup(final ApipAccessibility parent) { + super(parent, CompanionMaterialsInfo.QTI_CLASS_NAME, false); + } + + public CompanionMaterialsInfo getCompanionMaterialsInfo() { + return getChild(); + } + + public void setCompanionMaterialsInfo(final CompanionMaterialsInfo companionMaterialsInfo) { + setChild(companionMaterialsInfo); + } + + /* + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public CompanionMaterialsInfo create() { + return new CompanionMaterialsInfo(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/DescriptionGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/DescriptionGroup.java new file mode 100644 index 000000000..c9b0c8660 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/DescriptionGroup.java @@ -0,0 +1,90 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Description; + +/** + * Group for description element. + * + *

TODO : Consider consolidation of the NormalizedStringElement wrapping groups

+ * + * @author Zack Pierce + */ +public class DescriptionGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 167401634462574740L; + + public DescriptionGroup(final QtiNode parent, final boolean required) { + super(parent, Description.QTI_CLASS_NAME, required); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public Description create() { + return new Description(getParent()); + } + + public Description getDescription() { + return getChild(); + } + + public void setDescription(final Description description) { + setChild(description); + } + + public String getDescriptionText() { + final Description description = this.getDescription(); + if (description != null) { + return description.getTextContent(); + } + return null; + } + + public void setDescriptionText(final String descriptionText) { + Description description = this.getDescription(); + if (description == null) { + description = new Description(getParent()); + this.setDescription(description); + } + description.setTextContent(descriptionText); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/LinearRuleSystemGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/LinearRuleSystemGroup.java new file mode 100644 index 000000000..b72188435 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/LinearRuleSystemGroup.java @@ -0,0 +1,89 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiIllegalChildException; +import uk.ac.ed.ph.jqtiplus.group.ComplexNodeGroup; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.LinearRuleSystem; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Rule; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemUS; +import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; + +import java.util.HashSet; +import java.util.Set; + +/** + * Group for {@link RuleSystemSI} and {@link RuleSystemUS}, found within {@link Rule}. + * + * @author Zack Pierce + */ +public class LinearRuleSystemGroup extends ComplexNodeGroup { + + private static final long serialVersionUID = 825691341306815922L; + + private static Set linearRuleSystemNames; + + static { + final HashSet names = new HashSet(); + names.add(RuleSystemSI.QTI_CLASS_NAME); + names.add(RuleSystemUS.QTI_CLASS_NAME); + linearRuleSystemNames = ObjectUtilities.unmodifiableSet(names); + } + + public LinearRuleSystemGroup(final Rule parent) { + super(parent, LinearRuleSystem.DISPLAY_NAME, linearRuleSystemNames, 1, 1); + } + + @Override + public LinearRuleSystem create(final String qtiClassName) { + if (RuleSystemSI.QTI_CLASS_NAME.equals(qtiClassName)) { + return new RuleSystemSI(getParent()); + } + else if (RuleSystemUS.QTI_CLASS_NAME.equals(qtiClassName)) { + return new RuleSystemUS(getParent()); + } + throw new QtiIllegalChildException(getParent(), qtiClassName); + } + + public RuleSystemSI getRuleSystemSI() { + return QueryUtils.findFirstShallowInstance(RuleSystemSI.class, getChildren()); + } + + public RuleSystemUS getRuleSystemUS() { + return QueryUtils.findFirstShallowInstance(RuleSystemUS.class, getChildren()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearSIGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearSIGroup.java new file mode 100644 index 000000000..0e52ef7fa --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearSIGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementLinearSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemSI; + +/** + * Group for the majorIncrement element ({@link MajorIncrementLinearSI}) within {@link RuleSystemSI} + * + * @author Zack Pierce + */ +public class MajorIncrementLinearSIGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MajorIncrementLinearSIGroup(final RuleSystemSI parent) { + super(parent, MajorIncrementLinearSI.QTI_CLASS_NAME, true); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MajorIncrementLinearSI create() { + return new MajorIncrementLinearSI(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearUSGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearUSGroup.java new file mode 100644 index 000000000..5a0502c3f --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementLinearUSGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementLinearUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemUS; + +/** + * Group for the majorIncrement element ({@link MajorIncrementLinearUS}) within {@link RuleSystemUS} + * + * @author Zack Pierce + */ +public class MajorIncrementLinearUSGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MajorIncrementLinearUSGroup(final RuleSystemUS parent) { + super(parent, MajorIncrementLinearUS.QTI_CLASS_NAME, true); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MajorIncrementLinearUS create() { + return new MajorIncrementLinearUS(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialSIGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialSIGroup.java new file mode 100644 index 000000000..47cfe4e2c --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialSIGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementRadialSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemSI; + +/** + * Group for the majorIncrement element ({@link MajorIncrementRadialSI}) within {@link RadialIncrementSystemSI} + * + * @author Zack Pierce + */ +public class MajorIncrementRadialSIGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MajorIncrementRadialSIGroup(final RadialIncrementSystemSI parent) { + super(parent, MajorIncrementRadialSI.QTI_CLASS_NAME, true); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MajorIncrementRadialSI create() { + return new MajorIncrementRadialSI(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialUSGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialUSGroup.java new file mode 100644 index 000000000..faf2dbd19 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MajorIncrementRadialUSGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MajorIncrementRadialUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemUS; + +/** + * Group for the majorIncrement element ({@link MajorIncrementRadialUS}) within {@link RadialIncrementSystemUS} + * + * @author Zack Pierce + */ +public class MajorIncrementRadialUSGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MajorIncrementRadialUSGroup(final RadialIncrementSystemUS parent) { + super(parent, MajorIncrementRadialUS.QTI_CLASS_NAME, true); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MajorIncrementRadialUS create() { + return new MajorIncrementRadialUS(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java new file mode 100644 index 000000000..f1672af31 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java @@ -0,0 +1,74 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinimumLength; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemUS; + +/** + * Group for the {@link MinimumLength} element found within {@link RuleSystemSI} + * and {@link RuleSystemUS} + * + * @author Zack Pierce + */ +public class MinimumLengthGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 8992512545348461072L; + + public MinimumLengthGroup(final QtiNode parent) { + super(parent, MinimumLength.QTI_CLASS_NAME, true); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MinimumLength create() { + return new MinimumLength(getParent()); + } + + public MinimumLength getMinimumLength() { + return getChild(); + } + + public void setMinimumLength(final MinimumLength minimumLength) { + setChild(minimumLength); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearSIGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearSIGroup.java new file mode 100644 index 000000000..f4844953c --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearSIGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementLinearSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemSI; + +/** + * Group for the minorIncrement element ({@link MinorIncrementLinearSI}) within {@link RuleSystemSI} + * + * @author Zack Pierce + */ +public class MinorIncrementLinearSIGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MinorIncrementLinearSIGroup(final RuleSystemSI parent) { + super(parent, MinorIncrementLinearSI.QTI_CLASS_NAME, false); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MinorIncrementLinearSI create() { + return new MinorIncrementLinearSI(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearUSGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearUSGroup.java new file mode 100644 index 000000000..cbcf39f21 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementLinearUSGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementLinearUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemUS; + +/** + * Group for the minorIncrement element ({@link MinorIncrementLinearUS}) within {@link RuleSystemUS} + * + * @author Zack Pierce + */ +public class MinorIncrementLinearUSGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MinorIncrementLinearUSGroup(final RuleSystemUS parent) { + super(parent, MinorIncrementLinearUS.QTI_CLASS_NAME, false); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MinorIncrementLinearUS create() { + return new MinorIncrementLinearUS(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialSIGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialSIGroup.java new file mode 100644 index 000000000..618aeb3d4 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialSIGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementRadialSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemSI; + +/** + * Group for the minorIncrement element ({@link MinorIncrementRadialSI}) within {@link RadialIncrementSystemSI} + * + * @author Zack Pierce + */ +public class MinorIncrementRadialSIGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MinorIncrementRadialSIGroup(final RadialIncrementSystemSI parent) { + super(parent, MinorIncrementRadialSI.QTI_CLASS_NAME, false); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MinorIncrementRadialSI create() { + return new MinorIncrementRadialSI(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialUSGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialUSGroup.java new file mode 100644 index 000000000..321a51115 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinorIncrementRadialUSGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinorIncrementRadialUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemUS; + +/** + * Group for the minorIncrement element ({@link MinorIncrementRadialUS}) within {@link RadialIncrementSystemUS} + * + * @author Zack Pierce + */ +public class MinorIncrementRadialUSGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1246907287856132946L; + + public MinorIncrementRadialUSGroup(final RadialIncrementSystemUS parent) { + super(parent, MinorIncrementRadialUS.QTI_CLASS_NAME, false); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public MinorIncrementRadialUS create() { + return new MinorIncrementRadialUS(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/RadialIncrementSystemGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/RadialIncrementSystemGroup.java new file mode 100644 index 000000000..cfd112c84 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/RadialIncrementSystemGroup.java @@ -0,0 +1,89 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiIllegalChildException; +import uk.ac.ed.ph.jqtiplus.group.ComplexNodeGroup; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Protractor; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystem; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemUS; +import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; + +import java.util.HashSet; +import java.util.Set; + +/** + * Group for {@link RadialIncrementSystemSI} and {@link RadialIncrementSystemUS}, found within {@link Protractor}. + * + * @author Zack Pierce + */ +public class RadialIncrementSystemGroup extends ComplexNodeGroup { + + private static final long serialVersionUID = 825691341306815922L; + + private static Set radialIncrementSystemNames; + + static { + final HashSet names = new HashSet(); + names.add(RadialIncrementSystemSI.QTI_CLASS_NAME); + names.add(RadialIncrementSystemUS.QTI_CLASS_NAME); + radialIncrementSystemNames = ObjectUtilities.unmodifiableSet(names); + } + + public RadialIncrementSystemGroup(final Protractor parent) { + super(parent, RadialIncrementSystem.DISPLAY_NAME, radialIncrementSystemNames, 1, 1); + } + + @Override + public RadialIncrementSystem create(final String qtiClassName) { + if (RadialIncrementSystemSI.QTI_CLASS_NAME.equals(qtiClassName)) { + return new RadialIncrementSystemSI(getParent()); + } + else if (RadialIncrementSystemUS.QTI_CLASS_NAME.equals(qtiClassName)) { + return new RadialIncrementSystemUS(getParent()); + } + throw new QtiIllegalChildException(getParent(), qtiClassName); + } + + public RadialIncrementSystemSI getRadialIncrementSystemSI() { + return QueryUtils.findFirstShallowInstance(RadialIncrementSystemSI.class, getChildren()); + } + + public RadialIncrementSystemUS getRadialIncrementSystemUS() { + return QueryUtils.findFirstShallowInstance(RadialIncrementSystemUS.class, getChildren()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/ElementOrderGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/ElementOrderGroup.java new file mode 100644 index 000000000..3869346f0 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/ElementOrderGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.ElementOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.ElementOrderList; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class ElementOrderGroup extends SimpleMultipleNodeGroup { + + private static final long serialVersionUID = 8981878004325897462L; + + public ElementOrderGroup(final ElementOrderList parent) { + super(parent, ElementOrder.QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup#create() + */ + @Override + public ElementOrder create() { + return new ElementOrder(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/InclusionOrderGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/InclusionOrderGroup.java new file mode 100644 index 000000000..777832145 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/InclusionOrderGroup.java @@ -0,0 +1,69 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class InclusionOrderGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 1234013106184298065L; + + public InclusionOrderGroup(final ApipAccessibility parent) { + super(parent, InclusionOrder.QTI_CLASS_NAME, false); + } + + public InclusionOrder getInclusionOrder() { + return getChild(); + } + + public void setInclusionOrder(final InclusionOrder inclusionOrder) { + setChild(inclusionOrder); + } + + /** + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public InclusionOrder create() { + return new InclusionOrder(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/StandardElementOrderListGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/StandardElementOrderListGroup.java new file mode 100644 index 000000000..eb1fa0076 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/inclusion/StandardElementOrderListGroup.java @@ -0,0 +1,132 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.group.ComplexNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.AslDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.AslOnDemandOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.BrailleDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.ElementOrderList; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.ElementOrderListType; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.GraphicsOnlyOnDemandOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.NonVisualDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.SignedEnglishDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.SignedEnglishOnDemandOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.TextGraphicsDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.TextGraphicsOnDemandOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.TextOnlyDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.TextOnlyOnDemandOrder; + +import java.util.Iterator; + +/** + * Group for the set of ElementOrderList members optionally found within an InclusionOrder. + * + * @author Zack Pierce + */ +public class StandardElementOrderListGroup extends ComplexNodeGroup { + + private static final long serialVersionUID = -7333407901601134922L; + + public StandardElementOrderListGroup(final InclusionOrder parent) { + super(parent, ElementOrderListType.DISPLAY_NAME, ElementOrderListType.getElementOrderListNames()); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.NodeGroup#create(java.lang.String) + */ + @Override + public ElementOrderList create(final String qtiClassName) { + return ElementOrderListType.getElementOrderListInstance(getParent(), qtiClassName); + } + + private ElementOrderList getChildWithQtiClassName(final String qtiClassName) { + for (final Iterator iterator = children.iterator(); iterator.hasNext();) { + final ElementOrderList elementOrderList = iterator.next(); + if (qtiClassName.equals(elementOrderList.getQtiClassName())) { + return elementOrderList; + } + } + return null; + } + + public AslDefaultOrder getAslDefaultOrder() { + return (AslDefaultOrder) getChildWithQtiClassName(AslDefaultOrder.QTI_CLASS_NAME); + } + + public AslOnDemandOrder getAslOnDemandOrder() { + return (AslOnDemandOrder) getChildWithQtiClassName(AslOnDemandOrder.QTI_CLASS_NAME); + } + + public BrailleDefaultOrder getBrailleDefaultOrder() { + return (BrailleDefaultOrder) getChildWithQtiClassName(BrailleDefaultOrder.QTI_CLASS_NAME); + } + + public GraphicsOnlyOnDemandOrder getGraphicsOnlyOnDemandOrder() { + return (GraphicsOnlyOnDemandOrder) getChildWithQtiClassName(GraphicsOnlyOnDemandOrder.QTI_CLASS_NAME); + } + + public NonVisualDefaultOrder getNonVisualDefaultOrder() { + return (NonVisualDefaultOrder) getChildWithQtiClassName(NonVisualDefaultOrder.QTI_CLASS_NAME); + } + + public SignedEnglishDefaultOrder getSignedEnglishDefaultOrder() { + return (SignedEnglishDefaultOrder) getChildWithQtiClassName(SignedEnglishDefaultOrder.QTI_CLASS_NAME); + } + + public SignedEnglishOnDemandOrder getSignedEnglishOnDemandOrder() { + return (SignedEnglishOnDemandOrder) getChildWithQtiClassName(SignedEnglishOnDemandOrder.QTI_CLASS_NAME); + } + + public TextGraphicsDefaultOrder getTextGraphicsDefaultOrder() { + return (TextGraphicsDefaultOrder) getChildWithQtiClassName(TextGraphicsDefaultOrder.QTI_CLASS_NAME); + } + + public TextGraphicsOnDemandOrder getTextGraphicsOnDemandOrder() { + return (TextGraphicsOnDemandOrder) getChildWithQtiClassName(TextGraphicsOnDemandOrder.QTI_CLASS_NAME); + } + + public TextOnlyDefaultOrder getTextOnlyDefaultOrder() { + return (TextOnlyDefaultOrder) getChildWithQtiClassName(TextOnlyDefaultOrder.QTI_CLASS_NAME); + } + + public TextOnlyOnDemandOrder getTextOnlyOnDemandOrder() { + return (TextOnlyOnDemandOrder) getChildWithQtiClassName(TextOnlyOnDemandOrder.QTI_CLASS_NAME); + } + + // TODO - consider adding setters for standard element order lists? +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/ContentLinkInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/ContentLinkInfoGroup.java new file mode 100644 index 000000000..d97bc1376 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/ContentLinkInfoGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.ContentLinkInfo; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class ContentLinkInfoGroup extends SimpleMultipleNodeGroup { + + private static final long serialVersionUID = -5122224345098630600L; + + public ContentLinkInfoGroup(final AccessElement parent) { + super(parent, ContentLinkInfo.QTI_CLASS_NAME, 1, null); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup#create() + */ + @Override + public ContentLinkInfo create() { + return new ContentLinkInfo(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java new file mode 100644 index 000000000..b08a3f8fd --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java @@ -0,0 +1,100 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.exception.QtiIllegalChildException; +import uk.ac.ed.ph.jqtiplus.group.ComplexNodeGroup; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.ContentLinkInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.Link; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.ObjectLink; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.TextLink; +import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; + +import java.util.HashSet; +import java.util.Set; + +/** + * Group that holds either a single objectLink or a single textLink + * + * @author Zack Pierce + */ +public class LinkGroup extends ComplexNodeGroup { + + private static final long serialVersionUID = -7333407901601134922L; + + private static final Set allowedLinkLocalNames; + + static { + final HashSet names = new HashSet(); + names.add(ObjectLink.QTI_CLASS_NAME); + names.add(TextLink.QTI_CLASS_NAME); + allowedLinkLocalNames = ObjectUtilities.unmodifiableSet(names); + } + + public LinkGroup(final ContentLinkInfo parent) { + super(parent, Link.DISPLAY_NAME, allowedLinkLocalNames, 1, 1); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.NodeGroup#create(java.lang.String) + */ + @Override + public Link create(final String qtiClassName) { + if (ObjectLink.QTI_CLASS_NAME.equals(qtiClassName)) { + return new ObjectLink(getParent()); + } + else if (TextLink.QTI_CLASS_NAME.equals(qtiClassName)) { + return new TextLink(getParent()); + } + throw new QtiIllegalChildException(getParent(), qtiClassName); + } + + /** + * @return {@link ObjectLink} child, or null if it does not exist. + */ + public ObjectLink getObjectLink() { + return QueryUtils.findFirstShallowInstance(ObjectLink.class, children); + } + + /** + * @return {@link TextLink} child, or null if it does not exist. + */ + public TextLink getTextLink() { + return QueryUtils.findFirstShallowInstance(TextLink.class, children); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java new file mode 100644 index 000000000..4bada2f68 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java @@ -0,0 +1,124 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.exception.QtiIllegalChildException; +import uk.ac.ed.ph.jqtiplus.group.ComplexNodeGroup; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.CharacterLink; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.CharacterStringLink; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.FullString; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.StringLink; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.TextLink; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.WordLink; +import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; + +import java.util.HashSet; +import java.util.Set; + +/** + * Group for the various children of textLink: + * fullString, wordLink, characterLink, and characterStringLink + * + * @author Zack Pierce + */ +public class StringLinkGroup extends ComplexNodeGroup { + + private static final long serialVersionUID = -507947723327183531L; + + private static final Set allowedTextualLinkLocalNames; + + static { + final HashSet names = new HashSet(); + names.add(CharacterLink.QTI_CLASS_NAME); + names.add(CharacterStringLink.QTI_CLASS_NAME); + names.add(FullString.QTI_CLASS_NAME); + names.add(WordLink.QTI_CLASS_NAME); + allowedTextualLinkLocalNames = ObjectUtilities.unmodifiableSet(names); + } + + public StringLinkGroup(final TextLink parent) { + super(parent, StringLink.DISPLAY_NAME, allowedTextualLinkLocalNames, 1, 1); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.NodeGroup#create(java.lang.String) + */ + @Override + public StringLink create(final String qtiClassName) { + if (FullString.QTI_CLASS_NAME.equals(qtiClassName)) { + return new FullString(getParent()); + } + else if (CharacterLink.QTI_CLASS_NAME.equals(qtiClassName)) { + return new CharacterLink(getParent()); + } + else if (CharacterStringLink.QTI_CLASS_NAME.equals(qtiClassName)) { + return new CharacterStringLink(getParent()); + } + else if (WordLink.QTI_CLASS_NAME.equals(qtiClassName)) { + return new WordLink(getParent()); + } + throw new QtiIllegalChildException(getParent(), qtiClassName); + } + + /** + * @return {@link CharacterLink} child, or null if it does not exist. + */ + public CharacterLink getCharacterLink() { + return QueryUtils.findFirstShallowInstance(CharacterLink.class, children); + } + + /** + * @return {@link CharacterStringLink} child, or null if it does not exist. + */ + public CharacterStringLink getCharacterStringLink() { + return QueryUtils.findFirstShallowInstance(CharacterStringLink.class, children); + } + + /** + * @return {@link WordLink} child, or null if it does not exist. + */ + public WordLink getWordLink() { + return QueryUtils.findFirstShallowInstance(WordLink.class, children); + } + + /** + * @return {@link FullString} child, or null if it does not exist. + */ + public FullString getFullString() { + return QueryUtils.findFirstShallowInstance(FullString.class, children); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AnswerReductionGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AnswerReductionGroup.java new file mode 100644 index 000000000..d5ae08be6 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AnswerReductionGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.AnswerReduction; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; + +/** + * @author Zack Pierce + */ +public class AnswerReductionGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 3363665593548792027L; + + public AnswerReductionGroup(final RelatedElementInfo parent) { + super(parent, AnswerReduction.QTI_CLASS_NAME, false); + } + + @Override + public AnswerReduction create() { + return new AnswerReduction(getParent()); + } + + public AnswerReduction getAnswerReduction() { + return getChild(); + } + + public void setAnswerReduction(final AnswerReduction answerReduction) { + setChild(answerReduction); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java new file mode 100644 index 000000000..edb8b4ec9 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java @@ -0,0 +1,71 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.AudioFileInfo; + +import java.util.List; + +/** + * @author Zack Pierce + */ +public class AudioFileInfoGroup extends SimpleMultipleNodeGroup { + + private static final long serialVersionUID = 3611409681267765959L; + + public AudioFileInfoGroup(final QtiNode parent, final Integer maximum) { + this(parent, AudioFileInfo.QTI_CLASS_NAME, maximum); + } + + public AudioFileInfoGroup(final QtiNode parent, final String localName, final Integer maximum) { + super(parent, localName, 0, maximum); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup#create() + */ + @Override + public AudioFileInfo create() { + return new AudioFileInfo(getParent()); + } + + public List getAudioFileInfos() { + return this.children; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/BrailleTextGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/BrailleTextGroup.java new file mode 100644 index 000000000..41a451cb1 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/BrailleTextGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.BrailleText; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; + +/** + * @author Zack Pierce + */ +public class BrailleTextGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 8834628560432598864L; + + public BrailleTextGroup(final RelatedElementInfo parent) { + super(parent, BrailleText.QTI_CLASS_NAME, false); + } + + @Override + public BrailleText create() { + return new BrailleText(getParent()); + } + + public BrailleText getBrailleText() { + return getChild(); + } + + public void setBrailleText(final BrailleText brailleText) { + setChild(brailleText); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ChunkGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ChunkGroup.java new file mode 100644 index 000000000..e546ad5de --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ChunkGroup.java @@ -0,0 +1,72 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Chunk; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; + +/** + * @author Zack Pierce + */ +public class ChunkGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -8792528431526734516L; + + public ChunkGroup(final RelatedElementInfo parent) { + super(parent, Chunk.QTI_CLASS_NAME, false); + } + + @Override + public Chunk create() { + return new Chunk(getParent()); + } + + public Chunk getChunk() { + return getChild(); + } + + public void setChunk(final Chunk chunk) { + setChild(chunk); + } + + public boolean hasChunk() { + return getChild() != null; + } + + public void setHasChunk(final boolean shouldHaveChunk) { + setChild(shouldHaveChunk ? new Chunk(getParent()) : null); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/DefinitionIdGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/DefinitionIdGroup.java new file mode 100644 index 000000000..738403e7e --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/DefinitionIdGroup.java @@ -0,0 +1,62 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.DefinitionId; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.KeyWordTranslation; + +import java.util.List; + +/** + * @author Zack Pierce + */ +public class DefinitionIdGroup extends SimpleMultipleNodeGroup { + + private static final long serialVersionUID = -8217768107867461535L; + + public DefinitionIdGroup(final KeyWordTranslation parent) { + super(parent, DefinitionId.QTI_CLASS_NAME, 1, null); + } + + @Override + public DefinitionId create() { + return new DefinitionId(getParent()); + } + + public List getDefinitionIds() { + return children; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceGroup.java new file mode 100644 index 000000000..ddae1cceb --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Guidance; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; + +/** + * @author Zack Pierce + */ +public class GuidanceGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 3238746003113748528L; + + public GuidanceGroup(final RelatedElementInfo parent) { + super(parent, Guidance.QTI_CLASS_NAME, false); + } + + @Override + public Guidance create() { + return new Guidance(getParent()); + } + + public Guidance getGuidance() { + return getChild(); + } + + public void setGuidance(final Guidance guidance) { + setChild(guidance); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceSupportGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceSupportGroup.java new file mode 100644 index 000000000..1c0f7e4a3 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/GuidanceSupportGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Guidance; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.GuidanceSupport; + +/** + * @author Zack Pierce + */ +public class GuidanceSupportGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 8241645823225953295L; + + public GuidanceSupportGroup(final Guidance parent, final String name) { + super(parent, name, false); + } + + @Override + public GuidanceSupport create() { + return new GuidanceSupport(getParent(), getName()); + } + + public GuidanceSupport getGuidanceSupport() { + return getChild(); + } + + public void setGuidanceSupport(final GuidanceSupport guidanceSupport) { + setChild(guidanceSupport); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordEmphasisGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordEmphasisGroup.java new file mode 100644 index 000000000..307293de9 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordEmphasisGroup.java @@ -0,0 +1,72 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.KeyWordEmphasis; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; + +/** + * @author Zack Pierce + */ +public class KeyWordEmphasisGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -8792528431526734516L; + + public KeyWordEmphasisGroup(final RelatedElementInfo parent) { + super(parent, KeyWordEmphasis.QTI_CLASS_NAME, false); + } + + @Override + public KeyWordEmphasis create() { + return new KeyWordEmphasis(getParent()); + } + + public KeyWordEmphasis getKeyWordEmphasis() { + return getChild(); + } + + public void setKeyWordEmphasis(final KeyWordEmphasis keyWordEmphasis) { + setChild(keyWordEmphasis); + } + + public boolean hasKeyWordEmphasis() { + return getChild() != null; + } + + public void setHasKeyWordEmphasis(final boolean shouldHaveKeyWordEmphasis) { + setChild(shouldHaveKeyWordEmphasis ? new KeyWordEmphasis(getParent()) : null); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordTranslationGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordTranslationGroup.java new file mode 100644 index 000000000..afeb967be --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/KeyWordTranslationGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.KeyWordTranslation; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; + +/** + * @author Zack Pierce + */ +public class KeyWordTranslationGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -6187552079288069066L; + + public KeyWordTranslationGroup(final RelatedElementInfo parent) { + super(parent, KeyWordTranslation.QTI_CLASS_NAME, false); + } + + @Override + public KeyWordTranslation create() { + return new KeyWordTranslation(getParent()); + } + + public KeyWordTranslation getKeyWordTranslation() { + return getChild(); + } + + public void setKeyWordTranslation(final KeyWordTranslation keyWordTranslation) { + setChild(keyWordTranslation); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/LabelledStringGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/LabelledStringGroup.java new file mode 100644 index 000000000..941ddbc21 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/LabelledStringGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.LabelledString; + +/** + * @author Zack Pierce + */ +public class LabelledStringGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -2082779371655794158L; + + public LabelledStringGroup(final QtiNode parent, final String localElementName, final boolean required) { + super(parent, localElementName, required); + } + + @Override + public LabelledString create() { + return new LabelledString(getParent(), getName()); + } + + public LabelledString getLabelledString() { + return getChild(); + } + + public void setLabelledString(final LabelledString labelledString) { + setChild(labelledString); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/MarkupFileEmbeddedGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/MarkupFileEmbeddedGroup.java new file mode 100644 index 000000000..3e35879fd --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/MarkupFileEmbeddedGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.MarkupFileEmbedded; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RevealAlternativeRepresentation; + +/** + * @author Zack Pierce + */ +public class MarkupFileEmbeddedGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 2095165016988978343L; + + public MarkupFileEmbeddedGroup(final RevealAlternativeRepresentation parent) { + super(parent, MarkupFileEmbedded.QTI_CLASS_NAME, false); + } + + @Override + public MarkupFileEmbedded create() { + return new MarkupFileEmbedded(getParent()); + } + + public MarkupFileEmbedded getMarkupFileEmbedded() { + return getChild(); + } + + public void setMarkupFileEmbedded(final MarkupFileEmbedded markupEmbeddedFile) { + setChild(markupEmbeddedFile); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java new file mode 100644 index 000000000..0ad212c94 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java @@ -0,0 +1,70 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.NormalizedStringElement; + +import java.util.List; + +/** + * @author Zack Pierce + */ +public class NormalizedStringElementGroup extends SimpleMultipleNodeGroup { + + private static final long serialVersionUID = 909398384463659441L; + + public NormalizedStringElementGroup(final QtiNode parent, final String childQtiClass) { + super(parent, childQtiClass); + } + + public NormalizedStringElementGroup(final QtiNode parent, final String childQtiClass, final int minimum, final int maximum) { + super(parent, childQtiClass, minimum, maximum); + } + + public NormalizedStringElementGroup(final QtiNode parent, final String childQtiClass, final int minimum, final Integer maximum) { + super(parent, childQtiClass, minimum, maximum); + } + + @Override + public NormalizedStringElement create() { + return new NormalizedStringElement(getParent(), getName()); + } + + public List getNormalizedStringElements() { + return children; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ObjectFileInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ObjectFileInfoGroup.java new file mode 100644 index 000000000..5dcf3db2d --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ObjectFileInfoGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.ObjectFileInfo; + +/** + * @author Zack Pierce + */ +public class ObjectFileInfoGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1293679660861014169L; + + public ObjectFileInfoGroup(final QtiNode parent, final String localName, final boolean required) { + super(parent, localName, required); + } + + @Override + public ObjectFileInfo create() { + return new ObjectFileInfo(getParent(), getName()); + } + + public ObjectFileInfo getObjectFileInfo() { + return getChild(); + } + + public void setObjectFileInfo(final ObjectFileInfo objectFileInfo) { + setChild(objectFileInfo); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RelatedElementInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RelatedElementInfoGroup.java new file mode 100644 index 000000000..b10b503db --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RelatedElementInfoGroup.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class RelatedElementInfoGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 6759462413053925488L; + + public RelatedElementInfoGroup(final AccessElement parent) { + super(parent, RelatedElementInfo.QTI_CLASS_NAME, true); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public RelatedElementInfo create() { + return new RelatedElementInfo(getParent()); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RemoveTagGroupGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RemoveTagGroupGroup.java new file mode 100644 index 000000000..da2110914 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RemoveTagGroupGroup.java @@ -0,0 +1,65 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.AnswerReduction; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RemoveTagGroup; + +import java.util.List; + +/** + *

Note that repetitive name arises from fact that the element contained + * by this group is in fact named "removeTagGroup" in the schema. + * + * @author Zack Pierce + */ +public class RemoveTagGroupGroup extends SimpleMultipleNodeGroup { + + private static final long serialVersionUID = -4667688538860968381L; + + public RemoveTagGroupGroup(final AnswerReduction parent) { + super(parent, RemoveTagGroup.QTI_CLASS_NAME, 0, null); + } + + @Override + public RemoveTagGroup create() { + return new RemoveTagGroup(getParent()); + } + + public List getRemoveTagGroups() { + return children; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RevealAlternativeRepresentationGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RevealAlternativeRepresentationGroup.java new file mode 100644 index 000000000..508256f9d --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/RevealAlternativeRepresentationGroup.java @@ -0,0 +1,65 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RevealAlternativeRepresentation; + +/** + * @author Zack Pierce + */ +public class RevealAlternativeRepresentationGroup extends + SimpleSingleNodeGroup { + + private static final long serialVersionUID = 6192725260122252822L; + + public RevealAlternativeRepresentationGroup(final RelatedElementInfo parent) { + super(parent, RevealAlternativeRepresentation.QTI_CLASS_NAME, false); + } + + @Override + public RevealAlternativeRepresentation create() { + return new RevealAlternativeRepresentation(getParent()); + } + + public RevealAlternativeRepresentation getRevealAlternativeRepresentation() { + return getChild(); + } + + public void setRevealAlternativeRepresentation(final RevealAlternativeRepresentation revealAlternativeRepresentation) { + setChild(revealAlternativeRepresentation); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldBehaviorGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldBehaviorGroup.java new file mode 100644 index 000000000..3df0dc599 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldBehaviorGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Scaffold; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.ScaffoldBehavior; + +/** + * @author Zack Pierce + */ +public class ScaffoldBehaviorGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 5759827060579568844L; + + public ScaffoldBehaviorGroup(final Scaffold parent) { + super(parent, ScaffoldBehavior.QTI_CLASS_NAME, false); + } + + @Override + public ScaffoldBehavior create() { + return new ScaffoldBehavior(getParent()); + } + + public ScaffoldBehavior getScaffoldBehavior() { + return getChild(); + } + + public void setScaffoldBehavior(final ScaffoldBehavior scaffoldBehavior) { + setChild(scaffoldBehavior); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldGroup.java new file mode 100644 index 000000000..b6d4d4cfd --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/ScaffoldGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Scaffold; + +/** + * @author Zack Pierce + */ +public class ScaffoldGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -7843757174258263084L; + + public ScaffoldGroup(final RelatedElementInfo parent) { + super(parent, Scaffold.QTI_CLASS_NAME, false); + } + + @Override + public Scaffold create() { + return new Scaffold(getParent()); + } + + public Scaffold getScaffold() { + return getChild(); + } + + public void setScaffold(final Scaffold scaffold) { + setChild(scaffold); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SignFileGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SignFileGroup.java new file mode 100644 index 000000000..f911dae69 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SignFileGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.SignFile; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Signing; + +/** + * @author Zack Pierce + */ +public class SignFileGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -1992590395951020807L; + + public SignFileGroup(final Signing parent, final String signFileLocalName) { + super(parent, signFileLocalName, false); + } + + @Override + public SignFile create() { + return new SignFile(getParent(), getName()); + } + + public SignFile getSignFile() { + return getChild(); + } + + public void setSignFile(final SignFile signFile) { + setChild(signFile); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SigningGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SigningGroup.java new file mode 100644 index 000000000..79a7e19c1 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SigningGroup.java @@ -0,0 +1,66 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Signing; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class SigningGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -8450605269961561731L; + + public SigningGroup(final RelatedElementInfo parent) { + super(parent, Signing.QTI_CLASS_NAME, false); + } + + @Override + public Signing create() { + return new Signing(getParent()); + } + + public Signing getSigning() { + return getChild(); + } + + public void setSigning(final Signing signing) { + setChild(signing); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SingleIntegerElementGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SingleIntegerElementGroup.java new file mode 100644 index 000000000..b22081d05 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SingleIntegerElementGroup.java @@ -0,0 +1,86 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; + +/** + * @author Zack Pierce + */ +public class SingleIntegerElementGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -2669119907664947913L; + + public SingleIntegerElementGroup(final QtiNode parent, final String localName, final boolean required) { + super(parent, localName, required); + } + + @Override + public SingleIntegerElement create() { + return new SingleIntegerElement(getParent(), getName()); + } + + public SingleIntegerElement getSingleIntegerElement() { + return getChild(); + } + + public void setSingleIntegerElement(final SingleIntegerElement singleIntegerElement) { + setChild(singleIntegerElement); + } + + /** + * @return The Integer value of the child SupportOrder, or null if no child exists + */ + public Integer getInteger() { + final SingleIntegerElement element = getSingleIntegerElement(); + return element != null ? element.getValue() : null; + } + + /** + * Sets the Integer value of the child SupportOrder. If no such child previously + * existed, this convenience method will create and internally add a new instance. + * @param integer + */ + public void setInteger(final Integer integer) { + SingleIntegerElement element = getSingleIntegerElement(); + if (element == null) { + element = new SingleIntegerElement(getParent(), getName()); + setChild(element); + } + element.setValue(integer); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SpokenGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SpokenGroup.java new file mode 100644 index 000000000..c311cfc36 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/SpokenGroup.java @@ -0,0 +1,69 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Spoken; + +/** + * @author Zack Pierce + */ +public class SpokenGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -8786056365162361163L; + + public SpokenGroup(final RelatedElementInfo parent) { + super(parent, Spoken.QTI_CLASS_NAME, false); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() + */ + @Override + public Spoken create() { + return new Spoken(getParent()); + } + + public Spoken getSpoken() { + return getChild(); + } + + public void setSpoken(final Spoken spoken) { + setChild(spoken); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/StructuredMaskGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/StructuredMaskGroup.java new file mode 100644 index 000000000..28d72b7e0 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/StructuredMaskGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.StructuredMask; + +/** + * @author Zack Pierce + */ +public class StructuredMaskGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 6304054668627877392L; + + public StructuredMaskGroup(final RelatedElementInfo parent) { + super(parent, StructuredMask.QTI_CLASS_NAME, false); + } + + @Override + public StructuredMask create() { + return new StructuredMask(getParent()); + } + + public StructuredMask getStructuredMask() { + return getChild(); + } + + public void setStructuredMask(final StructuredMask structuredMask) { + setChild(structuredMask); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/TactileFileGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/TactileFileGroup.java new file mode 100644 index 000000000..a75f54fa5 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/TactileFileGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.TactileFile; + +/** + * @author Zack Pierce + */ +public class TactileFileGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = -3059230025346531110L; + + public TactileFileGroup(final RelatedElementInfo parent) { + super(parent, TactileFile.QTI_CLASS_NAME, false); + } + + @Override + public TactileFile create() { + return new TactileFile(getParent()); + } + + public TactileFile getTactileFile() { + return getChild(); + } + + public void setTactileFile(final TactileFile tactileFile) { + setChild(tactileFile); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/VideoFileInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/VideoFileInfoGroup.java new file mode 100644 index 000000000..e5b34a6ed --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/VideoFileInfoGroup.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.VideoFileInfo; + +/** + * @author Zack Pierce + */ +public class VideoFileInfoGroup extends SimpleSingleNodeGroup { + + private static final long serialVersionUID = 2240999251386900136L; + + public VideoFileInfoGroup(final QtiNode parent, final boolean required) { + super(parent, VideoFileInfo.QTI_CLASS_NAME, required); + } + + @Override + public VideoFileInfo create() { + return new VideoFileInfo(getParent()); + } + + public VideoFileInfo getVideoFileInfo() { + return getChild(); + } + + public void setVideoFileInfo(final VideoFileInfo videoFileInfo) { + setChild(videoFileInfo); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java new file mode 100644 index 000000000..4af1af29e --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java @@ -0,0 +1,88 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.ContentLinkInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RelatedElementInfoGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.ContentLinkInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.types.Identifier; + +import java.util.List; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class AccessElement extends AbstractNode { + + private static final long serialVersionUID = -7875203339228083764L; + + public static final String QTI_CLASS_NAME = "accessElement"; + + public static final String ATTR_IDENTIFIER_NAME = "identifier"; + + public AccessElement(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getAttributes().add(new IdentifierAttribute(this, ATTR_IDENTIFIER_NAME, true)); + getNodeGroups().add(new ContentLinkInfoGroup(this)); + getNodeGroups().add(new RelatedElementInfoGroup(this)); + } + + /** + * @return the value of the identifier attribute + */ + public Identifier getIdentifier() { + return getAttributes().getIdentifierAttribute(ATTR_IDENTIFIER_NAME).getValue(); + } + + /** + * @return content links for this access element + */ + public List getContentLinkInfos() { + return getNodeGroups().getContentLinkInfoGroup().getChildren(); + } + + /** + * @return the RelatedElementInfo for this access element, a container for all actual accessibility metacontent + */ + public RelatedElementInfo getRelatedElementInfo() { + return getNodeGroups().getRelatedElementInfoGroup().getChild(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java new file mode 100644 index 000000000..af6b51c92 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java @@ -0,0 +1,62 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessElementGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import java.util.List; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class AccessibilityInfo extends AbstractNode { + + private static final long serialVersionUID = 3607456133476499236L; + + public static final String QTI_CLASS_NAME = "accessibilityInfo"; + + public AccessibilityInfo(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new AccessElementGroup(this, 1, null)); + } + + public List getAccessElements() { + return getNodeGroups().getAccessElementGroup().getAccessElements(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java new file mode 100644 index 000000000..38381780e --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java @@ -0,0 +1,91 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CompanionMaterialsInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.InclusionOrderGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterialsInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; + +import java.util.List; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class ApipAccessibility extends AbstractNode { + private static final long serialVersionUID = 624091309484859804L; + + /** Name of this class in xml schema. */ + public static final String QTI_CLASS_NAME = "apipAccessibility"; + + public ApipAccessibility(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new CompanionMaterialsInfoGroup(this)); + getNodeGroups().add(new InclusionOrderGroup(this)); + getNodeGroups().add(new AccessibilityInfoGroup(this)); + + // TODO - XML namespace related serialization handling + } + + public CompanionMaterialsInfo getCompanionMaterialsInfo() { + return getNodeGroups().getCompanionMaterialsInfoGroup().getCompanionMaterialsInfo(); + } + + public InclusionOrder getInclusionOrder() { + return getNodeGroups().getInclusionOrderGroup().getInclusionOrder(); + } + + public AccessibilityInfo getAccessibilityInfo() { + return getNodeGroups().getAccessibilityInfoGroup().getAccessibilityInfo(); + } + + public void setAccessibilityInfo(final AccessibilityInfo accessibilityInfo) { + getNodeGroups().getAccessibilityInfoGroup().setAccessibilityInfo(accessibilityInfo); + } + + /** + * A convenience for retrieving the access elements nested within the {@link AccessibilityInfo} child. + * + * @return A list of Access Elements, or null if no AccessibilityInfo child exists + */ + public List getAccessElements() { + final AccessibilityInfo accessibilityInfo = getAccessibilityInfo(); + return accessibilityInfo != null ? accessibilityInfo.getAccessElements() : null; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java new file mode 100644 index 000000000..f7fc213a7 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java @@ -0,0 +1,87 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import org.w3c.dom.Element; + +/** + * Base class for elements with no children or attributes whatsoever. + * + * @author Zack Pierce + */ +public abstract class EmptyElement extends AbstractNode { + + private static final long serialVersionUID = -751561804207938794L; + + public EmptyElement(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#hasChildNodes() + */ + @Override + public boolean hasChildNodes() { + return false; + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadAttributes(final Element element, final LoadingContext context) { + /* Nothing to do here */ + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + /* Nothing to do here */ + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java new file mode 100644 index 000000000..b092ddcb0 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java @@ -0,0 +1,82 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import org.w3c.dom.Element; + +/** + * Base class for data objects containing a fileHref and a mimeType + * + * @author Zack Pierce + */ +public abstract class FileInfo extends AbstractNode { + + private static final long serialVersionUID = -1524033363125950739L; + + private String fileHref; + + public FileInfo(final QtiNode parent, final String qtiClassName, final boolean mimeTypeRequired) { + super(parent, qtiClassName); + getAttributes().add(new StringAttribute(this, "mimeType", mimeTypeRequired)); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + fileHref = XmlParseUtils.getChildContent(element, "fileHref"); + } + + public String getFileHref() { + return fileHref; + } + + public void setFileHref(final String fileHref) { + this.fileHref = fileHref; + } + + public String getMimeType() { + return ((StringAttribute) getAttributes().get("mimeType")).getValue(); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/NormalizedStringElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/NormalizedStringElement.java new file mode 100644 index 000000000..caf875c00 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/NormalizedStringElement.java @@ -0,0 +1,115 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * An base class for elements with no attributes, and only + * simple text nodes for children, conforming to the xsd:normalizedString type. + * + * @author Zack Pierce + */ +public class NormalizedStringElement extends AbstractNode { + + private static final long serialVersionUID = 4780318672704158302L; + + private String textContent; + + public NormalizedStringElement(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadAttributes(final Element element, final LoadingContext context) { + /* No attributes to load */ + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + this.textContent = XmlParseUtils.getDirectTextualContent(element); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#hasChildNodes() + */ + @Override + public boolean hasChildNodes() { + return false; + } + + /* + * (non-Javadoc) + * + * @see + * uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) + */ + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + qtiSaxDocumentFirer.fireText(textContent); + } + + /** + * @return Aggregated textual contents from the element's body. + */ + public String getTextContent() { + return textContent; + } + + public void setTextContent(final String textContent) { + this.textContent = textContent; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java new file mode 100644 index 000000000..bf41b39f0 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java @@ -0,0 +1,184 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public abstract class SingleEnumerateElement & Stringifiable> extends AbstractNode { + + private static final long serialVersionUID = -8448200082436631640L; + + private V value; + private final V defaultValue; + + public SingleEnumerateElement(final QtiNode parent, final String qtiClassName, final V defaultValue) { + super(parent, qtiClassName); + this.defaultValue = defaultValue; + } + + public abstract V parseQtiString(String rawValue); + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#load(org.w3c.dom.Element, uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + public final void load(final Element sourceElement, final LoadingContext context) { + super.load(sourceElement, context); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + final String rawValue = element.getTextContent(); + if (rawValue != null) { + try { + this.value = parseQtiString(rawValue.trim()); + } + catch (final QtiParseException ex) { + this.value = null; + context.modelBuildingError(ex, element); + } + } + else { + this.value = null; + } + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadAttributes(final Element element, final LoadingContext context) { + /* No attributes to load */ + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#hasChildNodes() + */ + @Override + public boolean hasChildNodes() { + return false; + } + + /* + * (non-Javadoc) + * + * @see + * uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) + */ + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + qtiSaxDocumentFirer.fireText(value.toQtiString()); + } + + /** + * Returns true if this attribute's value has been explicitly set. + *

+ * This is equivalent to {@link #getValue()} returning non-null. + */ + public boolean isSet() { + return value != null; + } + + /** + * Returns the default value of the attribute, which is the effective value used if the + * attribute has not been explicitly set. This will be null if there is no default value. + * The result of this should be assumed immutable. + */ + public V getDefaultValue() { + return defaultValue; + } + + /** + * Gets the explicitly-set value of this element, returning null if this + * element has not been explicitly set. The value should be assumed immutable. + *

+ * This will return null if the value has not been explicitly set. This is + * different from the original JQTI behaviour! + * + * @see #getComputedValue() + * + * @return value of attribute + */ + public V getValue() { + return value; + } + + /** + * Gets the "computed" value of this element, which is defined to be the + * explicitly-set value (if not null), or the default value. + *

+ * Note that if there is no default value, then this will return null. + *

+ */ + public V getComputedValue() { + return value != null ? value : defaultValue; + } + + /** + * Sets the value of this element. + * + * @param value new value of element, which may be null to indicate that the element's + * value should be unset. + */ + public void setValue(final V value) { + this.value = value; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java new file mode 100644 index 000000000..c85b51cfb --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java @@ -0,0 +1,113 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; +import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; + +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * Convenience base class elements that only contain a single integer + * in their textual children. + * + * @author Zack Pierce + */ +public class SingleIntegerElement extends AbstractNode { + + private static final long serialVersionUID = -2288768722969592203L; + + private Integer value; + + public SingleIntegerElement(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + } + + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + try { + this.setValue(DataTypeBinder.parseInteger(element.getTextContent())); + } + catch (final QtiParseException ex) { + this.setValue(null); + context.modelBuildingError(ex, element); + } + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadAttributes(final Element element, final LoadingContext context) { + /* No attributes to load */ + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#hasChildNodes() + */ + @Override + public boolean hasChildNodes() { + return false; + } + + /* + * (non-Javadoc) + * + * @see + * uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) + */ + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + qtiSaxDocumentFirer.fireText(Integer.toString(getValue())); + } + + public Integer getValue() { + return value; + } + + public void setValue(final Integer value) { + this.value = value; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java new file mode 100644 index 000000000..db5b64044 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java @@ -0,0 +1,110 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CalculatorInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CalculatorTypeGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; + +/** + * Information model for a calculator designated as a companion material. + * + * @author Zack Pierce + */ +public class Calculator extends AbstractNode implements CompanionMaterial { + + private static final long serialVersionUID = 1863389297633576964L; + + public static final String QTI_CLASS_NAME = "calculator"; + + public Calculator(final CompanionMaterialsInfo parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(0, new CalculatorTypeGroup(this)); + getNodeGroups().add(1, new DescriptionGroup(this, true)); + getNodeGroups().add(2, new CalculatorInfoGroup(this)); + } + + /** + * Convenience for retrieving the optional CalculatorInfo child. + * @return + */ + public CalculatorInfo getCalculatorInfo() { + return getNodeGroups().getCalculatorInfoGroup().getCalculatorInfo(); + } + + /** + * Convenience for setting the optional CalculatorInfo child. + * @param calculatorInfo + */ + public void setCalculatorInfo(final CalculatorInfo calculatorInfo) { + getNodeGroups().getCalculatorInfoGroup().setCalculatorInfo(calculatorInfo); + } + + /** + * Convenience for retrieving the Description's textual content. + * @return + */ + public String getDescriptionText() { + return getNodeGroups().getDescriptionGroup().getDescriptionText(); + + } + + /** + * Convenience for setting the Description's textual content. + * @param descriptionText + */ + public void setDescriptionText(final String descriptionText) { + ; + getNodeGroups().getDescriptionGroup().setDescriptionText(descriptionText); + } + + /** + * Convenience for retrieving the calculatorType's enumerated value. + * @return + */ + public CalculatorTypeType getCalculatorTypeType() { + return getNodeGroups().getCalculatorTypeGroup().getCalculatorTypeType(); + + } + + /** + * Convenience for setting the calculatorType's enumerated value. + * @param calculatorTypeType + */ + public void setCalculatorTypeType(final CalculatorTypeType calculatorTypeType) { + getNodeGroups().getCalculatorTypeGroup().setCalculatorTypeType(calculatorTypeType); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java new file mode 100644 index 000000000..d5f1941a9 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; + +/** + * (Item)FileInfo for Calculator elements. + * + * @author Zack Pierce + */ +public class CalculatorInfo extends FileInfo { + + private static final long serialVersionUID = 4984152168422629159L; + + public static final String QTI_CLASS_NAME = "calculatorInfo"; + + public CalculatorInfo(final QtiNode parent) { + super(parent, QTI_CLASS_NAME, false); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java new file mode 100644 index 000000000..db3401499 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java @@ -0,0 +1,64 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleEnumerateElement; + +/** + * Element containing a known calculatorType. + * + * @author Zack Pierce + */ +public class CalculatorType extends SingleEnumerateElement { + + private static final long serialVersionUID = 1473701226676474701L; + + public static final String QTI_CLASS_NAME = "calculatorType"; + + public CalculatorType(final QtiNode parent) { + super(parent, QTI_CLASS_NAME, null); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.SingleEnumerateElement#parseQtiString(java.lang.String) + */ + @Override + public CalculatorTypeType parseQtiString(final String rawValue) { + return CalculatorTypeType.parseCalculatorType(rawValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorTypeType.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorTypeType.java new file mode 100644 index 000000000..2f71beaf5 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorTypeType.java @@ -0,0 +1,96 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.util.HashMap; +import java.util.Map; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public enum CalculatorTypeType implements Stringifiable { + BASIC("Basic"), + + STANDARD("Standard"), + + SCIENTIFIC("Scientific"), + + GRAPHING("Graphing"); + + public static final String QTI_CLASS_NAME = "calculatorType"; + + private static final Map calculatorTypes; + + static { + final HashMap hashMap = new HashMap(); + + for (final CalculatorTypeType calculatorType : CalculatorTypeType.values()) { + hashMap.put(calculatorType.calculatorType, calculatorType); + } + + calculatorTypes = ObjectUtilities.unmodifiableMap(hashMap); + } + + private String calculatorType; + + private CalculatorTypeType(final String calculatorType) { + this.calculatorType = calculatorType; + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.types.Stringifiable#toQtiString() + */ + @Override + public String toQtiString() { + return calculatorType; + } + + public static CalculatorTypeType parseCalculatorType(final String calculatorType) throws QtiParseException { + final CalculatorTypeType result = calculatorTypes.get(calculatorType); + + if (result == null) { + throw new QtiParseException("Invalid " + QTI_CLASS_NAME + " '" + calculatorType + "'."); + } + + return result; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterial.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterial.java new file mode 100644 index 000000000..20eec3394 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterial.java @@ -0,0 +1,48 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * A marker interface for the children of the CompanionMaterialsInfo element. + * Calculator, Rule, Protractor, ReadingPassage, DigitalMaterial, PhysicalMaterial + * + * (Not part of the APIP/QTI specification) + * + * @author Zack Pierce + */ +public interface CompanionMaterial extends QtiNode { + public final static String DISPLAY_NAME = "CompanionMaterials"; +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialType.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialType.java new file mode 100644 index 000000000..dd39d61aa --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialType.java @@ -0,0 +1,144 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiIllegalChildException; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +/** + * Enumeration of the types of companion material elements that + * may be found within a standard CompanionMaterialsInfo element: + * Calculator, DigitalMaterial, PhysicalMaterial, Protractor, ReadingPassage, Rule + * + * @author Zack Pierce + */ +public enum CompanionMaterialType { + + CALCULATOR(Calculator.QTI_CLASS_NAME, Calculator.class) { + + @Override + public CompanionMaterial create(final CompanionMaterialsInfo parent) { + return new Calculator(parent); + } + + }, + + DIGITAL_MATERIAL(DigitalMaterial.QTI_CLASS_NAME, DigitalMaterial.class) { + + @Override + public CompanionMaterial create(final CompanionMaterialsInfo parent) { + return new DigitalMaterial(parent); + } + + }, + + PHYSICAL_MATERIAL(PhysicalMaterial.QTI_CLASS_NAME, PhysicalMaterial.class) { + + @Override + public CompanionMaterial create(final CompanionMaterialsInfo parent) { + return new PhysicalMaterial(parent); + } + + }, + + PROTRACTOR(Protractor.QTI_CLASS_NAME, Protractor.class) { + + @Override + public CompanionMaterial create(final CompanionMaterialsInfo parent) { + return new Protractor(parent); + } + + }, + + READING_PASSAGE(ReadingPassage.QTI_CLASS_NAME, ReadingPassage.class) { + + @Override + public CompanionMaterial create(final CompanionMaterialsInfo parent) { + return new ReadingPassage(parent); + } + + }, + + RULE(Rule.QTI_CLASS_NAME, Rule.class) { + + @Override + public CompanionMaterial create(final CompanionMaterialsInfo parent) { + return new Rule(parent); + } + + }; + + private static Map companionMaterialNameToTypes; + + static { + companionMaterialNameToTypes = new HashMap(); + for (final CompanionMaterialType type : CompanionMaterialType.values()) { + companionMaterialNameToTypes.put(type.qtiClassName, type); + } + + } + + private String qtiClassName; + + private Class clazz; + + CompanionMaterialType(final String type, final Class clazz) { + this.qtiClassName = type; + this.clazz = clazz; + } + + public abstract CompanionMaterial create(CompanionMaterialsInfo parent); + + public Class getClazz() { + return clazz; + } + + public static CompanionMaterial getCompanionMaterialInstance(final CompanionMaterialsInfo parent, final String qtiClassName) { + final CompanionMaterialType companionMaterialType = companionMaterialNameToTypes.get(qtiClassName); + + if (companionMaterialType == null) { + throw new QtiIllegalChildException(parent, qtiClassName); + } + + return companionMaterialType.create(parent); + + } + + public static Set getCompanionMaterialNames() { + return companionMaterialNameToTypes.keySet(); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java new file mode 100644 index 000000000..bf48b2a33 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java @@ -0,0 +1,136 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CompanionMaterialGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; + +import java.util.List; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class CompanionMaterialsInfo extends AbstractNode { + + private static final long serialVersionUID = -2322734469468312351L; + + public static final String QTI_CLASS_NAME = "companionMaterialsInfo"; + + public CompanionMaterialsInfo(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new CompanionMaterialGroup(this)); + // TODO : support 3rd party element order lists added via "any" extension point here + } + + /** + * Computes a snapshot of all the Calculators within this CompanionMaterialsInfo. + * The returned list cannot be used for adding new Calculators. + * + * (This performs a shallow search.) + * + * @return list of Calculators. + */ + public List findCalculators() { + return QueryUtils.findShallowInstances(Calculator.class, getNodeGroups().getCompanionMaterialGroup() + .getChildren()); + } + + /** + * Computes a snapshot of all the Rules within this CompanionMaterialsInfo. + * The returned list cannot be used for adding new Rules. + * + * (This performs a shallow search.) + * + * @return list of Rules. + */ + public List findRules() { + return QueryUtils.findShallowInstances(Rule.class, getNodeGroups().getCompanionMaterialGroup().getChildren()); + } + + /** + * Computes a snapshot of all the Protractors within this CompanionMaterialsInfo. + * The returned list cannot be used for adding new Protractors. + * + * (This performs a shallow search.) + * + * @return list of Protractors. + */ + public List findProtractors() { + return QueryUtils.findShallowInstances(Protractor.class, getNodeGroups().getCompanionMaterialGroup() + .getChildren()); + } + + /** + * Computes a snapshot of all the ReadingPassages within this CompanionMaterialsInfo. + * The returned list cannot be used for adding new ReadingPassages. + * + * (This performs a shallow search.) + * + * @return list of ReadingPassages. + */ + public List findReadingPassages() { + return QueryUtils.findShallowInstances(ReadingPassage.class, getNodeGroups().getCompanionMaterialGroup() + .getChildren()); + } + + /** + * Computes a snapshot of all the DigitalMaterials within this CompanionMaterialsInfo. + * The returned list cannot be used for adding new DigitalMaterials. + * + * (This performs a shallow search.) + * + * @return list of DigitalMaterials. + */ + public List findDigitalMaterials() { + return QueryUtils.findShallowInstances(DigitalMaterial.class, getNodeGroups().getCompanionMaterialGroup() + .getChildren()); + } + + /** + * Computes a snapshot of all the PhysicalMaterials within this CompanionMaterialsInfo. + * The returned list cannot be used for adding new PhysicalMaterials. + * + * (This performs a shallow search.) + * + * @return list of PhysicalMaterials. + */ + public List findPhysicalMaterials() { + return QueryUtils.findShallowInstances(PhysicalMaterial.class, getNodeGroups().getCompanionMaterialGroup() + .getChildren()); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java new file mode 100644 index 000000000..7b8335495 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java @@ -0,0 +1,139 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; +import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.math.BigDecimal; + +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * Abstract base class for an element containing a decimal value in its textual + * child contents, and a "unit" attribute + * + * @author Zack Pierce + */ +public abstract class DecimalUnitElement & Stringifiable> extends AbstractNode { + + private static final long serialVersionUID = -90607178471563924L; + + private static final String UNIT_QTI_CLASS_NAME = "unit"; + + private V unit; + private BigDecimal decimal; + + public DecimalUnitElement(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + } + + public abstract V parseUnit(String unitAttributeValue); + + public V getUnit() { + return unit; + } + + public void setUnit(final V unit) { + this.unit = unit; + } + + public BigDecimal getDecimal() { + return decimal; + } + + public void setDecimal(final BigDecimal decimal) { + this.decimal = decimal; + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element , + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadAttributes(final Element element, final LoadingContext context) { + final NamedNodeMap sourceAttributes = element.getAttributes(); + for (int i = 0; i < sourceAttributes.getLength(); i++) { + final Node attributeNode = sourceAttributes.item(i); + if (UNIT_QTI_CLASS_NAME.equals(attributeNode.getLocalName())) { + try { + this.unit = parseUnit(attributeNode.getNodeValue().trim()); + } + catch (final QtiParseException e) { + context.modelBuildingError(e, attributeNode); + } + break; + } + } + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + try { + this.decimal = DataTypeBinder.parseBigDecimal(element.getTextContent()); + } + catch (final QtiParseException e) { + context.modelBuildingError(e, element); + } + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireSaxEvents(uk.ac.ed.ph.jqtiplus + * .serialization.QtiSaxDocumentFirer) + */ + @Override + public void fireSaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + // TODO : Requires some custom handling for direct value here. + super.fireSaxEvents(qtiSaxDocumentFirer); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java new file mode 100644 index 000000000..8293d1cbd --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.NormalizedStringElement; + +/** + * Textual description of an accessibility or companion material feature. + * + * @author Zack Pierce + */ +public class Description extends NormalizedStringElement { + + private static final long serialVersionUID = -5879465717015902371L; + + public static final String QTI_CLASS_NAME = "description"; + + public Description(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java new file mode 100644 index 000000000..c6757491f --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class DigitalMaterial extends FileInfo implements CompanionMaterial { + + private static final long serialVersionUID = 4504325495092703478L; + + public static final String QTI_CLASS_NAME = "digitalMaterial"; + + public DigitalMaterial(final QtiNode parent) { + super(parent, QTI_CLASS_NAME, false); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearRuleSystem.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearRuleSystem.java new file mode 100644 index 000000000..042b4e173 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearRuleSystem.java @@ -0,0 +1,47 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.LinearRuleSystemGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Marker interface used by {@link LinearRuleSystemGroup}, + * expected implementers are RuleSystemSI and RuleSystemUS. + * + * @author Zack Pierce + */ +public interface LinearRuleSystem extends QtiNode { + public static final String DISPLAY_NAME = "LinearRuleSystem"; +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitSI.java new file mode 100644 index 000000000..88936780b --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitSI.java @@ -0,0 +1,89 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.util.HashMap; +import java.util.Map; + +/** + * Linear unit options in the SI system for Rule. + * + * @author Zack Pierce + */ +public enum LinearUnitSI implements Stringifiable { + MILLIMETER("Millimeter"), + + CENTIMETER("Centimeter"), + + METER("Meter"), + + KILOMETER("Kilometer"); + + private static final String QTI_CLASS_NAME = "SILinearValue"; + + private static Map namesToUnits; + + static { + final HashMap hashMap = new HashMap(); + for (final LinearUnitSI unit : LinearUnitSI.values()) { + hashMap.put(unit.unit, unit); + } + namesToUnits = ObjectUtilities.unmodifiableMap(hashMap); + } + + private String unit; + + private LinearUnitSI(final String unit) { + this.unit = unit; + } + + @Override + public String toQtiString() { + return unit; + } + + public static LinearUnitSI parseLinearUnitSI(final String linearUnitSI) throws QtiParseException { + final LinearUnitSI result = namesToUnits.get(linearUnitSI); + + if (result == null) { + throw new QtiParseException("Invalid " + QTI_CLASS_NAME + " '" + linearUnitSI + "'."); + } + + return result; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitUS.java new file mode 100644 index 000000000..3e13a2111 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/LinearUnitUS.java @@ -0,0 +1,89 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.util.HashMap; +import java.util.Map; + +/** + * Linear unit options in the US system for Rule. + * + * @author Zack Pierce + */ +public enum LinearUnitUS implements Stringifiable { + INCH("Inch"), + + FOOT("Foot"), + + YARD("Yard"), + + MILE("Mile"); + + private static final String QTI_CLASS_NAME = "USLinearValue"; + + private static Map namesToUnits; + + static { + final HashMap hashMap = new HashMap(); + for (final LinearUnitUS unit : LinearUnitUS.values()) { + hashMap.put(unit.unit, unit); + } + namesToUnits = ObjectUtilities.unmodifiableMap(hashMap); + } + + private String unit; + + private LinearUnitUS(final String unit) { + this.unit = unit; + } + + @Override + public String toQtiString() { + return unit; + } + + public static LinearUnitUS parseLinearUnitUS(final String linearUnitUS) throws QtiParseException { + final LinearUnitUS result = namesToUnits.get(linearUnitUS); + + if (result == null) { + throw new QtiParseException("Invalid " + QTI_CLASS_NAME + " '" + linearUnitUS + "'."); + } + + return result; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java new file mode 100644 index 000000000..2da822b60 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MajorIncrementLinearSI extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "majorIncrement"; + + public MajorIncrementLinearSI(final RuleSystemSI parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public LinearUnitSI parseUnit(final String unitAttributeValue) { + return LinearUnitSI.parseLinearUnitSI(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java new file mode 100644 index 000000000..83422feb3 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java @@ -0,0 +1,63 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MajorIncrementLinearUS extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "majorIncrement"; + + public MajorIncrementLinearUS(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public LinearUnitUS parseUnit(final String unitAttributeValue) { + return LinearUnitUS.parseLinearUnitUS(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java new file mode 100644 index 000000000..3e3d1cd1a --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MajorIncrementRadialSI extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "majorIncrement"; + + public MajorIncrementRadialSI(final RadialIncrementSystemSI parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public RadialUnitSI parseUnit(final String unitAttributeValue) { + return RadialUnitSI.parseRadialUnitSI(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java new file mode 100644 index 000000000..c73891d1a --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MajorIncrementRadialUS extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "majorIncrement"; + + public MajorIncrementRadialUS(final RadialIncrementSystemUS parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public RadialUnitUS parseUnit(final String unitAttributeValue) { + return RadialUnitUS.parseRadialUnitUS(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java new file mode 100644 index 000000000..04a9343b1 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; + +/** + * The minimum length of a Rule + * + * @author Zack Pierce + */ +public class MinimumLength extends SingleIntegerElement { + + private static final long serialVersionUID = -3099958433934984161L; + + public static final String QTI_CLASS_NAME = "minimumLength"; + + public MinimumLength(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java new file mode 100644 index 000000000..e97c8d4a6 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MinorIncrementLinearSI extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "minorIncrement"; + + public MinorIncrementLinearSI(final RuleSystemSI parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public LinearUnitSI parseUnit(final String unitAttributeValue) { + return LinearUnitSI.parseLinearUnitSI(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java new file mode 100644 index 000000000..e34d8ab95 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MinorIncrementLinearUS extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "minorIncrement"; + + public MinorIncrementLinearUS(final RuleSystemUS parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public LinearUnitUS parseUnit(final String unitAttributeValue) { + return LinearUnitUS.parseLinearUnitUS(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java new file mode 100644 index 000000000..f71dbca21 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MinorIncrementRadialSI extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "minorIncrement"; + + public MinorIncrementRadialSI(final RadialIncrementSystemSI parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public RadialUnitSI parseUnit(final String unitAttributeValue) { + return RadialUnitSI.parseRadialUnitSI(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java new file mode 100644 index 000000000..8c4376aa9 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java @@ -0,0 +1,61 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUUSNESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARIUSNG IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSUSBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class MinorIncrementRadialUS extends DecimalUnitElement { + + private static final long serialVersionUID = 8729041333872417927L; + + public static final String QTI_CLASS_NAME = "minorIncrement"; + + public MinorIncrementRadialUS(final RadialIncrementSystemUS parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) + */ + @Override + public RadialUnitUS parseUnit(final String unitAttributeValue) { + return RadialUnitUS.parseRadialUnitUS(unitAttributeValue); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java new file mode 100644 index 000000000..7bc69026c --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.NormalizedStringElement; + +/** + * A description of a physical material to be associated with (e.g. delivered alongside) + * the related content. + * + * @author Zack Pierce + */ +public class PhysicalMaterial extends NormalizedStringElement implements CompanionMaterial { + + private static final long serialVersionUID = 5563995507027859438L; + + public static final String QTI_CLASS_NAME = "physicalMaterial"; + + public PhysicalMaterial(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java new file mode 100644 index 000000000..174e40526 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java @@ -0,0 +1,84 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.RadialIncrementSystemGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class Protractor extends AbstractNode implements CompanionMaterial { + + private static final long serialVersionUID = 862855054032106527L; + + public static final String QTI_CLASS_NAME = "protractor"; + + public Protractor(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new DescriptionGroup(this, true)); + getNodeGroups().add(new RadialIncrementSystemGroup(this)); + } + + /** + * Convenience for retrieving the Description's textual content. + * @return + */ + public String getDescriptionText() { + return getNodeGroups().getDescriptionGroup().getDescriptionText(); + + } + + /** + * Convenience for setting the Description's textual content. + * @param descriptionText + */ + public void setDescriptionText(final String descriptionText) { + ; + getNodeGroups().getDescriptionGroup().setDescriptionText(descriptionText); + } + + public RadialIncrementSystemSI getRadialIncrementSystemSI() { + return getNodeGroups().getRadialIncrementSystemGroup().getRadialIncrementSystemSI(); + } + + public RadialIncrementSystemUS getRadialIncrementSystemUS() { + return getNodeGroups().getRadialIncrementSystemGroup().getRadialIncrementSystemUS(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystem.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystem.java new file mode 100644 index 000000000..0dab296a2 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystem.java @@ -0,0 +1,47 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.RadialIncrementSystemGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Marker interface used by {@link RadialIncrementSystemGroup}, + * expected implementers are RadialIncrementSystemSI and RadialIncrementSystemUS. + * + * @author Zack Pierce + */ +public interface RadialIncrementSystem extends QtiNode { + public static final String DISPLAY_NAME = "RadialIncrementSystem"; +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java new file mode 100644 index 000000000..cad387efc --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java @@ -0,0 +1,66 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialSIGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialSIGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class RadialIncrementSystemSI extends AbstractNode implements RadialIncrementSystem { + + private static final long serialVersionUID = 2377913760017151553L; + + public static final String QTI_CLASS_NAME = "incrementSI"; + + public RadialIncrementSystemSI(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new MinorIncrementRadialSIGroup(this)); + getNodeGroups().add(new MajorIncrementRadialSIGroup(this)); + } + + public MinorIncrementRadialSI getMinorIncrementRadialSI() { + return getNodeGroups().getMinorIncrementRadialSIGroup().getChild(); + } + + public MajorIncrementRadialSI getMajorIncrementRadialSI() { + return getNodeGroups().getMajorIncrementRadialSIGroup().getChild(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java new file mode 100644 index 000000000..b2116be01 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java @@ -0,0 +1,66 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialUSGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialUSGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class RadialIncrementSystemUS extends AbstractNode implements RadialIncrementSystem { + + private static final long serialVersionUID = 7573986330792238975L; + + public static final String QTI_CLASS_NAME = "incrementUS"; + + public RadialIncrementSystemUS(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new MinorIncrementRadialUSGroup(this)); + getNodeGroups().add(new MajorIncrementRadialUSGroup(this)); + } + + public MinorIncrementRadialUS getMinorIncrementRadialUS() { + return getNodeGroups().getMinorIncrementRadialUSGroup().getChild(); + } + + public MajorIncrementRadialUS getMajorIncrementRadialUS() { + return getNodeGroups().getMajorIncrementRadialUSGroup().getChild(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitSI.java new file mode 100644 index 000000000..ca57847ec --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitSI.java @@ -0,0 +1,83 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.util.HashMap; +import java.util.Map; + +/** + * Radial unit options in the SI system for Protractor. + * + * @author Zack Pierce + */ +public enum RadialUnitSI implements Stringifiable { + RADIAN("Radian"); + + private static final String QTI_CLASS_NAME = "RadialSIValue"; + + private static Map namesToUnits; + + static { + final HashMap hashMap = new HashMap(); + for (final RadialUnitSI unit : RadialUnitSI.values()) { + hashMap.put(unit.unit, unit); + } + namesToUnits = ObjectUtilities.unmodifiableMap(hashMap); + } + + private String unit; + + private RadialUnitSI(final String unit) { + this.unit = unit; + } + + @Override + public String toQtiString() { + return unit; + } + + public static RadialUnitSI parseRadialUnitSI(final String radialUnitSI) throws QtiParseException { + final RadialUnitSI result = namesToUnits.get(radialUnitSI); + + if (result == null) { + throw new QtiParseException("Invalid " + QTI_CLASS_NAME + " '" + radialUnitSI + "'."); + } + + return result; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitUS.java new file mode 100644 index 000000000..5add6d2d5 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialUnitUS.java @@ -0,0 +1,87 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.util.HashMap; +import java.util.Map; + +/** + * Radial unit options in the US system for Protractor. + * + * @author Zack Pierce + */ +public enum RadialUnitUS implements Stringifiable { + DEGREE("Degree"), + + MINUTE("Minute"), + + SECOND("Second"); + + private static final String QTI_CLASS_NAME = "RadialUSValue"; + + private static Map namesToUnits; + + static { + final HashMap hashMap = new HashMap(); + for (final RadialUnitUS unit : RadialUnitUS.values()) { + hashMap.put(unit.unit, unit); + } + namesToUnits = ObjectUtilities.unmodifiableMap(hashMap); + } + + private String unit; + + private RadialUnitUS(final String unit) { + this.unit = unit; + } + + @Override + public String toQtiString() { + return unit; + } + + public static RadialUnitUS parseRadialUnitUS(final String radialUnitUS) throws QtiParseException { + final RadialUnitUS result = namesToUnits.get(radialUnitUS); + + if (result == null) { + throw new QtiParseException("Invalid " + QTI_CLASS_NAME + " '" + radialUnitUS + "'."); + } + + return result; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java new file mode 100644 index 000000000..aa18e40db --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class ReadingPassage extends FileInfo implements CompanionMaterial { + + private static final long serialVersionUID = -2296060500631152438L; + + public static final String QTI_CLASS_NAME = "readingPassage"; + + public ReadingPassage(final QtiNode parent) { + super(parent, QTI_CLASS_NAME, false); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java new file mode 100644 index 000000000..c3fbffd78 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java @@ -0,0 +1,84 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.LinearRuleSystemGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class Rule extends AbstractNode implements CompanionMaterial { + + private static final long serialVersionUID = 7718173939741152563L; + + public static final String QTI_CLASS_NAME = "rule"; + + public Rule(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new DescriptionGroup(this, true)); + getNodeGroups().add(new LinearRuleSystemGroup(this)); + } + + /** + * Convenience for retrieving the Description's textual content. + * @return + */ + public String getDescriptionText() { + return getNodeGroups().getDescriptionGroup().getDescriptionText(); + + } + + /** + * Convenience for setting the Description's textual content. + * @param descriptionText + */ + public void setDescriptionText(final String descriptionText) { + ; + getNodeGroups().getDescriptionGroup().setDescriptionText(descriptionText); + } + + public RuleSystemSI getRuleSystemSI() { + return getNodeGroups().getLinearRuleSystemGroup().getRuleSystemSI(); + } + + public RuleSystemUS getRuleSystemUS() { + return getNodeGroups().getLinearRuleSystemGroup().getRuleSystemUS(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java new file mode 100644 index 000000000..ef3159091 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java @@ -0,0 +1,76 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementLinearSIGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinimumLengthGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearSIGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Linear measurement system using SI standards for a Rule material. + * + * @author Zack Pierce + */ +public class RuleSystemSI extends AbstractNode implements LinearRuleSystem { + + private static final long serialVersionUID = 3931136937331215221L; + + public static final String QTI_CLASS_NAME = "ruleSystemSI"; + + public RuleSystemSI(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new MinimumLengthGroup(this)); + getNodeGroups().add(new MinorIncrementLinearSIGroup(this)); + getNodeGroups().add(new MajorIncrementLinearSIGroup(this)); + } + + public MinimumLength getMinimumLength() { + return getNodeGroups().getMinimumLengthGroup().getMinimumLength(); + } + + public void setMinimumLength(final MinimumLength minimumLength) { + getNodeGroups().getMinimumLengthGroup().setMinimumLength(minimumLength); + } + + public MinorIncrementLinearSI getMinorIncrementLinearSI() { + return getNodeGroups().getMinorIncrementLinearSIGroup().getChild(); + } + + public MajorIncrementLinearSI getMajorIncrementLinearSI() { + return getNodeGroups().getMajorIncrementLinearSIGroup().getChild(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java new file mode 100644 index 000000000..1f6d5d265 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java @@ -0,0 +1,76 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementLinearUSGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinimumLengthGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearUSGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class RuleSystemUS extends AbstractNode implements LinearRuleSystem { + + private static final long serialVersionUID = 3204093022466226633L; + + public static final String QTI_CLASS_NAME = "ruleSystemUS"; + + public RuleSystemUS(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new MinimumLengthGroup(this)); + getNodeGroups().add(new MinorIncrementLinearUSGroup(this)); + getNodeGroups().add(new MajorIncrementLinearUSGroup(this)); + } + + public MinimumLength getMinimumLength() { + return getNodeGroups().getMinimumLengthGroup().getMinimumLength(); + } + + public void setMinimumLength(final MinimumLength minimumLength) { + getNodeGroups().getMinimumLengthGroup().setMinimumLength(minimumLength); + } + + public MinorIncrementLinearUS getMinorIncrementLinearUS() { + return getNodeGroups().getMinorIncrementLinearUSGroup().getChild(); + } + + public MajorIncrementLinearUS getMajorIncrementLinearUS() { + return getNodeGroups().getMajorIncrementLinearUSGroup().getChild(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java new file mode 100644 index 000000000..63e71c131 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class AslDefaultOrder extends ElementOrderList { + + private static final long serialVersionUID = -7164101127069073031L; + + public static final String QTI_CLASS_NAME = "aslDefaultOrder"; + + public AslDefaultOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java new file mode 100644 index 000000000..093b45a52 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class AslOnDemandOrder extends ElementOrderList { + + private static final long serialVersionUID = 642737172902802766L; + + public static final String QTI_CLASS_NAME = "aslOnDemandOrder"; + + public AslOnDemandOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java new file mode 100644 index 000000000..ecdf20ca3 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class BrailleDefaultOrder extends ElementOrderList { + + private static final long serialVersionUID = -3913991997025492985L; + + public static final String QTI_CLASS_NAME = "brailleDefaultOrder"; + + public BrailleDefaultOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java new file mode 100644 index 000000000..7b7cf6445 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java @@ -0,0 +1,85 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierReferenceAttribute; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.types.Identifier; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import org.w3c.dom.Element; + +/** + * A reference to an accessElement by identifier, and the intended order that accessElement's + * accessibility content should be presented according to the present enclosing ElementOrderList. + * + * @author Zack Pierce + */ +public class ElementOrder extends AbstractNode { + + private static final long serialVersionUID = -410983290920433202L; + + public static final String QTI_CLASS_NAME = "elementOrder"; + + private Integer order; + + public ElementOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getAttributes().add(new IdentifierReferenceAttribute(this, "identifierRef", true)); + } + + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + order = XmlParseUtils.getChildContentAsInteger(element, "order"); + } + + public Identifier getIdentifierRef() { + return getAttributes().getIdentifierRefAttribute("identifierRef").getValue(); + } + + public void setIdentifierRef(final Identifier value) { + getAttributes().getIdentifierAttribute("identifierRef").setValue(value); + } + + public Integer getOrder() { + return order; + } + + public void setOrder(final Integer order) { + this.order = order; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java new file mode 100644 index 000000000..a5ac90a6b --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java @@ -0,0 +1,59 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.ElementOrderGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import java.util.List; + +/** + * Base class for the element order lists found as children within InclusionOrder. + * + * @author Zack Pierce + */ +public abstract class ElementOrderList extends AbstractNode { + + private static final long serialVersionUID = 4302185581837683599L; + + public ElementOrderList(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + getNodeGroups().add(new ElementOrderGroup(this)); + } + + public List getElementOrders() { + return getNodeGroups().getElementOrderGroup().getChildren(); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderListType.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderListType.java new file mode 100644 index 000000000..52812b438 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderListType.java @@ -0,0 +1,178 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.exception.QtiIllegalChildException; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +/** + * All the standard element order lists that may be found in an + * apip:inclusionOrder. + * + * @author Zack Pierce + */ +public enum ElementOrderListType { + ASL_DEFAULT_ORDER(AslDefaultOrder.QTI_CLASS_NAME, AslDefaultOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new AslDefaultOrder(parent); + } + }, + + ASL_ON_DEMAND_ORDER(AslOnDemandOrder.QTI_CLASS_NAME, AslOnDemandOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new AslOnDemandOrder(parent); + } + }, + + BRAILLE_DEFAULT_ORDER(BrailleDefaultOrder.QTI_CLASS_NAME, BrailleDefaultOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new BrailleDefaultOrder(parent); + } + }, + + GRAPHICS_ONLY_ON_DEMAND_ORDER(GraphicsOnlyOnDemandOrder.QTI_CLASS_NAME, GraphicsOnlyOnDemandOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new GraphicsOnlyOnDemandOrder(parent); + } + }, + + NON_VISUAL_DEFAULT_ORDER(NonVisualDefaultOrder.QTI_CLASS_NAME, NonVisualDefaultOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new NonVisualDefaultOrder(parent); + } + }, + + SIGNED_ENGLISH_DEFAULT_ORDER(SignedEnglishDefaultOrder.QTI_CLASS_NAME, SignedEnglishDefaultOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new SignedEnglishDefaultOrder(parent); + } + }, + + SIGNED_ENGLISH_ON_DEMAND_ORDER(SignedEnglishOnDemandOrder.QTI_CLASS_NAME, SignedEnglishOnDemandOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new SignedEnglishOnDemandOrder(parent); + } + }, + + TEXT_GRAPHICS_DEFAULT_ORDER(TextGraphicsDefaultOrder.QTI_CLASS_NAME, TextGraphicsDefaultOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new TextGraphicsDefaultOrder(parent); + } + }, + + TEXT_GRAPHICS_ON_DEMAND_ORDER(TextGraphicsOnDemandOrder.QTI_CLASS_NAME, TextGraphicsOnDemandOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new TextGraphicsOnDemandOrder(parent); + } + }, + + TEXT_ONLY_DEFAULT_ORDER(TextOnlyDefaultOrder.QTI_CLASS_NAME, TextOnlyDefaultOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new TextOnlyDefaultOrder(parent); + } + }, + + TEXT_ONLY_ON_DEMAND_ORDER(TextOnlyOnDemandOrder.QTI_CLASS_NAME, TextOnlyOnDemandOrder.class) { + + @Override + public ElementOrderList create(final InclusionOrder parent) { + return new TextOnlyOnDemandOrder(parent); + } + }; + + public static final String DISPLAY_NAME = "StandardElementOrderListType"; + + private static Map elementOrderListNameToTypes; + + static { + elementOrderListNameToTypes = new HashMap(); + for (final ElementOrderListType type : ElementOrderListType.values()) { + elementOrderListNameToTypes.put(type.qtiClassName, type); + } + + } + + private String qtiClassName; + + private Class clazz; + + ElementOrderListType(final String type, final Class clazz) { + this.qtiClassName = type; + this.clazz = clazz; + } + + public abstract ElementOrderList create(InclusionOrder parent); + + public Class getClazz() { + return clazz; + } + + public static ElementOrderList getElementOrderListInstance(final InclusionOrder parent, final String qtiClassName) { + final ElementOrderListType elementOrderListType = elementOrderListNameToTypes.get(qtiClassName); + + if (elementOrderListType == null) { + throw new QtiIllegalChildException(parent, qtiClassName); + } + + return elementOrderListType.create(parent); + + } + + public static Set getElementOrderListNames() { + return elementOrderListNameToTypes.keySet(); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java new file mode 100644 index 000000000..9394bf92d --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class GraphicsOnlyOnDemandOrder extends ElementOrderList { + + private static final long serialVersionUID = -8890598866649354931L; + + public static final String QTI_CLASS_NAME = "graphicsOnlyOnDemandOrder"; + + public GraphicsOnlyOnDemandOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java new file mode 100644 index 000000000..3ffc18b95 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java @@ -0,0 +1,106 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.StandardElementOrderListGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class InclusionOrder extends AbstractNode { + + private static final long serialVersionUID = -1269503851231233625L; + + public static final String QTI_CLASS_NAME = "inclusionOrder"; + + public InclusionOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new StandardElementOrderListGroup(this)); + // TODO : extension point for 3rd party lists... + } + + private StandardElementOrderListGroup getStandardElementOrderListGroup() { + return getNodeGroups().getStandardElementOrderListGroup(); + } + + public AslDefaultOrder getAslDefaultOrder() { + return getStandardElementOrderListGroup().getAslDefaultOrder(); + } + + public AslOnDemandOrder getAslOnDemandOrder() { + return getStandardElementOrderListGroup().getAslOnDemandOrder(); + } + + public BrailleDefaultOrder getBrailleDefaultOrder() { + return getStandardElementOrderListGroup().getBrailleDefaultOrder(); + } + + public GraphicsOnlyOnDemandOrder getGraphicsOnlyOnDemandOrder() { + return getStandardElementOrderListGroup().getGraphicsOnlyOnDemandOrder(); + } + + public NonVisualDefaultOrder getNonVisualDefaultOrder() { + return getStandardElementOrderListGroup().getNonVisualDefaultOrder(); + } + + public SignedEnglishDefaultOrder getSignedEnglishDefaultOrder() { + return getStandardElementOrderListGroup().getSignedEnglishDefaultOrder(); + } + + public SignedEnglishOnDemandOrder getSignedEnglishOnDemandOrder() { + return getStandardElementOrderListGroup().getSignedEnglishOnDemandOrder(); + } + + public TextGraphicsDefaultOrder getTextGraphicsDefaultOrder() { + return getStandardElementOrderListGroup().getTextGraphicsDefaultOrder(); + } + + public TextGraphicsOnDemandOrder getTextGraphicsOnDemandOrder() { + return getStandardElementOrderListGroup().getTextGraphicsOnDemandOrder(); + } + + public TextOnlyDefaultOrder getTextOnlyDefaultOrder() { + return getStandardElementOrderListGroup().getTextOnlyDefaultOrder(); + } + + public TextOnlyOnDemandOrder getTextOnlyOnDemandOrder() { + return getStandardElementOrderListGroup().getTextOnlyOnDemandOrder(); + } + + // TODO - consider adding setters for standard element order lists? +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java new file mode 100644 index 000000000..3391de9e5 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class NonVisualDefaultOrder extends ElementOrderList { + + private static final long serialVersionUID = -3218765627881854346L; + + public static final String QTI_CLASS_NAME = "nonVisualDefaultOrder"; + + public NonVisualDefaultOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java new file mode 100644 index 000000000..e96131e31 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class SignedEnglishDefaultOrder extends ElementOrderList { + + private static final long serialVersionUID = 6278519403559059969L; + + public static final String QTI_CLASS_NAME = "signedEnglishDefaultOrder"; + + public SignedEnglishDefaultOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java new file mode 100644 index 000000000..0371d27f7 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class SignedEnglishOnDemandOrder extends ElementOrderList { + + private static final long serialVersionUID = 535478176905195639L; + + public static final String QTI_CLASS_NAME = "signedEnglishOnDemandOrder"; + + public SignedEnglishOnDemandOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java new file mode 100644 index 000000000..2995badb6 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class TextGraphicsDefaultOrder extends ElementOrderList { + + private static final long serialVersionUID = -8171599174282644231L; + + public static final String QTI_CLASS_NAME = "textGraphicsDefaultOrder"; + + public TextGraphicsDefaultOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java new file mode 100644 index 000000000..c939d7b43 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class TextGraphicsOnDemandOrder extends ElementOrderList { + + private static final long serialVersionUID = -3675282225304964651L; + + public static final String QTI_CLASS_NAME = "textGraphicsOnDemandOrder"; + + public TextGraphicsOnDemandOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java new file mode 100644 index 000000000..7b8db6ce6 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class TextOnlyDefaultOrder extends ElementOrderList { + + private static final long serialVersionUID = 6428229054625877043L; + + public static final String QTI_CLASS_NAME = "textOnlyDefaultOrder"; + + public TextOnlyDefaultOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java new file mode 100644 index 000000000..192df574f --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class TextOnlyOnDemandOrder extends ElementOrderList { + + private static final long serialVersionUID = 6625518889535555113L; + + public static final String QTI_CLASS_NAME = "textOnlyOnDemandOrder"; + + public TextOnlyOnDemandOrder(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java new file mode 100644 index 000000000..524d81749 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class CharacterLink extends SingleIntegerElement implements StringLink { + + private static final long serialVersionUID = 6422961217240087811L; + + public static final String QTI_CLASS_NAME = "characterLink"; + + public CharacterLink(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java new file mode 100644 index 000000000..b1fd23b8e --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java @@ -0,0 +1,116 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class CharacterStringLink extends AbstractNode implements StringLink { + + private static final long serialVersionUID = 4994298956888418294L; + + public static final String QTI_CLASS_NAME = "characterStringLink"; + + private Integer startCharacter; + + private Integer stopCharacter; + + public CharacterStringLink(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, + * uk.ac.ed.ph.jqtiplus.node.LoadingContext) + */ + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + startCharacter = XmlParseUtils.getChildContentAsInteger(element, "startCharacter"); + stopCharacter = XmlParseUtils.getChildContentAsInteger(element, "stopCharacter"); + } + + /* + * (non-Javadoc) + * + * @see + * uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) + */ + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + // TODO : Special handling for outputting our flattened simple elements, startCharacter and stopCharacter. + super.fireBodySaxEvents(qtiSaxDocumentFirer); + } + + /** + * @return the starting character position in the linked text. + */ + public Integer getStartCharacter() { + return startCharacter; + } + + /** + * @param startCharacter the starting character position in the linked text. + */ + public void setStartCharacter(final Integer startCharacter) { + this.startCharacter = startCharacter; + } + + /** + * @return the last included character position in the linked text. + */ + public Integer getStopCharacter() { + return stopCharacter; + } + + /** + * @param stopCharacter the last included character position in the linked text. + */ + public void setStopCharacter(final Integer stopCharacter) { + this.stopCharacter = stopCharacter; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java new file mode 100644 index 000000000..fbd80b932 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java @@ -0,0 +1,97 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierReferenceAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.LinkGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.types.Identifier; +import uk.ac.ed.ph.jqtiplus.validation.ValidationContext; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class ContentLinkInfo extends AbstractNode { + + private static final long serialVersionUID = -3814738853269263616L; + + public static final String QTI_CLASS_NAME = "contentLinkInfo"; + + private static final String ATTR_APIP_LINK_IDENTIFIER_REF = "apipLinkIdentifierRef"; + + private static final String ATTR_QTI_LINK_IDENTIFIER_REF = "qtiLinkIdentifierRef"; + + public ContentLinkInfo(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getAttributes().add(new IdentifierReferenceAttribute(this, ATTR_QTI_LINK_IDENTIFIER_REF, false)); + getAttributes().add(new IdentifierReferenceAttribute(this, ATTR_APIP_LINK_IDENTIFIER_REF, false)); + getNodeGroups().add(new LinkGroup(this)); + } + + public Identifier getQtiLinkIdentifierRef() { + return getAttributes().getIdentifierRefAttribute(ATTR_QTI_LINK_IDENTIFIER_REF).getValue(); + } + + public Identifier getApipLinkIdentifierRef() { + return getAttributes().getIdentifierRefAttribute(ATTR_APIP_LINK_IDENTIFIER_REF).getValue(); + } + + /** + * @return the optional {@link ObjectLink} child, or null if it does not exist. + */ + public ObjectLink getObjectLink() { + return getNodeGroups().getLinkGroup().getObjectLink(); + } + + /** + * @return the optional {@link TextLink} child, or null if it does not exist. + */ + public TextLink getTextLink() { + return getNodeGroups().getLinkGroup().getTextLink(); + } + + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#validateThis(uk.ac.ed.ph.jqtiplus.validation.ValidationContext) + */ + @Override + protected void validateThis(final ValidationContext context) { + // TODO : validate that either the qtiLinkIdentifierRef or the apipLinkIdentifierRef attribute has a value + super.validateThis(context); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java new file mode 100644 index 000000000..78aa9f7c2 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class FullString extends EmptyElement implements StringLink { + + private static final long serialVersionUID = -1557676888910066274L; + + public static final String QTI_CLASS_NAME = "fullString"; + + public FullString(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/Link.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/Link.java new file mode 100644 index 000000000..e6fb72583 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/Link.java @@ -0,0 +1,49 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.LinkGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Marker interface for {@link LinkGroup}. + * TextLink and ObjectLink are the only expected implementers. + * + * (Not part of the QTI/APIP spec) + * + * @author Zack Pierce + */ +public interface Link extends QtiNode { + public static String DISPLAY_NAME = "objectLinkOrTextLink"; +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java new file mode 100644 index 000000000..82bcd6a8d --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; + +/** + * A link to the entirety of the identifier-referenced content element. + * + * @author Zack Pierce + */ +public class ObjectLink extends EmptyElement implements Link { + + private static final long serialVersionUID = 4938414147445323246L; + + public static final String QTI_CLASS_NAME = "objectLink"; + + public ObjectLink(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/StringLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/StringLink.java new file mode 100644 index 000000000..229e8c2fa --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/StringLink.java @@ -0,0 +1,51 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.StringLinkGroup; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Marker interface for {@link StringLinkGroup} , the set of options + * found as children within a TextLink: + * FullString, WordLink, CharacterLink, CharacterStringLink. + * + * (Not part of the QTI/APIP spec) + * + * + * @author Zack Pierce + */ +public interface StringLink extends QtiNode { + public final static String DISPLAY_NAME = "StringLinkGroup"; +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java new file mode 100644 index 000000000..cf6a6720f --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java @@ -0,0 +1,97 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.link.StringLinkGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * A link to the textual portion of the identifier-referenced content element. + * + *

The particular portion of the text referenced is controlled by the child elements: + * {@link CharacterLink}, {@link CharacterStringLink}, {@link FullString}, + * and {@link WordLink}.

+ * + *

TODO : Add convenience setters for the child options

+ * + * @author Zack Pierce + */ +public class TextLink extends AbstractNode implements Link { + + private static final long serialVersionUID = 7765175490211170308L; + + public static final String QTI_CLASS_NAME = "textLink"; + + public TextLink(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new StringLinkGroup(this)); + } + + /** + * @return the optional {@link CharacterLink} child, or null if it does not exist. + */ + public CharacterLink getCharacterLink() { + return getNodeGroups().getStringLinkGroup().getCharacterLink(); + } + + /** + * @return the optional {@link CharacterStringLink} child, or null if it does not exist. + */ + public CharacterStringLink getCharacterStringLink() { + return getNodeGroups().getStringLinkGroup().getCharacterStringLink(); + } + + /** + * @return the optional {@link WordLink} child, or null if it does not exist. + */ + public WordLink getWordLink() { + return getNodeGroups().getStringLinkGroup().getWordLink(); + } + + /** + * @return the optional {@link FullString} child, or null if it does not exist. + */ + public FullString getFullString() { + return getNodeGroups().getStringLinkGroup().getFullString(); + } + + /** + * Convenience for checking whether this TextLink contains a FullString child. + * @return true if the FullString child is non-null, false otherwise. + */ + public boolean hasFullString() { + return getFullString() != null; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java new file mode 100644 index 000000000..7ffe807bd --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java @@ -0,0 +1,54 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class WordLink extends SingleIntegerElement implements StringLink { + + private static final long serialVersionUID = -5938900918101611503L; + + public static final String QTI_CLASS_NAME = "wordLink"; + + public WordLink(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java new file mode 100644 index 000000000..eb351578e --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java @@ -0,0 +1,66 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RemoveTagGroupGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import java.util.List; + +/** + * Container for the instructions on how answer reduction is to be achieved. + * The reduction process is defined in terms of groups that are handled separately. + * + *

TODO : Mark as Experimental. + * This is a very incomplete and not fully thought out structure + * in the XML schema. + * + * @author Zack Pierce + */ +public class AnswerReduction extends AbstractNode { + + private static final long serialVersionUID = 1659866116384977816L; + public static final String QTI_CLASS_NAME = "answerReduction"; + + public AnswerReduction(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new RemoveTagGroupGroup(this)); + } + + public List getRemoveTagGroups() { + return getNodeGroups().getRemoveTagGroupGroup().getRemoveTagGroups(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java new file mode 100644 index 000000000..aef745f88 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java @@ -0,0 +1,147 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import java.util.Calendar; + +import org.w3c.dom.Element; + +/** + * Container for the accessibility content contained in an external audio file. + * + * The start and durations are supplied so that one audio file can be used + * to support more than one accessibility element. + * + * @author Zack Pierce + */ +public class AudioFileInfo extends ObjectFileInfo implements ContentLinkIdentifierBearer { + + private static final long serialVersionUID = -6758112561134526415L; + + public static final String QTI_CLASS_NAME = "audioFileInfo"; + + private static final String ELEM_START_TIME = "startTime"; + private static final String ELEM_DURATION = "duration"; + + private VoiceType voiceType; + + private VoiceSpeed voiceSpeed; + + // TODO - consider using Joda-Time's LocalTime rather than Calendar, since xsd:time is date-less. + private Calendar startTime; + + private Calendar duration; + + public AudioFileInfo(final QtiNode parent) { + super(parent, QTI_CLASS_NAME, true); + } + + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + super.loadChildren(element, context); + final String rawVoiceType = XmlParseUtils.getChildContent(element, VoiceType.QTI_CLASS_NAME); + try { + this.voiceType = rawVoiceType != null ? VoiceType.parseVoiceType(rawVoiceType) : VoiceType.SYNTHETIC; + } + catch (final QtiParseException e) { + context.modelBuildingError(e, element); + } + final String rawVoiceSpeed = XmlParseUtils.getChildContent(element, VoiceSpeed.QTI_CLASS_NAME); + try { + this.voiceSpeed = rawVoiceSpeed != null ? VoiceSpeed.parseVoiceSpeed(rawVoiceSpeed) : VoiceSpeed.STANDARD; + } + catch (final QtiParseException e) { + context.modelBuildingError(e, element); + } + + final String rawStartTime = XmlParseUtils.getChildContent(element, ELEM_START_TIME); + if (rawStartTime != null) { + try { + this.startTime = DataTypeBinder.parseTime(rawStartTime); + } + catch (final QtiParseException e) { + context.modelBuildingError(e, element); + } + } + final String rawDuration = XmlParseUtils.getChildContent(element, ELEM_DURATION); + if (rawDuration != null) { + try { + this.duration = DataTypeBinder.parseTime(rawDuration); + } + catch (final QtiParseException e) { + context.modelBuildingError(e, element); + } + } + + } + + public VoiceType getVoiceType() { + return voiceType; + } + + public void setVoiceType(final VoiceType voiceType) { + this.voiceType = voiceType; + } + + public VoiceSpeed getVoiceSpeed() { + return voiceSpeed; + } + + public void setVoiceSpeed(final VoiceSpeed voiceSpeed) { + this.voiceSpeed = voiceSpeed; + } + + public Calendar getStartTime() { + return startTime; + } + + public void setStartTime(final Calendar startTime) { + this.startTime = startTime; + } + + public Calendar getDuration() { + return duration; + } + + public void setDuration(final Calendar duration) { + this.duration = duration; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java new file mode 100644 index 000000000..603d07784 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java @@ -0,0 +1,70 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Container for content relevant to the presentation of braille. + * + *

TODO : Consider flattening representation, since currently BrailleText + * is only a wrapper for BrailleTextString with no added value beyond ease + * of mapping to the XML. + * + * @author Zack Pierce + */ +public class BrailleText extends AbstractNode { + + private static final long serialVersionUID = 5477136156238256916L; + + public static final String QTI_CLASS_NAME = "brailleText"; + + public static final String ELEM_BRAILLE_TEXT_STRING = "brailleTextString"; + + public BrailleText(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_BRAILLE_TEXT_STRING, true)); + } + + public LabelledString getBrailleTextString() { + return getNodeGroups().getBrailleTextStringGroup().getLabelledString(); + } + + public void setBrailleTextString(final LabelledString brailleTextString) { + getNodeGroups().getBrailleTextStringGroup().setLabelledString(brailleTextString); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java new file mode 100644 index 000000000..faebcf15f --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class Chunk extends EmptyElement { + + private static final long serialVersionUID = -6305016529747908312L; + + public static final String QTI_CLASS_NAME = "chunk"; + + public Chunk(final RelatedElementInfo parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ContentLinkIdentifierBearer.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ContentLinkIdentifierBearer.java new file mode 100644 index 000000000..251f25c0e --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ContentLinkIdentifierBearer.java @@ -0,0 +1,50 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.types.Identifier; + +/** + * Marker interface for retrieving the standard identifier for accessibility metacontent. + * + * @author Zack Pierce + */ +public interface ContentLinkIdentifierBearer { + + public static final String ATTR_CONTENT_LINK_IDENTIFIER = "contentLinkIdentifier"; + + public Identifier getContentLinkIdentifier(); + + public void setContentLinkIdentifier(final Identifier identifier); +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java new file mode 100644 index 000000000..2c7c0e709 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java @@ -0,0 +1,80 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import javax.xml.XMLConstants; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class DefinitionId extends AbstractNode { + + private static final long serialVersionUID = 5046067935847319414L; + + public static final String QTI_CLASS_NAME = "definitionId"; + + private static final String ATTR_LANG_NAME = "lang"; + + private static final String ELEM_TEXT_STRING = "textString"; + + public DefinitionId(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getAttributes().add(new StringAttribute(this, ATTR_LANG_NAME, XMLConstants.XML_NS_URI, null, true)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_TEXT_STRING, true)); + } + + public String getLang() { + return ((StringAttribute) getAttributes().get(ATTR_LANG_NAME, XMLConstants.XML_NS_URI)).getValue(); + } + + public void setLang(final String lang) { + ((StringAttribute) getAttributes().get(ATTR_LANG_NAME, XMLConstants.XML_NS_URI)).setValue(lang); + } + + public LabelledString getTextString() { + return getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).getLabelledString(); + } + + public void setTextString(final LabelledString labelledString) { + getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).setLabelledString(labelledString); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java new file mode 100644 index 000000000..d9571d7e8 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java @@ -0,0 +1,77 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.GuidanceSupportGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Container for the content to provide guidance through the original material. + * + * The guidance takes the form of supporting language learners and those requiring cognitive guidance. + * + * @author Zack Pierce + */ +public class Guidance extends AbstractNode { + + private static final long serialVersionUID = -7537570999760584634L; + + private static final String ELEM_LANGUAGE_LEARNER_SUPPORT = "languageLearnerSupport"; + private static final String ELEM_COGNITIVE_GUIDANCE_SUPPORT = "cognitiveGuidanceSupport"; + + public static final String QTI_CLASS_NAME = "guidance"; + + public Guidance(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new GuidanceSupportGroup(this, ELEM_LANGUAGE_LEARNER_SUPPORT)); + getNodeGroups().add(new GuidanceSupportGroup(this, ELEM_COGNITIVE_GUIDANCE_SUPPORT)); + } + + public GuidanceSupport getLanguageLearnerSupport() { + return getNodeGroups().getGuidanceSupportGroup(ELEM_LANGUAGE_LEARNER_SUPPORT).getGuidanceSupport(); + } + + public void setLanguageLearnerSupport(final GuidanceSupport guidanceSupport) { + getNodeGroups().getGuidanceSupportGroup(ELEM_LANGUAGE_LEARNER_SUPPORT).setGuidanceSupport(guidanceSupport); + } + + public GuidanceSupport getCognitiveGuidanceSupport() { + return getNodeGroups().getGuidanceSupportGroup(ELEM_COGNITIVE_GUIDANCE_SUPPORT).getGuidanceSupport(); + } + + public void setCognitiveGuidanceSupport(final GuidanceSupport guidanceSupport) { + getNodeGroups().getGuidanceSupportGroup(ELEM_COGNITIVE_GUIDANCE_SUPPORT).setGuidanceSupport(guidanceSupport); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java new file mode 100644 index 000000000..19abd15a9 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java @@ -0,0 +1,80 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; + +/** + * Container for the definition of the order in which the guidance is to be presented and the text string used as part of the guidance. + * + * @author Zack Pierce + */ +public class GuidanceSupport extends AbstractNode { + + private static final String ELEM_TEXT_STRING = "textString"; + private static final String ELEM_SUPPORT_ORDER = "supportOrder"; + + private static final long serialVersionUID = 3407187991826466361L; + + public GuidanceSupport(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + getNodeGroups().add(new SingleIntegerElementGroup(this, ELEM_SUPPORT_ORDER, true)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_TEXT_STRING, true)); + } + + public LabelledString getTextString() { + return getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).getLabelledString(); + } + + public void setTextString(final LabelledString textString) { + getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).setLabelledString(textString); + } + + /** + * The order in which the guidance is to be presented, since guidance accessibility metacontent + * do not have direct representation in a distinct ElementOrderList within {@link InclusionOrder} + */ + public Integer getSupportOrder() { + return getNodeGroups().getSingleIntegerElementGroup(ELEM_SUPPORT_ORDER).getInteger(); + } + + public void setSupportOrder(final Integer supportOrder) { + getNodeGroups().getSingleIntegerElementGroup(ELEM_SUPPORT_ORDER).setInteger(supportOrder); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java new file mode 100644 index 000000000..d760d0f9f --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java @@ -0,0 +1,53 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; + +/** + * Represents a need for the related content to be emphasized. + * + * @author Zack Pierce + */ +public class KeyWordEmphasis extends EmptyElement { + + private static final long serialVersionUID = -5063781232556512932L; + + public static final String QTI_CLASS_NAME = "keyWordEmphasis"; + + public KeyWordEmphasis(final RelatedElementInfo parent) { + super(parent, QTI_CLASS_NAME); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java new file mode 100644 index 000000000..d7b6f5a48 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java @@ -0,0 +1,65 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.DefinitionIdGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import java.util.List; + +/** + * Container for the keyword translation text content. Support for multiple languages is provided. + * + *

TODO : Consider flattening representation, since currently KeyWordTranslation + * is only a wrapper for a list of {@link DefinitionId} with no added value beyond ease + * of mapping to the XML. + * + * @author Zack Pierce + */ +public class KeyWordTranslation extends AbstractNode { + + private static final long serialVersionUID = -5539729363209564169L; + public static final String QTI_CLASS_NAME = "keyWordTranslation"; + + public KeyWordTranslation(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new DefinitionIdGroup(this)); + } + + public List getDefinitionIds() { + return getNodeGroups().getDefinitionIdGroup().getDefinitionIds(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java new file mode 100644 index 000000000..60796f649 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java @@ -0,0 +1,99 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; +import uk.ac.ed.ph.jqtiplus.types.Identifier; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * Helper base class for elements containing textual body contents and a contentLinkIdentifier attribute. + * + * @author Zack Pierce + */ +public class LabelledString extends AbstractNode implements ContentLinkIdentifierBearer { + + private static final long serialVersionUID = 721887805676767346L; + + private String textContent; + + public LabelledString(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + getAttributes().add( + new IdentifierAttribute(this, ContentLinkIdentifierBearer.ATTR_CONTENT_LINK_IDENTIFIER, true)); + } + + @Override + public Identifier getContentLinkIdentifier() { + return getAttributes().getIdentifierAttribute(ContentLinkIdentifierBearer.ATTR_CONTENT_LINK_IDENTIFIER) + .getValue(); + } + + @Override + public void setContentLinkIdentifier(final Identifier identifier) { + getAttributes().getIdentifierAttribute(ContentLinkIdentifierBearer.ATTR_CONTENT_LINK_IDENTIFIER).setValue( + identifier); + } + + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + this.textContent = XmlParseUtils.getDirectTextualContent(element); + } + + @Override + public boolean hasChildNodes() { + return false; + } + + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + qtiSaxDocumentFirer.fireText(textContent); + } + + public String getTextContent() { + return textContent; + } + + public void setTextContent(final String textContent) { + this.textContent = textContent; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java new file mode 100644 index 000000000..60d3596b7 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java @@ -0,0 +1,57 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Container for the alternative markup content i.e.the markup is embedded in the instance file. + * + *

TODO : Mark as Experimental + * + * @author Zack Pierce + */ +public class MarkupFileEmbedded extends AbstractNode { + + private static final long serialVersionUID = -1156517878936311554L; + + public static final String QTI_CLASS_NAME = "markupFileEmbedded"; + + public MarkupFileEmbedded(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + // TODO : allow any elements in a different namespace + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java new file mode 100644 index 000000000..e6ed3efee --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java @@ -0,0 +1,72 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; +import uk.ac.ed.ph.jqtiplus.types.Identifier; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class ObjectFileInfo extends FileInfo implements ContentLinkIdentifierBearer { + + private static final long serialVersionUID = -4239752002593493052L; + + public ObjectFileInfo(final QtiNode parent, final String qtiClassName) { + this(parent, qtiClassName, false); + } + + public ObjectFileInfo(final QtiNode parent, final String qtiClassName, final boolean mimeTypeRequired) { + super(parent, qtiClassName, mimeTypeRequired); + getAttributes().add( + new IdentifierAttribute(this, ContentLinkIdentifierBearer.ATTR_CONTENT_LINK_IDENTIFIER, true)); + } + + @Override + public Identifier getContentLinkIdentifier() { + return getAttributes().getIdentifierAttribute(ContentLinkIdentifierBearer.ATTR_CONTENT_LINK_IDENTIFIER) + .getValue(); + } + + @Override + public void setContentLinkIdentifier(final Identifier identifier) { + getAttributes().getIdentifierAttribute(ContentLinkIdentifierBearer.ATTR_CONTENT_LINK_IDENTIFIER).setValue( + identifier); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java new file mode 100644 index 000000000..b5c895e16 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java @@ -0,0 +1,174 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AnswerReductionGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.BrailleTextGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ChunkGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.GuidanceGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.KeyWordEmphasisGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.KeyWordTranslationGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RevealAlternativeRepresentationGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ScaffoldGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SigningGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SpokenGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.StructuredMaskGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.TactileFileGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Container for all actual accessibility metacontent within a given accessElement + * + * @author Zack Pierce + */ +public class RelatedElementInfo extends AbstractNode { + + private static final long serialVersionUID = -3694130873474050407L; + + public static final String QTI_CLASS_NAME = "relatedElementInfo"; + + public RelatedElementInfo(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new SpokenGroup(this)); + getNodeGroups().add(new BrailleTextGroup(this)); + getNodeGroups().add(new TactileFileGroup(this)); + getNodeGroups().add(new SigningGroup(this)); + getNodeGroups().add(new KeyWordEmphasisGroup(this)); + getNodeGroups().add(new ChunkGroup(this)); + getNodeGroups().add(new KeyWordTranslationGroup(this)); + getNodeGroups().add(new RevealAlternativeRepresentationGroup(this)); + getNodeGroups().add(new GuidanceGroup(this)); + getNodeGroups().add(new StructuredMaskGroup(this)); + getNodeGroups().add(new ScaffoldGroup(this)); + getNodeGroups().add(new AnswerReductionGroup(this)); + } + + public Spoken getSpoken() { + return getNodeGroups().getSpokenGroup().getSpoken(); + } + + public void setSpoken(final Spoken spoken) { + getNodeGroups().getSpokenGroup().setSpoken(spoken); + } + + public BrailleText getBrailleText() { + return getNodeGroups().getBrailleTextGroup().getBrailleText(); + } + + public void setBrailleText(final BrailleText brailleText) { + getNodeGroups().getBrailleTextGroup().setBrailleText(brailleText); + } + + public TactileFile getTactileFile() { + return getNodeGroups().getTactileFileGroup().getTactileFile(); + } + + public void setTactileFile(final TactileFile tactileFile) { + getNodeGroups().getTactileFileGroup().setTactileFile(tactileFile); + } + + public boolean getKeyWordEmphasis() { + return getNodeGroups().getKeyWordEmphasisGroup().hasKeyWordEmphasis(); + } + + public void setKeyWordEmphasis(final boolean chunk) { + getNodeGroups().getKeyWordEmphasisGroup().setHasKeyWordEmphasis(chunk); + } + + public boolean getChunk() { + return getNodeGroups().getChunkGroup().hasChunk(); + } + + public void setChunk(final boolean chunk) { + getNodeGroups().getChunkGroup().setHasChunk(chunk); + } + + public Signing getSigning() { + return getNodeGroups().getSigningGroup().getSigning(); + } + + public void setSigning(final Signing signing) { + getNodeGroups().getSigningGroup().setSigning(signing); + } + + public KeyWordTranslation getKeyWordTranslation() { + return getNodeGroups().getKeyWordTranslationGroup().getKeyWordTranslation(); + } + + public void setKeyWordTranslation(final KeyWordTranslation keyWordTranslation) { + getNodeGroups().getKeyWordTranslationGroup().setKeyWordTranslation(keyWordTranslation); + } + + public RevealAlternativeRepresentation getRevealAlternativeRepresentation() { + return getNodeGroups().getRevealAlternativeRepresentationGroup().getRevealAlternativeRepresentation(); + } + + public void setRevealAlternativeRepresentation(final RevealAlternativeRepresentation revealAlternativeRepresentation) { + getNodeGroups().getRevealAlternativeRepresentationGroup().setRevealAlternativeRepresentation( + revealAlternativeRepresentation); + } + + public Guidance getGuidance() { + return getNodeGroups().getGuidanceGroup().getGuidance(); + } + + public void setGuidance(final Guidance guidance) { + getNodeGroups().getGuidanceGroup().setGuidance(guidance); + } + + public StructuredMask getStructuredMask() { + return getNodeGroups().getStructuredMaskGroup().getStructuredMask(); + } + + public void setStructuredMask(final StructuredMask structuredMask) { + getNodeGroups().getStructuredMaskGroup().setStructuredMask(structuredMask); + } + + public Scaffold getScaffold() { + return getNodeGroups().getScaffoldGroup().getScaffold(); + } + + public void setScaffold(final Scaffold scaffold) { + getNodeGroups().getScaffoldGroup().setScaffold(scaffold); + } + + public AnswerReduction getAnswerReduction() { + return getNodeGroups().getAnswerReductionGroup().getAnswerReduction(); + } + + public void setAnswerReduction(final AnswerReduction answerReduction) { + getNodeGroups().getAnswerReductionGroup().setAnswerReduction(answerReduction); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java new file mode 100644 index 000000000..2e73636d8 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java @@ -0,0 +1,81 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.NormalizedStringElementGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.NormalizedStringElement; + +import java.util.List; + +/** + *

TODO : Mark as Experimental. + * This is a very incomplete and not fully thought out structure + * in the XML schema. + * + * @author Zack Pierce + */ +public class RemoveTagGroup extends AbstractNode { + + private static final long serialVersionUID = 820309193192700393L; + + public static final String QTI_CLASS_NAME = "removeTagGroup"; + + private static final String ELEM_REMOVE_TAG_ID_REF = "removeTagIdRef"; + + private static final String ELEM_REMOVE_TAG_GROUP_ORDER = "removeTagGroupOrder"; + + public RemoveTagGroup(final AnswerReduction parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new SingleIntegerElementGroup(this, ELEM_REMOVE_TAG_GROUP_ORDER, true)); + getNodeGroups().add(new NormalizedStringElementGroup(this, ELEM_REMOVE_TAG_ID_REF, 0, null)); + } + + public Integer getRemoveTagGroupOrder() { + return getNodeGroups().getSingleIntegerElementGroup(ELEM_REMOVE_TAG_GROUP_ORDER).getInteger(); + } + + public void setRemoveTagGroupOrder(final Integer integer) { + getNodeGroups().getSingleIntegerElementGroup(ELEM_REMOVE_TAG_GROUP_ORDER).setInteger(integer); + } + + /** + * @return a list of elements wrapping id references within {@link NormalizedStringElement#getTextContent} + */ + public List getRemoveTagIdRefs() { + return getNodeGroups().getNormalizedStringElementGroup(ELEM_REMOVE_TAG_ID_REF).getNormalizedStringElements(); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java new file mode 100644 index 000000000..22d32fb45 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java @@ -0,0 +1,146 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.MarkupFileEmbeddedGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ObjectFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.VideoFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import java.util.List; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class RevealAlternativeRepresentation extends AbstractNode { + + private static final String ELEM_MARKUP_FILE_INFO = "markupFileInfo"; + private static final String ELEM_EXECUTABLE_FILE_INFO = "executableFileInfo"; + private static final String ELEM_TEXT_STRING = "textString"; + private static final String ELEM_TEXT_FILE_INFO = "textFileInfo"; + private static final String ELEM_GRAPHIC_FILE_INFO = "graphicFileInfo"; + private static final long serialVersionUID = -9063030312836472390L; + public static final String QTI_CLASS_NAME = "revealAlternativeRepresentation"; + + public RevealAlternativeRepresentation(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new AudioFileInfoGroup(this, 1)); + getNodeGroups().add(new VideoFileInfoGroup(this, false)); + getNodeGroups().add(new ObjectFileInfoGroup(this, ELEM_GRAPHIC_FILE_INFO, false)); + getNodeGroups().add(new ObjectFileInfoGroup(this, ELEM_TEXT_FILE_INFO, false)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_TEXT_STRING, false)); + getNodeGroups().add(new ObjectFileInfoGroup(this, ELEM_MARKUP_FILE_INFO, false)); + getNodeGroups().add(new MarkupFileEmbeddedGroup(this)); + getNodeGroups().add(new ObjectFileInfoGroup(this, ELEM_EXECUTABLE_FILE_INFO, false)); + // TODO - add support for 3rd party namespaced elements added here + } + + public AudioFileInfo getAudioFileInfo() { + final List audioFileInfos = getNodeGroups().getAudioFileInfoGroup().getAudioFileInfos(); + if (audioFileInfos.isEmpty()) { + return null; + } + return audioFileInfos.get(0); + } + + public void setAudioFileInfo(final AudioFileInfo audioFileInfo) { + final List audioFileInfos = getNodeGroups().getAudioFileInfoGroup().getAudioFileInfos(); + audioFileInfos.clear(); + if (audioFileInfo != null) { + audioFileInfos.add(audioFileInfo); + } + } + + public VideoFileInfo getVideoFileInfo() { + return getNodeGroups().getVideoFileInfoGroup().getVideoFileInfo(); + } + + public void setVideoFileInfo(final VideoFileInfo videoFileInfo) { + getNodeGroups().getVideoFileInfoGroup().setVideoFileInfo(videoFileInfo); + } + + public ObjectFileInfo getGraphicFileInfo() { + return getNodeGroups().getObjectFileInfoGroup(ELEM_GRAPHIC_FILE_INFO).getObjectFileInfo(); + } + + public void setGraphicFileInfo(final ObjectFileInfo objectFileInfo) { + getNodeGroups().getObjectFileInfoGroup(ELEM_GRAPHIC_FILE_INFO).setObjectFileInfo(objectFileInfo); + } + + public ObjectFileInfo getTextFileInfo() { + return getNodeGroups().getObjectFileInfoGroup(ELEM_TEXT_FILE_INFO).getObjectFileInfo(); + } + + public void setTextFileInfo(final ObjectFileInfo objectFileInfo) { + getNodeGroups().getObjectFileInfoGroup(ELEM_TEXT_FILE_INFO).setObjectFileInfo(objectFileInfo); + } + + public LabelledString getTextString() { + return getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).getLabelledString(); + } + + public void setTextString(final LabelledString textString) { + getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).setLabelledString(textString); + } + + public ObjectFileInfo getMarkupFileInfo() { + return getNodeGroups().getObjectFileInfoGroup(ELEM_MARKUP_FILE_INFO).getObjectFileInfo(); + } + + public void setMarkupFileInfo(final ObjectFileInfo objectFileInfo) { + getNodeGroups().getObjectFileInfoGroup(ELEM_MARKUP_FILE_INFO).setObjectFileInfo(objectFileInfo); + } + + public MarkupFileEmbedded getMarkupFileEmbedded() { + return getNodeGroups().getMarkupFileEmbeddedGroup().getMarkupFileEmbedded(); + } + + public void setMarkupFileEmbedded(final MarkupFileEmbedded markupEmbeddedFile) { + getNodeGroups().getMarkupFileEmbeddedGroup().setMarkupFileEmbedded(markupEmbeddedFile); + } + + public ObjectFileInfo getExecutableFileInfo() { + return getNodeGroups().getObjectFileInfoGroup(ELEM_EXECUTABLE_FILE_INFO).getObjectFileInfo(); + } + + public void setExecutableFileInfo(final ObjectFileInfo objectFileInfo) { + getNodeGroups().getObjectFileInfoGroup(ELEM_EXECUTABLE_FILE_INFO).setObjectFileInfo(objectFileInfo); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java new file mode 100644 index 000000000..910bffca7 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java @@ -0,0 +1,82 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ScaffoldBehaviorGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; + +/** + *

TODO : Mark as Experimental + * + * @author Zack Pierce + */ +public class Scaffold extends AbstractNode { + + private static final long serialVersionUID = -77398742244467029L; + + public static final String QTI_CLASS_NAME = "scaffold"; + + private static final String ELEM_REVEAL_ORDER = "revealOrder"; + + public Scaffold(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new SingleIntegerElementGroup(this, ELEM_REVEAL_ORDER, true)); + getNodeGroups().add(new ScaffoldBehaviorGroup(this)); + } + + /** + * The order of revelation for the alternative content found within {@link ScaffoldBehavior}, + * since scaffold accessibility metacontent does not have direct representation + * in a distinct ElementOrderList within {@link InclusionOrder} + */ + public Integer getRevealOrder() { + return getNodeGroups().getSingleIntegerElementGroup(ELEM_REVEAL_ORDER).getInteger(); + } + + public void setRevealOrder(final Integer revealOrder) { + getNodeGroups().getSingleIntegerElementGroup(ELEM_REVEAL_ORDER).setInteger(revealOrder); + } + + public ScaffoldBehavior getScaffoldBehavior() { + return getNodeGroups().getScaffoldBehaviorGroup().getScaffoldBehavior(); + } + + public void setScaffoldBehavior(final ScaffoldBehavior scaffoldBehavior) { + getNodeGroups().getScaffoldBehaviorGroup().setScaffoldBehavior(scaffoldBehavior); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java new file mode 100644 index 000000000..852814764 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java @@ -0,0 +1,100 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; + +import java.util.List; + +/** + * Container for the scaffolding. This content can take the form of text and audio materials. + * + *

TODO : Mark as Experimental + * This is a very incomplete and not fully thought out structure + * in the XML schema. + * + * @author Zack Pierce + */ +public class ScaffoldBehavior extends AbstractNode { + + private static final long serialVersionUID = -987626634176615011L; + + public static final String QTI_CLASS_NAME = "scaffoldBehavior"; + + private static final String ELEM_SPOKEN_TEXT = "spokenText"; + + private static final String ELEM_TEXT_STRING = "textString"; + + public ScaffoldBehavior(final Scaffold parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new AudioFileInfoGroup(this, 1)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_TEXT_STRING, false)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_SPOKEN_TEXT, false)); + } + + public AudioFileInfo getAudioFileInfo() { + final List audioFileInfos = getNodeGroups().getAudioFileInfoGroup().getAudioFileInfos(); + if (audioFileInfos.isEmpty()) { + return null; + } + return audioFileInfos.get(0); + } + + public void setAudioFileInfo(final AudioFileInfo audioFileInfo) { + final List audioFileInfos = getNodeGroups().getAudioFileInfoGroup().getAudioFileInfos(); + audioFileInfos.clear(); + if (audioFileInfo != null) { + audioFileInfos.add(audioFileInfo); + } + } + + public LabelledString getTextString() { + return getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).getLabelledString(); + } + + public void setTextString(final LabelledString textString) { + getNodeGroups().getLabelledStringGroup(ELEM_TEXT_STRING).setLabelledString(textString); + } + + public LabelledString getSpokenText() { + return getNodeGroups().getLabelledStringGroup(ELEM_SPOKEN_TEXT).getLabelledString(); + } + + public void setSpokenText(final LabelledString spokenText) { + getNodeGroups().getLabelledStringGroup(ELEM_SPOKEN_TEXT).setLabelledString(spokenText); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java new file mode 100644 index 000000000..c4633c33c --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java @@ -0,0 +1,76 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ObjectFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.VideoFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +/** + * Container for the links to the external signing files. + * Signing is available as video or bone animation files. + * + *

TODO : Mark boneAnimationVideoFile as Experimental + * + * @author Zack Pierce + */ +public class SignFile extends AbstractNode { + + private static final String ELEM_BONE_ANIMATION_VIDEO_FILE = "boneAnimationVideoFile"; + private static final long serialVersionUID = -6661340513986646006L; + + public SignFile(final QtiNode parent, final String qtiClassName) { + super(parent, qtiClassName); + getNodeGroups().add(new VideoFileInfoGroup(this, false)); + getNodeGroups().add(new ObjectFileInfoGroup(this, ELEM_BONE_ANIMATION_VIDEO_FILE, false)); + } + + public VideoFileInfo getVideoFileInfo() { + return getNodeGroups().getVideoFileInfoGroup().getVideoFileInfo(); + } + + public void setVideoFileInfo(final VideoFileInfo videoFileInfo) { + getNodeGroups().getVideoFileInfoGroup().setVideoFileInfo(videoFileInfo); + } + + public ObjectFileInfo getBoneAnimationVideoFile() { + return getNodeGroups().getObjectFileInfoGroup(ELEM_BONE_ANIMATION_VIDEO_FILE).getObjectFileInfo(); + } + + public void setBoneAnimationVideoFile(final ObjectFileInfo objectFileInfo) { + getNodeGroups().getObjectFileInfoGroup(ELEM_BONE_ANIMATION_VIDEO_FILE).setObjectFileInfo(objectFileInfo); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java new file mode 100644 index 000000000..8672960d2 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java @@ -0,0 +1,77 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SignFileGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; + +/** + * Container for the instructions for the provision of signing. + * ASL and Signed English are the supported modes for signing. + * + * @author Zack Pierce + */ +public class Signing extends AbstractNode { + + private static final long serialVersionUID = -8663009705465444076L; + + public static final String QTI_CLASS_NAME = "signing"; + + public static final String ELEM_SIGN_FILE_ASL = "signFileASL"; + + public static final String ELEM_SIGN_FILE_SIGNED_ENGLISH = "signFileSignedEnglish"; + + public Signing(final RelatedElementInfo parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new SignFileGroup(this, ELEM_SIGN_FILE_ASL)); + getNodeGroups().add(new SignFileGroup(this, ELEM_SIGN_FILE_SIGNED_ENGLISH)); + } + + public SignFile getSignFileASL() { + return getNodeGroups().getSignFileGroup(ELEM_SIGN_FILE_ASL).getSignFile(); + } + + public void setSignFileASL(final SignFile signFile) { + getNodeGroups().getSignFileGroup(ELEM_SIGN_FILE_ASL).setSignFile(signFile); + } + + public SignFile getSignFileSignedEnglish() { + return getNodeGroups().getSignFileGroup(ELEM_SIGN_FILE_SIGNED_ENGLISH).getSignFile(); + } + + public void setSignFileSignedEnglish(final SignFile signFile) { + getNodeGroups().getSignFileGroup(ELEM_SIGN_FILE_SIGNED_ENGLISH).setSignFile(signFile); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java new file mode 100644 index 000000000..63950bc0a --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java @@ -0,0 +1,82 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import java.util.List; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class Spoken extends AbstractNode { + + private static final long serialVersionUID = 3704460079478676370L; + public static final String QTI_CLASS_NAME = "spoken"; + + public static final String ELEM_SPOKEN_TEXT = "spokenText"; + public static final String ELEM_TEXT_TO_SPEECH_PRONUNCIATION = "textToSpeechPronunciation"; + + public Spoken(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new AudioFileInfoGroup(this, null)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_SPOKEN_TEXT, false)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_TEXT_TO_SPEECH_PRONUNCIATION, false)); + } + + public List getAudioFileInfos() { + return getNodeGroups().getAudioFileInfoGroup().getAudioFileInfos(); + } + + public LabelledString getSpokenText() { + return getNodeGroups().getSpokenTextGroup().getLabelledString(); + } + + public void setSpokenText(final LabelledString spokenText) { + getNodeGroups().getSpokenTextGroup().setLabelledString(spokenText); + } + + public LabelledString getTextToSpeechPronunciation() { + return getNodeGroups().getTextToSpeechPronunciationGroup().getLabelledString(); + } + + public void setTextToSpeechPronunciation(final LabelledString textToSpeechPronunciation) { + getNodeGroups().getTextToSpeechPronunciationGroup().setLabelledString(textToSpeechPronunciation); + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java new file mode 100644 index 000000000..2d6327966 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java @@ -0,0 +1,102 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; +import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +/** + * FIXME: Document this type + * + *

TODO : Mark as Experimental. + * This is a very incomplete and not fully thought out structure + * in the XML schema. + * + * @author Zack Pierce + */ +public class StructuredMask extends AbstractNode { + + private static final long serialVersionUID = -3598197907209423743L; + + public static final String QTI_CLASS_NAME = "structuredMask"; + + private Integer revealOrder; + + private Boolean answerOption; + + public StructuredMask(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + } + + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + this.revealOrder = XmlParseUtils.getChildContentAsInteger(element, "revealOrder"); + final String rawAnswerOption = XmlParseUtils.getChildContent(element, "answerOption"); + this.answerOption = rawAnswerOption != null ? DataTypeBinder.parseBoolean(rawAnswerOption) : true; + } + + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + // TODO : fire off elements for revealOrder and answerOption + super.fireBodySaxEvents(qtiSaxDocumentFirer); + } + + public Integer getRevealOrder() { + return revealOrder; + } + + public void setRevealOrder(final Integer revealOrder) { + this.revealOrder = revealOrder; + } + + /** + * Defaults to "true" when not specified in the loaded XML. + * @return + */ + public Boolean getAnswerOption() { + return answerOption; + } + + public void setAnswerOption(final Boolean answerOption) { + this.answerOption = answerOption; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java new file mode 100644 index 000000000..e243e66e2 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java @@ -0,0 +1,99 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; +import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; + +import java.util.List; + +/** + * @author Zack Pierce + */ +public class TactileFile extends AbstractNode { + + private static final long serialVersionUID = 5540725777117688624L; + + public static final String QTI_CLASS_NAME = "tactileFile"; + + public static final String ELEM_TACTILE_AUDIO_FILE = "tactileAudioFile"; + + public static final String ELEM_TACTILE_AUDIO_TEXT = "tactileAudioText"; + + public static final String ELEM_TACTILE_BRAILLE_TEXT = "tactileBrailleText"; + + public TactileFile(final QtiNode parent) { + super(parent, QTI_CLASS_NAME); + getNodeGroups().add(new AudioFileInfoGroup(this, ELEM_TACTILE_AUDIO_FILE, 1)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_TACTILE_AUDIO_TEXT, true)); + getNodeGroups().add(new LabelledStringGroup(this, ELEM_TACTILE_BRAILLE_TEXT, false)); + } + + public AudioFileInfo getTactileAudioFile() { + final List audioFileInfos = getNodeGroups().getAudioFileInfoGroup(ELEM_TACTILE_AUDIO_FILE) + .getAudioFileInfos(); + if (audioFileInfos.isEmpty()) { + return null; + } + return audioFileInfos.get(0); + } + + public void setTactileAudioFile(final AudioFileInfo audioFileInfo) { + final List audioFileInfos = getNodeGroups().getAudioFileInfoGroup(ELEM_TACTILE_AUDIO_FILE) + .getAudioFileInfos(); + audioFileInfos.clear(); + if (audioFileInfo != null) { + audioFileInfos.add(audioFileInfo); + } + } + + public LabelledString getTactileAudioText() { + return getNodeGroups().getTactileAudioTextGroup().getLabelledString(); + } + + public void setTactileAudioText(final LabelledString tactileAudioText) { + getNodeGroups().getTactileAudioTextGroup().setLabelledString(tactileAudioText); + } + + public LabelledString getTactileBrailleText() { + return getNodeGroups().getTactileBrailleTextGroup().getLabelledString(); + } + + public void setTactileBrailleText(final LabelledString tactileBrailleText) { + getNodeGroups().getTactileBrailleTextGroup().setLabelledString(tactileBrailleText); + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java new file mode 100644 index 000000000..96ee1553f --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java @@ -0,0 +1,108 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.node.LoadingContext; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; +import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; + +import java.util.Calendar; + +import org.w3c.dom.Element; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class VideoFileInfo extends ObjectFileInfo { + + public static final String QTI_CLASS_NAME = "videoFileInfo"; + + private static final String ELEM_START_CUE = "startCue"; + + private static final String ELEM_END_CUE = "endCue"; + + private static final long serialVersionUID = 5319846662148524016L; + + private Calendar startCue; + + private Calendar endCue; + + public VideoFileInfo(final QtiNode parent) { + super(parent, QTI_CLASS_NAME, true); + } + + @Override + protected void loadChildren(final Element element, final LoadingContext context) { + super.loadChildren(element, context); + final String rawStartCue = XmlParseUtils.getChildContent(element, ELEM_START_CUE); + if (rawStartCue != null) { + try { + this.startCue = DataTypeBinder.parseTime(rawStartCue); + } + catch (final QtiParseException e) { + context.modelBuildingError(e, element); + } + } + final String rawEndCue = XmlParseUtils.getChildContent(element, ELEM_END_CUE); + if (rawEndCue != null) { + try { + this.endCue = DataTypeBinder.parseTime(rawEndCue); + } + catch (final QtiParseException e) { + context.modelBuildingError(e, element); + } + } + } + + public Calendar getStartCue() { + return startCue; + } + + public void setStartCue(final Calendar startCue) { + this.startCue = startCue; + } + + public Calendar getEndCue() { + return endCue; + } + + public void setEndCue(final Calendar endCue) { + this.endCue = endCue; + } + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceSpeed.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceSpeed.java new file mode 100644 index 000000000..6de18ff98 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceSpeed.java @@ -0,0 +1,88 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.util.HashMap; +import java.util.Map; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public enum VoiceSpeed implements Stringifiable { + + SLOW("Slow"), + + STANDARD("Standard"), + + FAST("Fast"); + + private String voiceSpeed; + + public static final String QTI_CLASS_NAME = "voiceSpeed"; + + private static final Map nameToEnum; + + static { + final HashMap names = new HashMap(); + + for (final VoiceSpeed voiceSpeed : VoiceSpeed.values()) { + names.put(voiceSpeed.voiceSpeed, voiceSpeed); + } + + nameToEnum = ObjectUtilities.unmodifiableMap(names); + } + + private VoiceSpeed(final String voiceSpeed) { + this.voiceSpeed = voiceSpeed; + } + + @Override + public String toQtiString() { + return voiceSpeed; + } + + public static VoiceSpeed parseVoiceSpeed(final String voiceSpeed) throws QtiParseException { + final VoiceSpeed result = nameToEnum.get(voiceSpeed); + if (result == null) { + throw new QtiParseException("Invalid " + QTI_CLASS_NAME + " '" + voiceSpeed + "'."); + } + return result; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceType.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceType.java new file mode 100644 index 000000000..362d9aac2 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VoiceType.java @@ -0,0 +1,86 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.related; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.types.Stringifiable; + +import java.util.HashMap; +import java.util.Map; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public enum VoiceType implements Stringifiable { + + HUMAN("Human"), + + SYNTHETIC("Synthetic"); + + public static final String QTI_CLASS_NAME = "voiceType"; + + private static final Map nameToEnum; + + static { + final HashMap names = new HashMap(); + + for (final VoiceType voiceType : VoiceType.values()) { + names.put(voiceType.voiceType, voiceType); + } + + nameToEnum = ObjectUtilities.unmodifiableMap(names); + } + + private String voiceType; + + private VoiceType(final String voiceType) { + this.voiceType = voiceType; + } + + @Override + public String toQtiString() { + return voiceType; + } + + public static VoiceType parseVoiceType(final String voiceType) throws QtiParseException { + final VoiceType result = nameToEnum.get(voiceType); + if (result == null) { + throw new QtiParseException("Invalid " + QTI_CLASS_NAME + " '" + voiceType + "'."); + } + return result; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java index 9fc6e8acd..14da8c58b 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java @@ -36,6 +36,7 @@ import uk.ac.ed.ph.jqtiplus.QtiConstants; import uk.ac.ed.ph.jqtiplus.attribute.value.BooleanAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.ApipAccessibilityGroup; import uk.ac.ed.ph.jqtiplus.group.item.ItemBodyGroup; import uk.ac.ed.ph.jqtiplus.group.item.ModalFeedbackGroup; import uk.ac.ed.ph.jqtiplus.group.item.StylesheetGroup; @@ -49,6 +50,7 @@ import uk.ac.ed.ph.jqtiplus.node.AssessmentObject; import uk.ac.ed.ph.jqtiplus.node.AssessmentObjectType; import uk.ac.ed.ph.jqtiplus.node.IdentifiableNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; import uk.ac.ed.ph.jqtiplus.node.content.ItemBody; import uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration; import uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing; @@ -141,6 +143,7 @@ public AssessmentItem() { getNodeGroups().add(new ItemBodyGroup(this)); // itemBody [0..1] getNodeGroups().add(new ResponseProcessingGroup(this)); // responseProcessing [0..1] getNodeGroups().add(new ModalFeedbackGroup(this)); // modalFeedback [*] + getNodeGroups().add(new ApipAccessibilityGroup(this, false)); /* create a special declaration for the internal completionStatus variable */ completionStatusOutcomeDeclaration = new OutcomeDeclaration(this); @@ -541,6 +544,16 @@ public void setItemBody(final ItemBody itemBody) { getNodeGroups().getItemBodyGroup().setItemBody(itemBody); } + /* + * Gets apipAccessibility child + * + * @return apipAccessibility child + * @see #setApipAccessibility + */ + public ApipAccessibility getApipAccessibility() { + return getNodeGroups().getApipAccessibilityGroup().getApipAccessibility(); + } + @Override public final String computeXPathComponent() { final String identifier = getIdentifier(); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java index 7ad84cae2..8acb780c4 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java @@ -359,6 +359,7 @@ else if (currentQtiNamespace!=null) { else if (node instanceof ResultNode) { namespaceUri = QtiConstants.QTI_RESULT_21_NAMESPACE_URI; } + // TODO - handle APIP Accessibility related nodes else { namespaceUri = QtiConstants.QTI_21_NAMESPACE_URI; } @@ -377,6 +378,7 @@ else if (node instanceof ResultNode) { /* (These Nodes have a different schema) */ schemaLocation = QtiConstants.QTI_RESULT_21_SCHEMA_LOCATION; } + //TODO - handle APIP Accessibility related nodes else { /* (NB: We are *always* writing out QTI 2.1) */ schemaLocation = QtiConstants.QTI_21_SCHEMA_LOCATION; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java index 6d7c55d99..22385f633 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java @@ -37,8 +37,12 @@ import uk.ac.ed.ph.jqtiplus.internal.util.Assert; import uk.ac.ed.ph.jqtiplus.internal.util.Pair; +import java.math.BigDecimal; import java.net.URI; import java.net.URISyntaxException; +import java.util.Calendar; + +import javax.xml.bind.DatatypeConverter; /** * Helper class to bind certain QTI data types to and from Strings. @@ -65,7 +69,7 @@ public static String toString(final boolean value) { return value ? "true" : "false"; } - //-------------------------------------------- + // -------------------------------------------- public static int parseInteger(final String string) { return parseInteger(string, 10); @@ -77,7 +81,7 @@ public static int parseInteger(final String string, final int radix) { // Removes + sign because of Integer.parseInt cannot handle it. String s = string; if (string.startsWith("+")) { - s = string.substring(1); + s = string.substring(1); if (s.length() == 0 || !Character.isDigit(s.codePointAt(0))) { throw new QtiParseException("Invalid integer '" + string + "'"); } @@ -95,14 +99,14 @@ public static String toString(final int value) { return Integer.toString(value); } - //-------------------------------------------- + // -------------------------------------------- public static long parseLong(final String string) { Assert.notNull(string); String s = string; if (string.startsWith("+")) { - s = string.substring(1); + s = string.substring(1); if (s.length() == 0 || !Character.isDigit(s.codePointAt(0))) { throw new QtiParseException("Invalid integer '" + string + "'"); } @@ -119,7 +123,7 @@ public static String toString(final long value) { return Long.toString(value); } - //-------------------------------------------- + // -------------------------------------------- public static double parseFloat(final String string) { Assert.notNull(string); @@ -149,7 +153,7 @@ public static String toString(final double value) { return Double.toString(value); } - //-------------------------------------------- + // -------------------------------------------- public static Pair parsePair(final String string) { Assert.notNull(string); @@ -173,7 +177,7 @@ public static String toString(final Identifier first, final Identifier second) { return first.toString() + " " + second.toString(); } - //-------------------------------------------- + // -------------------------------------------- public static int[] parsePoint(final String string) { Assert.notNull(string); @@ -197,7 +201,7 @@ public static String toString(final int horizontalValue, final int verticalValue return horizontalValue + " " + verticalValue; } - //-------------------------------------------- + // -------------------------------------------- public static URI parseUri(final String string) { Assert.notNull(string); @@ -217,4 +221,27 @@ public static String toString(final URI uri) { return uri.toString(); } + public static BigDecimal parseBigDecimal(final String string) { + try { + return new BigDecimal(string); + } + catch (final NumberFormatException e) { + throw new QtiParseException("Invalid decimal '" + string + "'", e); + } + } + + /** + * Parses xsd:time // ISO 8601 strings + * @param iso8601Time A string containing the ISO 8601 representation of time used by the xsd:time datatype + * @return + */ + public static Calendar parseTime(final String iso8601Time) throws QtiParseException { + try { + return DatatypeConverter.parseTime(iso8601Time); + } + catch (final IllegalArgumentException e) { + throw new QtiParseException("Invalid time '" + iso8601Time + "'", e); + } + } + } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java index e93eae168..e8ed1a2b4 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java @@ -55,19 +55,19 @@ import java.util.Set; /** - * This class will provide some utility methods to perform deep queries or searches - * of a {@link QtiNode} tree. + * This class will provide some utility methods to perform deep queries or + * searches of a {@link QtiNode} tree. * * @author David McKain */ public final class QueryUtils { /** - * Performs a deep search starting at the given {@link QtiNode}(s) for instances of - * the given target type. + * Performs a deep search starting at the given {@link QtiNode}(s) for + * instances of the given target type. *

- * (This used to be part of the {@link BodyElement} interface in JQTI, but didn't work - * correctly!) + * (This used to be part of the {@link BodyElement} interface in JQTI, but + * didn't work correctly!) * * @param searchClass type of descendant to search for * @param nodes {@link QtiNode}(s) to start searching from @@ -89,8 +89,8 @@ public boolean handleNode(final QtiNode node) { } /** - * Performs a deep search starting at the children of given {@link QtiNode}(s) for the - * first instance of a node of the given searchType. + * Performs a deep search starting at the children of given {@link QtiNode} + * (s) for the first instance of a node of the given searchType. *

* Returns true if such a Node is found, false otherwise. * @@ -130,17 +130,19 @@ public boolean wasSuccessful() { } public static Set> findExtensionsUsed(final JqtiExtensionManager jqtiExtensionManager, final ResolvedAssessmentItem resolvedItem) { - final Set> resultSet = findExtensionsWithin(jqtiExtensionManager, resolvedItem.getItemLookup().extractAssumingSuccessful()); - final RootNodeLookup rpTemplateLookup = resolvedItem.getResolvedResponseProcessingTemplateLookup(); - if (rpTemplateLookup!=null) { + final Set> resultSet = findExtensionsWithin(jqtiExtensionManager, resolvedItem + .getItemLookup().extractAssumingSuccessful()); + final RootNodeLookup rpTemplateLookup = resolvedItem + .getResolvedResponseProcessingTemplateLookup(); + if (rpTemplateLookup != null) { resultSet.addAll(findExtensionsWithin(jqtiExtensionManager, rpTemplateLookup.extractAssumingSuccessful())); } return resultSet; } /** - * Finds all {@link JqtiExtensionPackage}s used by the given {@link QtiNode}s and their - * child Nodes. + * Finds all {@link JqtiExtensionPackage}s used by the given {@link QtiNode} + * s and their child Nodes. * * @param node */ @@ -151,13 +153,14 @@ public static Set> findExtensionsWithin(final JqtiExtens public boolean handleNode(final QtiNode node) { if (node instanceof CustomOperator) { final JqtiExtensionPackage jqtiExtensionPackage = jqtiExtensionManager.getJqtiExtensionPackageImplementingOperator((CustomOperator) node); - if (jqtiExtensionPackage!=null) { + if (jqtiExtensionPackage != null) { resultSet.add(jqtiExtensionPackage); } } else if (node instanceof CustomInteraction) { - final JqtiExtensionPackage jqtiExtensionPackage = jqtiExtensionManager.getJqtiExtensionPackageImplementingInteraction((CustomInteraction) node); - if (jqtiExtensionPackage!=null) { + final JqtiExtensionPackage jqtiExtensionPackage = jqtiExtensionManager + .getJqtiExtensionPackageImplementingInteraction((CustomInteraction) node); + if (jqtiExtensionPackage != null) { resultSet.add(jqtiExtensionPackage); } } @@ -215,6 +218,47 @@ public static void walkChildNodes(final TreeWalkNodeHandler handler, final Itera } } + /** + * Performs a shallow search of the supplied {@link QtiNode}(s), and + * produces a snapshot List of all found instances that match the + * searchClass. + * + * This utility function does not search within child or descendant nodes! + * + * @param searchClass + * @param nodes + * @return a snapshot List of matching instances + */ + public static List findShallowInstances(final Class searchClass, final Iterable nodes) { + final ArrayList results = new ArrayList(); + for (final QtiNode node : nodes) { + if (searchClass.isInstance(node)) { + results.add(searchClass.cast(node)); + } + } + return results; + } + + /** + * Performs a shallow search of the supplied {@link QtiNode}(s), and + * retrieves the first instance that matches the searchClass. Returns null + * if no such instance is found. + * + * This utility function does not search within child or descendant nodes! + * + * @param searchClass + * @param nodes + * @return a matching instance or null if none found + */ + public static E findFirstShallowInstance(final Class searchClass, final Iterable nodes) { + for (final QtiNode node : nodes) { + if (searchClass.isInstance(node)) { + return searchClass.cast(node); + } + } + return null; + } + private static void doWalkTree(final TreeWalkNodeHandler handler, final QtiNode currentNode) { final boolean descend = handler.handleNode(currentNode); if (descend) { diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/xmlutils/XmlParseUtils.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/xmlutils/XmlParseUtils.java new file mode 100644 index 000000000..39814c953 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/xmlutils/XmlParseUtils.java @@ -0,0 +1,114 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.xmlutils; + +import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.internal.util.Assert; +import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * This class provides some utility methods to assist in parsing Xml Elements. + * + * @author Zack Pierce + */ +public final class XmlParseUtils { + + /** + * Finds the first child element with the specified local name within the + * supplied parent node. If a matching child node exists, returns the + * concatenated direct textual contents of that child element. + * + * @param parent + * @param childLocalName + * @return null if no such child found + */ + public static String getChildContent(final Element parent, + final String childLocalName) { + final NodeList childNodes = parent.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + final Node childNode = childNodes.item(i); + if (childNode.getNodeType() != Node.ELEMENT_NODE) { + continue; + } + if (childLocalName.equals(childNode.getLocalName())) { + return getDirectTextualContent((Element) childNode); + } + } + return null; + } + + /** + * Produces the concatenated result of all direct TEXT_NODE + * children of the element. + * Text found within child/descendant elements or attributes is not included! + * @param element + * @return + */ + public static String getDirectTextualContent(final Element element) { + Assert.notNull(element); + final StringBuilder stringBuilder = new StringBuilder(); + final NodeList children = element.getChildNodes(); + for (int j = 0; j < children.getLength(); j++) { + final Node kid = children.item(j); + if (kid.getNodeType() == Node.TEXT_NODE) { + stringBuilder.append(kid.getNodeValue()); + } + } + return stringBuilder.toString(); + } + + /** + * Finds the first child element with the specified local name within the + * supplied parent node. If a matching child node exists, returns an Integer + * parsed from the concatenated textual contents of that child element. + * + * @param parent + * @param childLocalName + * @return + * @throws QtiParseException + */ + public static Integer getChildContentAsInteger(final Element parent, + final String childLocalName) throws QtiParseException { + final String childContent = getChildContent(parent, childLocalName); + if (childContent == null) { + return null; + } + return DataTypeBinder.parseInteger(childContent); + } + +} diff --git a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java new file mode 100644 index 000000000..7439a9c6a --- /dev/null +++ b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java @@ -0,0 +1,469 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.reading; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Calculator; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CalculatorTypeType; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterialsInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DigitalMaterial; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.LinearUnitSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.LinearUnitUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.PhysicalMaterial; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Protractor; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialIncrementSystemUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialUnitSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RadialUnitUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.ReadingPassage; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.Rule; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemSI; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemUS; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.AslDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.BrailleDefaultOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; +import uk.ac.ed.ph.jqtiplus.node.accessibility.link.ContentLinkInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.AnswerReduction; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.AudioFileInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.BrailleText; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.DefinitionId; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.GuidanceSupport; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.LabelledString; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.MarkupFileEmbedded; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.ObjectFileInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RemoveTagGroup; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Scaffold; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.SignFile; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Signing; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.Spoken; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.StructuredMask; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.TactileFile; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.VideoFileInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.VoiceSpeed; +import uk.ac.ed.ph.jqtiplus.node.accessibility.related.VoiceType; +import uk.ac.ed.ph.jqtiplus.node.content.basic.Block; +import uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P; +import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; +import uk.ac.ed.ph.jqtiplus.node.item.interaction.ChoiceInteraction; +import uk.ac.ed.ph.jqtiplus.testutils.UnitTestHelper; + +import java.math.BigDecimal; +import java.util.List; + +import javax.xml.bind.DatatypeConverter; + +import org.junit.Test; + +/** + * @author Zack Pierce + */ +public class QtiObjectReaderTest { + + @Test + public void testLookupRootNodeSimpleItem() throws Exception { + final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/choice.xml"); + assertNotNull(lookupRootNode); + final AssessmentItem item = lookupRootNode.getRootNode(); + assertNotNull(item); + final List blocks = item.getItemBody().getBlocks(); + assertEquals(3, blocks.size()); + assertEquals(P.class, blocks.get(0).getClass()); + assertEquals(ChoiceInteraction.class, blocks.get(2).getClass()); + assertNull(item.getApipAccessibility()); + } + + @Test + public void testLookupRootNodeWithAccessibilityInclusionOrder() throws Exception { + final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final AssessmentItem item = lookupRootNode.getRootNode(); + final ApipAccessibility apipAccessibility = item.getApipAccessibility(); + + final InclusionOrder inclusionOrder = apipAccessibility.getInclusionOrder(); + assertNotNull(inclusionOrder); + + final AslDefaultOrder aslDefaultOrder = inclusionOrder.getAslDefaultOrder(); + assertNotNull(aslDefaultOrder); + assertEquals(1, aslDefaultOrder.getElementOrders().size()); + assertEquals(1, aslDefaultOrder.getElementOrders().get(0).getOrder().intValue()); + assertEquals("ae01", aslDefaultOrder.getElementOrders().get(0).getIdentifierRef().toString()); + assertNotNull(inclusionOrder.getAslOnDemandOrder()); + + final BrailleDefaultOrder brailleDefaultOrder = inclusionOrder.getBrailleDefaultOrder(); + assertNotNull(brailleDefaultOrder); + assertEquals(2, brailleDefaultOrder.getElementOrders().size()); + assertEquals(1, brailleDefaultOrder.getElementOrders().get(0).getOrder().intValue()); + assertEquals("ae01", brailleDefaultOrder.getElementOrders().get(0).getIdentifierRef().toString()); + assertEquals(2, brailleDefaultOrder.getElementOrders().get(1).getOrder().intValue()); + assertEquals("ae02", brailleDefaultOrder.getElementOrders().get(1).getIdentifierRef().toString()); + assertNull(inclusionOrder.getTextOnlyOnDemandOrder()); + } + + @Test + public void testLookupRootNodeWithAccessibilityCompanionMaterials() throws Exception { + final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final AssessmentItem item = lookupRootNode.getRootNode(); + final ApipAccessibility apipAccessibility = item.getApipAccessibility(); + final CompanionMaterialsInfo cmi = apipAccessibility.getCompanionMaterialsInfo(); + assertNotNull(cmi); + + final List calculators = cmi.findCalculators(); + assertEquals(1, calculators.size()); + final Calculator calc = calculators.get(0); + assertEquals(CalculatorTypeType.STANDARD, calc.getCalculatorTypeType()); + assertEquals("Hello Calculator", calc.getDescriptionText()); + assertEquals("application/javascript", calc.getCalculatorInfo().getMimeType()); + assertEquals("standardCalculator.js", calc.getCalculatorInfo().getFileHref()); + + final List digMaterials = cmi.findDigitalMaterials(); + assertEquals(1, digMaterials.size()); + final DigitalMaterial digMat = digMaterials.get(0); + assertEquals("text/plain", digMat.getMimeType()); + assertEquals("refSheetA.txt", digMat.getFileHref()); + + final List physicalMaterials = cmi.findPhysicalMaterials(); + assertEquals(1, physicalMaterials.size()); + assertEquals("Raised terrain map", physicalMaterials.get(0).getTextContent()); + + final List passages = cmi.findReadingPassages(); + assertEquals(1, passages.size()); + final ReadingPassage passage = passages.get(0); + assertEquals("text/html", passage.getMimeType()); + assertEquals("readingPassage.html", passage.getFileHref()); + + final List protractors = cmi.findProtractors(); + assertEquals(2, protractors.size()); + assertEquals("SI Protractor", protractors.get(0).getDescriptionText()); + final RadialIncrementSystemSI radialIncrementSystemSI = protractors.get(0).getRadialIncrementSystemSI(); + assertEquals(new BigDecimal("1"), radialIncrementSystemSI.getMinorIncrementRadialSI().getDecimal()); + assertEquals(RadialUnitSI.RADIAN, radialIncrementSystemSI.getMinorIncrementRadialSI().getUnit()); + assertEquals(new BigDecimal("2.22"), radialIncrementSystemSI.getMajorIncrementRadialSI().getDecimal()); + assertEquals(RadialUnitSI.RADIAN, radialIncrementSystemSI.getMajorIncrementRadialSI().getUnit()); + assertNull(protractors.get(0).getRadialIncrementSystemUS()); + + assertEquals("US Protractor", protractors.get(1).getDescriptionText()); + final RadialIncrementSystemUS radialIncrementSystemUS = protractors.get(1).getRadialIncrementSystemUS(); + assertEquals(new BigDecimal("0.5"), radialIncrementSystemUS.getMinorIncrementRadialUS().getDecimal()); + assertEquals(RadialUnitUS.DEGREE, radialIncrementSystemUS.getMinorIncrementRadialUS().getUnit()); + assertEquals(new BigDecimal("1.3"), radialIncrementSystemUS.getMajorIncrementRadialUS().getDecimal()); + assertEquals(RadialUnitUS.MINUTE, radialIncrementSystemUS.getMajorIncrementRadialUS().getUnit()); + assertNull(protractors.get(1).getRadialIncrementSystemSI()); + + final List rules = cmi.findRules(); + assertEquals(2, rules.size()); + final Rule ruleSI = rules.get(0); + assertEquals("SI Rule", ruleSI.getDescriptionText()); + final RuleSystemSI ruleSystemSI = ruleSI.getRuleSystemSI(); + assertEquals(3, ruleSystemSI.getMinimumLength().getValue().intValue()); + assertEquals(LinearUnitSI.MILLIMETER, ruleSystemSI.getMinorIncrementLinearSI().getUnit()); + assertEquals(new BigDecimal("0.3"), ruleSystemSI.getMinorIncrementLinearSI().getDecimal()); + assertEquals(LinearUnitSI.KILOMETER, ruleSystemSI.getMajorIncrementLinearSI().getUnit()); + assertEquals(new BigDecimal("1.0"), ruleSystemSI.getMajorIncrementLinearSI().getDecimal()); + assertNull(ruleSI.getRuleSystemUS()); + + final Rule ruleUS = rules.get(1); + assertEquals("US Rule", ruleUS.getDescriptionText()); + final RuleSystemUS ruleSystemUS = ruleUS.getRuleSystemUS(); + assertEquals(3, ruleSystemUS.getMinimumLength().getValue().intValue()); + assertEquals(LinearUnitUS.INCH, ruleSystemUS.getMinorIncrementLinearUS().getUnit()); + assertEquals(new BigDecimal("0.3"), ruleSystemUS.getMinorIncrementLinearUS().getDecimal()); + assertEquals(LinearUnitUS.MILE, ruleSystemUS.getMajorIncrementLinearUS().getUnit()); + assertEquals(new BigDecimal("1.0"), ruleSystemUS.getMajorIncrementLinearUS().getDecimal()); + assertNull(ruleUS.getRuleSystemSI()); + + } + + @Test + public void testLookupRootNodeWithAccessibilityAccessElementsContentLinks() throws Exception { + final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final List accessElements = lookupRootNode.getRootNode().getApipAccessibility().getAccessElements(); + assertEquals(18, accessElements.size()); + + final AccessElement ae01 = accessElements.get(0); + assertEquals("ae01", ae01.getIdentifier().toString()); + assertEquals(1, ae01.getContentLinkInfos().size()); + final ContentLinkInfo cliA = ae01.getContentLinkInfos().get(0); + assertEquals("p1", cliA.getQtiLinkIdentifierRef().toString()); + assertNull(cliA.getApipLinkIdentifierRef()); + assertNull(cliA.getObjectLink()); + assertNull(cliA.getTextLink().getCharacterLink()); + assertNull(cliA.getTextLink().getCharacterStringLink()); + assertNotNull(cliA.getTextLink().getFullString()); + assertNull(cliA.getTextLink().getWordLink()); + + final AccessElement ae02 = accessElements.get(1); + assertEquals("ae02", ae02.getIdentifier().toString()); + assertEquals(1, ae02.getContentLinkInfos().size()); + final ContentLinkInfo cliB = ae02.getContentLinkInfos().get(0); + assertEquals("signImg", cliB.getQtiLinkIdentifierRef().toString()); + assertNull(cliB.getApipLinkIdentifierRef()); + assertNotNull(cliB.getObjectLink()); + assertNull(cliB.getTextLink()); + + final AccessElement ae03 = accessElements.get(2); + assertEquals("ae03", ae03.getIdentifier().toString()); + assertEquals(3, ae03.getContentLinkInfos().size()); + final ContentLinkInfo cliC = ae03.getContentLinkInfos().get(0); + assertEquals("promptA", cliC.getQtiLinkIdentifierRef().toString()); + assertNull(cliC.getApipLinkIdentifierRef()); + assertNull(cliC.getObjectLink()); + assertNotNull(cliC.getTextLink().getCharacterLink()); + assertEquals(1, cliC.getTextLink().getCharacterLink().getValue().intValue()); + assertNull(cliC.getTextLink().getCharacterStringLink()); + assertNull(cliC.getTextLink().getWordLink()); + assertNull(cliC.getTextLink().getFullString()); + + final ContentLinkInfo cliD = ae03.getContentLinkInfos().get(1); + assertEquals("promptA", cliD.getQtiLinkIdentifierRef().toString()); + assertNull(cliD.getApipLinkIdentifierRef()); + assertNull(cliD.getObjectLink()); + assertNull(cliD.getTextLink().getCharacterLink()); + assertNotNull(cliD.getTextLink().getCharacterStringLink()); + assertEquals(13, cliD.getTextLink().getCharacterStringLink().getStartCharacter().intValue()); + assertEquals(15, cliD.getTextLink().getCharacterStringLink().getStopCharacter().intValue()); + assertNull(cliD.getTextLink().getWordLink()); + assertNull(cliD.getTextLink().getFullString()); + + final ContentLinkInfo cliE = ae03.getContentLinkInfos().get(2); + assertEquals("promptA", cliE.getQtiLinkIdentifierRef().toString()); + assertNull(cliE.getApipLinkIdentifierRef()); + assertNull(cliE.getObjectLink()); + assertNull(cliE.getTextLink().getCharacterLink()); + assertNull(cliE.getTextLink().getCharacterStringLink()); + assertNotNull(cliE.getTextLink().getWordLink()); + assertEquals(2, cliE.getTextLink().getWordLink().getValue().intValue()); + assertNull(cliE.getTextLink().getFullString()); + + + final ContentLinkInfo cliF = accessElements.get(17).getContentLinkInfos().get(0); + assertNull(cliF.getQtiLinkIdentifierRef()); + assertEquals("kwtd02", cliF.getApipLinkIdentifierRef().toString()); + } + + @Test + public void testLookupRootNodeWithAccessibilityCoreRelatedInfo() throws Exception { + final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final List accessElements = lookupRootNode.getRootNode().getApipAccessibility().getAccessElements(); + + final AccessElement ae01 = accessElements.get(0); + final RelatedElementInfo relatedElementInfoA = ae01.getRelatedElementInfo(); + assertNotNull(relatedElementInfoA); + final Spoken spokenA = relatedElementInfoA.getSpoken(); + assertNotNull(spokenA); + final List audioFileInfosA = spokenA.getAudioFileInfos(); + assertEquals(2, audioFileInfosA.size()); + final AudioFileInfo afi01 = audioFileInfosA.get(0); + assertEquals("audio/mpeg", afi01.getMimeType()); + assertEquals("afi01", afi01.getContentLinkIdentifier().toString()); + assertEquals("afi01.mp3", afi01.getFileHref()); + assertEquals(VoiceType.HUMAN, afi01.getVoiceType()); + assertEquals(VoiceSpeed.FAST, afi01.getVoiceSpeed()); + assertEquals(DatatypeConverter.parseTime("00:00:10.5"), afi01.getStartTime()); + assertEquals(DatatypeConverter.parseTime("00:01:00"), afi01.getDuration()); + + final AudioFileInfo afi02 = audioFileInfosA.get(1); + assertEquals("audio/ogg", afi02.getMimeType()); + assertEquals("afi02", afi02.getContentLinkIdentifier().toString()); + assertEquals("afi02.ogg", afi02.getFileHref()); + assertEquals(VoiceType.SYNTHETIC, afi02.getVoiceType()); + assertEquals(VoiceSpeed.STANDARD, afi02.getVoiceSpeed()); + assertNull(afi02.getStartTime()); + assertNull(afi02.getDuration()); + assertEquals("Look at the text in the picture.", spokenA.getSpokenText().getTextContent()); + assertEquals("st01", spokenA.getSpokenText().getContentLinkIdentifier().toString()); + assertEquals("Luhk at the text in the picture", spokenA.getTextToSpeechPronunciation().getTextContent()); + assertEquals("ttsp01", spokenA.getTextToSpeechPronunciation().getContentLinkIdentifier().toString()); + + final BrailleText brailleTextA = relatedElementInfoA.getBrailleText(); + final LabelledString brailleTextStringA = brailleTextA.getBrailleTextString(); + assertEquals("bts01", brailleTextStringA.getContentLinkIdentifier().toString()); + assertEquals("Look at the text in the picture", brailleTextStringA.getTextContent()); + + final TactileFile tactileFileA = relatedElementInfoA.getTactileFile(); + final AudioFileInfo taf01 = tactileFileA.getTactileAudioFile(); + assertEquals("audio/mpeg", taf01.getMimeType()); + assertEquals("taf01", taf01.getContentLinkIdentifier().toString()); + assertEquals("taf01.mp3", taf01.getFileHref()); + assertEquals(VoiceType.SYNTHETIC, taf01.getVoiceType()); + assertEquals(VoiceSpeed.STANDARD, taf01.getVoiceSpeed()); + assertNull(taf01.getStartTime()); + assertNull(taf01.getDuration()); + assertEquals("tat01", tactileFileA.getTactileAudioText().getContentLinkIdentifier().toString()); + assertEquals("Look at the picture and consider how it feels on the physical map.", tactileFileA.getTactileAudioText().getTextContent()); + assertEquals("tbt01", tactileFileA.getTactileBrailleText().getContentLinkIdentifier().toString()); + assertEquals("Look at the picture and consider how it feels on the physical map.", tactileFileA.getTactileBrailleText().getTextContent()); + } + + @Test + public void testLookupRootNodeWithAccessibilityBeyondCore() throws Exception { + final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final List accessElements = lookupRootNode.getRootNode().getApipAccessibility().getAccessElements(); + final AccessElement ae01 = accessElements.get(0); + assertFalse(ae01.getRelatedElementInfo().getChunk()); + assertFalse(ae01.getRelatedElementInfo().getKeyWordEmphasis()); + final AccessElement ae02 = accessElements.get(1); + assertTrue(ae02.getRelatedElementInfo().getChunk()); + assertTrue(ae02.getRelatedElementInfo().getKeyWordEmphasis()); + + final Signing signing = ae02.getRelatedElementInfo().getSigning(); + assertNull(signing.getSignFileSignedEnglish()); + final SignFile asl = signing.getSignFileASL(); + final VideoFileInfo aslVideo = asl.getVideoFileInfo(); + assertEquals("sfaslvfi01", aslVideo.getContentLinkIdentifier().toString()); + assertEquals("video/mpeg", aslVideo.getMimeType()); + assertEquals("doNotLeaveLuggage.mpeg", aslVideo.getFileHref()); + assertEquals(DatatypeConverter.parseTime("00:00:01"), aslVideo.getStartCue()); + assertEquals(DatatypeConverter.parseTime("00:00:20"), aslVideo.getEndCue()); + + final ObjectFileInfo bavf = asl.getBoneAnimationVideoFile(); + assertEquals("sfaslbavf", bavf.getContentLinkIdentifier().toString()); + assertEquals("video/x-matroska", bavf.getMimeType()); + assertEquals("neverLeaveLuggage.mkv", bavf.getFileHref()); + + final List definitionIds = ae02.getRelatedElementInfo().getKeyWordTranslation().getDefinitionIds(); + assertEquals(2, definitionIds.size()); + assertEquals("en-US", definitionIds.get(0).getLang()); + assertEquals("Never leave your bags alone.", definitionIds.get(0).getTextString().getTextContent()); + assertEquals("kwtd01", definitionIds.get(0).getTextString().getContentLinkIdentifier().toString()); + + assertEquals("es-419", definitionIds.get(1).getLang()); + assertEquals("nunca deje el equipaje desatendido", definitionIds.get(1).getTextString().getTextContent()); + assertEquals("kwtd02", definitionIds.get(1).getTextString().getContentLinkIdentifier().toString()); + + final AudioFileInfo rafi01 = accessElements.get(3).getRelatedElementInfo().getRevealAlternativeRepresentation().getAudioFileInfo(); + assertEquals("audio/mpeg", rafi01.getMimeType()); + assertEquals("rafi01.mp3", rafi01.getFileHref()); + + final VideoFileInfo rvfi01 = accessElements.get(4).getRelatedElementInfo().getRevealAlternativeRepresentation().getVideoFileInfo(); + assertEquals("video/ogg", rvfi01.getMimeType()); + assertEquals("rvfi01.ogg", rvfi01.getFileHref()); + + final ObjectFileInfo rtfi01 = accessElements.get(5).getRelatedElementInfo().getRevealAlternativeRepresentation().getTextFileInfo(); + assertEquals("rtfi01.txt", rtfi01.getFileHref()); + + final LabelledString rts01 = accessElements.get(6).getRelatedElementInfo().getRevealAlternativeRepresentation().getTextString(); + assertEquals("rts01", rts01.getContentLinkIdentifier().toString()); + assertEquals("Never leave luggage unattended.", rts01.getTextContent()); + + final ObjectFileInfo rgfi01 = accessElements.get(7).getRelatedElementInfo().getRevealAlternativeRepresentation().getGraphicFileInfo(); + assertEquals("rgfi01.svg", rgfi01.getFileHref()); + + final ObjectFileInfo rmfi01 = accessElements.get(8).getRelatedElementInfo().getRevealAlternativeRepresentation().getMarkupFileInfo(); + assertEquals("rmfi01.xhtml", rmfi01.getFileHref()); + + final ObjectFileInfo rmfi02 = accessElements.get(9).getRelatedElementInfo().getRevealAlternativeRepresentation().getMarkupFileInfo(); + assertEquals("rmfi02.markdown", rmfi02.getFileHref()); + + final ObjectFileInfo refi01 = accessElements.get(10).getRelatedElementInfo().getRevealAlternativeRepresentation().getExecutableFileInfo(); + assertEquals("refi01.js", refi01.getFileHref()); + + final MarkupFileEmbedded mfe01 = accessElements.get(11).getRelatedElementInfo().getRevealAlternativeRepresentation().getMarkupFileEmbedded(); + assertNotNull(mfe01); + // TODO - handle and test 3rd party namespace elements within MarkupFileEmbedded + + final GuidanceSupport gll01 = accessElements.get(3).getRelatedElementInfo().getGuidance().getLanguageLearnerSupport(); + assertEquals(1, gll01.getSupportOrder().intValue()); + assertEquals("gll01", gll01.getTextString().getContentLinkIdentifier().toString()); + assertEquals("\"Luggage\" is a term used for the items one carries during travel.", gll01.getTextString().getTextContent()); + + final GuidanceSupport gcg01 = accessElements.get(3).getRelatedElementInfo().getGuidance().getCognitiveGuidanceSupport(); + assertEquals(1, gcg01.getSupportOrder().intValue()); + assertEquals("gcg01", gcg01.getTextString().getContentLinkIdentifier().toString()); + assertEquals("\"Luggage\" means travel bags.", gcg01.getTextString().getTextContent()); + + final GuidanceSupport gll02 = accessElements.get(4).getRelatedElementInfo().getGuidance().getLanguageLearnerSupport(); + assertEquals(2, gll02.getSupportOrder().intValue()); + assertEquals("gll02", gll02.getTextString().getContentLinkIdentifier().toString()); + assertEquals("Second set of language learner guidance.", gll02.getTextString().getTextContent()); + + final GuidanceSupport gcg02 = accessElements.get(4).getRelatedElementInfo().getGuidance().getCognitiveGuidanceSupport(); + assertEquals(2, gcg02.getSupportOrder().intValue()); + assertEquals("gcg02", gcg02.getTextString().getContentLinkIdentifier().toString()); + assertEquals("Second set of cognitive-difficulties-oriented guidance.", gcg02.getTextString().getTextContent()); + + final StructuredMask structuredMaskA = accessElements.get(12).getRelatedElementInfo().getStructuredMask(); + assertEquals(1, structuredMaskA.getRevealOrder().intValue()); + assertEquals(true, structuredMaskA.getAnswerOption().booleanValue()); + + final StructuredMask structuredMaskB = accessElements.get(13).getRelatedElementInfo().getStructuredMask(); + assertNull(structuredMaskB.getRevealOrder()); + assertEquals(false, structuredMaskB.getAnswerOption().booleanValue()); + + final StructuredMask structuredMaskC = accessElements.get(14).getRelatedElementInfo().getStructuredMask(); + assertNull(structuredMaskC.getRevealOrder()); + assertEquals(true, structuredMaskC.getAnswerOption().booleanValue()); + + final Scaffold scaffoldA = accessElements.get(15).getRelatedElementInfo().getScaffold(); + assertEquals(1, scaffoldA.getRevealOrder().intValue()); + assertEquals("audio/ogg", scaffoldA.getScaffoldBehavior().getAudioFileInfo().getMimeType()); + assertEquals("safi01", scaffoldA.getScaffoldBehavior().getAudioFileInfo().getContentLinkIdentifier().toString()); + assertEquals("safi01.ogg", scaffoldA.getScaffoldBehavior().getAudioFileInfo().getFileHref()); + assertEquals("sts01", scaffoldA.getScaffoldBehavior().getTextString().getContentLinkIdentifier().toString()); + assertEquals("What does the sign mean, really?", scaffoldA.getScaffoldBehavior().getTextString().getTextContent()); + assertEquals("sst01", scaffoldA.getScaffoldBehavior().getSpokenText().getContentLinkIdentifier().toString()); + assertEquals("What does the sign really mean?", scaffoldA.getScaffoldBehavior().getSpokenText().getTextContent()); + + final AnswerReduction answerReduction01 = accessElements.get(16).getRelatedElementInfo().getAnswerReduction(); + final RemoveTagGroup removeTagGroupBC = answerReduction01.getRemoveTagGroups().get(0); + assertEquals(1, removeTagGroupBC.getRemoveTagGroupOrder().intValue()); + assertEquals(2, removeTagGroupBC.getRemoveTagIdRefs().size()); + assertEquals("simpleChoiceB", removeTagGroupBC.getRemoveTagIdRefs().get(0).getTextContent()); + assertEquals("simpleChoiceC", removeTagGroupBC.getRemoveTagIdRefs().get(1).getTextContent()); + + final RemoveTagGroup removeTagGroupA = answerReduction01.getRemoveTagGroups().get(1); + assertEquals(2, removeTagGroupA.getRemoveTagGroupOrder().intValue()); + assertEquals(1, removeTagGroupA.getRemoveTagIdRefs().size()); + assertEquals("simpleChoiceA", removeTagGroupA.getRemoveTagIdRefs().get(0).getTextContent()); + } + + private static QtiObjectReadResult readAssessmentItemQtiObjectTest(final String testFilePath) + throws Exception { + return createQtiObjectReader().lookupRootNode(UnitTestHelper.createTestResourceUri(testFilePath), + AssessmentItem.class); + + } + + private static QtiObjectReader createQtiObjectReader() { + return new QtiObjectReader(UnitTestHelper.createUnitTestQtiXmlReader(), + UnitTestHelper.createTestFileResourceLocator(), true); + } + +} diff --git a/qtiworks-jqtiplus/src/test/resources/reading/accessible-core-qti.xml b/qtiworks-jqtiplus/src/test/resources/reading/accessible-core-qti.xml new file mode 100644 index 000000000..e929d0b48 --- /dev/null +++ b/qtiworks-jqtiplus/src/test/resources/reading/accessible-core-qti.xml @@ -0,0 +1,449 @@ + + + + + + ChoiceA + + + + + 0.0 + + + +

Look at the text in the picture.

+

+ NEVER LEAVE LUGGAGE UNATTENDED +

+ + What does it say? + You must stay with + your luggage + at all times. + + Do not let someone + else look + after your luggage. + + Remember your + luggage when you + leave. + + + + + + + + Standard + Hello Calculator + + standardCalculator.js + + + + refSheetA.txt + + Raised terrain map + + readingPassage.html + + + SI Protractor + + 1 + 2.22 + + + + US Protractor + + 0.5 + 1.3 + + + + SI Rule + + 3 + 0.3 + 1.0 + + + + US Rule + + 3 + 0.3 + 1.0 + + + + + + + 1 + + + + + 1 + + + + + 1 + + + 2 + + + + + 1 + + + + + 1 + + + 2 + + + + + 1 + + + + + 1 + + + + + 1 + + + + + 1 + + + + + 1 + + + + + + + + + + + + + + + afi01.mp3 + Human + Fast + 00:00:10.5 + 00:01:00 + + + afi02.ogg + + Look at the text in the picture. + Luhk at the text in the picture + + + Look at the text in the picture + + + + taf01.mp3 + + Look at the picture and consider how it feels on the physical map. + Look at the picture and consider how it feels on the physical map. + + + + + + + + + + + + + + doNotLeaveLuggage.mpeg + 00:00:01 + 00:00:20 + + + neverLeaveLuggage.mkv + + + + + + Never leave your bags alone. + + + nunca deje el equipaje desatendido + + + + + + + + 1 + + + + + + 13 + 15 + + + + + + 2 + + + + + + + + + + + + + rafi01.mp3 + + + + + 1 + "Luggage" is a term used for the items one carries during travel. + + + 1 + "Luggage" means travel bags. + + + + + + + + + + + + rvfi01.ogg + + + + + 2 + Second set of language learner guidance. + + + 2 + Second set of cognitive-difficulties-oriented guidance. + + + + + + + + + + + + rtfi01.txt + + + + + + + + + + + Never leave luggage unattended. + + + + + + + + + + + rgfi01.svg + + + + + + + + + + + + rmfi01.xhtml + + + + + + + + + + + + rmfi02.markdown + + + + + + + + + + + + refi01.js + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + false + + + + + + + + + + true + + + + + + + + + + 1 + + + safi01.ogg + + What does the sign mean, really? + What does the sign really mean? + + + + + + + + + + + + 1 + simpleChoiceB + simpleChoiceC + + + 2 + simpleChoiceA + + + + + + + + + + + + + + + From c0cb6ec97ce229e7d20fc348b5aa3edf97fd166c Mon Sep 17 00:00:00 2001 From: Zachary Pierce Date: Mon, 16 Sep 2013 13:43:09 -0700 Subject: [PATCH 2/5] Adding serialization support for APIP accessibility structures, along with capabilities for controlling the output XML namespaces via profiles. Sane ISO-compliant time input and output for audioFileInfo and videoFileInfo made possible by the addition of a dependency on joda-time. --- .../rendering/XsltParamDocumentBuilder.java | 3 +- qtiworks-jqtiplus/pom.xml | 5 + .../ed/ph/jqtiplus/JqtiExtensionManager.java | 4 +- .../uk/ac/ed/ph/jqtiplus/QtiConstants.java | 23 + .../java/uk/ac/ed/ph/jqtiplus/QtiProfile.java | 329 + .../accessibility/AccessibilityNode.java | 43 + .../related/AudioFileInfoGroup.java | 4 +- .../related/NormalizedStringElementGroup.java | 4 +- .../uk/ac/ed/ph/jqtiplus/node/RootNode.java | 2 + .../ac/ed/ph/jqtiplus/node/RootNodeTypes.java | 17 +- .../node/accessibility/AccessElement.java | 3 +- .../node/accessibility/AccessibilityInfo.java | 3 +- .../node/accessibility/ApipAccessibility.java | 3 +- .../node/accessibility/EmptyElement.java | 9 +- .../jqtiplus/node/accessibility/FileInfo.java | 12 +- .../accessibility/SingleEnumerateElement.java | 14 +- .../accessibility/SingleIntegerElement.java | 9 +- .../accessibility/companion/Calculator.java | 3 +- .../companion/CalculatorInfo.java | 3 +- .../companion/CalculatorType.java | 5 +- .../companion/CompanionMaterialsInfo.java | 3 +- .../companion/DecimalUnitElement.java | 20 +- .../accessibility/companion/Description.java | 3 +- .../companion/DigitalMaterial.java | 3 +- .../companion/MajorIncrementLinearSI.java | 6 +- .../companion/MajorIncrementLinearUS.java | 5 +- .../companion/MajorIncrementRadialSI.java | 6 +- .../companion/MajorIncrementRadialUS.java | 6 +- .../companion/MinimumLength.java | 3 +- .../companion/MinorIncrementLinearSI.java | 6 +- .../companion/MinorIncrementLinearUS.java | 6 +- .../companion/MinorIncrementRadialSI.java | 6 +- .../companion/MinorIncrementRadialUS.java | 6 +- .../companion/PhysicalMaterial.java | 3 +- .../accessibility/companion/Protractor.java | 3 +- .../companion/RadialIncrementSystemSI.java | 3 +- .../companion/RadialIncrementSystemUS.java | 3 +- .../companion/ReadingPassage.java | 3 +- .../node/accessibility/companion/Rule.java | 3 +- .../accessibility/companion/RuleSystemSI.java | 3 +- .../accessibility/companion/RuleSystemUS.java | 3 +- .../inclusion/AslDefaultOrder.java | 3 +- .../inclusion/AslOnDemandOrder.java | 3 +- .../inclusion/BrailleDefaultOrder.java | 3 +- .../accessibility/inclusion/ElementOrder.java | 10 +- .../inclusion/ElementOrderList.java | 3 +- .../inclusion/GraphicsOnlyOnDemandOrder.java | 3 +- .../inclusion/InclusionOrder.java | 3 +- .../inclusion/NonVisualDefaultOrder.java | 3 +- .../inclusion/SignedEnglishDefaultOrder.java | 3 +- .../inclusion/SignedEnglishOnDemandOrder.java | 3 +- .../inclusion/TextGraphicsDefaultOrder.java | 3 +- .../inclusion/TextGraphicsOnDemandOrder.java | 3 +- .../inclusion/TextOnlyDefaultOrder.java | 3 +- .../inclusion/TextOnlyOnDemandOrder.java | 3 +- .../accessibility/link/CharacterLink.java | 3 +- .../link/CharacterStringLink.java | 11 +- .../accessibility/link/ContentLinkInfo.java | 5 +- .../node/accessibility/link/FullString.java | 3 +- .../node/accessibility/link/ObjectLink.java | 3 +- .../node/accessibility/link/TextLink.java | 3 +- .../node/accessibility/link/WordLink.java | 3 +- .../related/AnswerReduction.java | 3 +- .../accessibility/related/AudioFileInfo.java | 43 +- .../accessibility/related/BrailleText.java | 3 +- .../node/accessibility/related/Chunk.java | 3 +- .../accessibility/related/DefinitionId.java | 3 +- .../node/accessibility/related/Guidance.java | 3 +- .../related/GuidanceSupport.java | 3 +- .../related/KeyWordEmphasis.java | 3 +- .../related/KeyWordTranslation.java | 3 +- .../accessibility/related/LabelledString.java | 7 +- .../related/MarkupFileEmbedded.java | 3 +- .../accessibility/related/ObjectFileInfo.java | 3 +- .../related/RelatedElementInfo.java | 3 +- .../accessibility/related/RemoveTagGroup.java | 3 +- .../RevealAlternativeRepresentation.java | 3 +- .../node/accessibility/related/Scaffold.java | 3 +- .../related/ScaffoldBehavior.java | 3 +- .../node/accessibility/related/SignFile.java | 3 +- .../node/accessibility/related/Signing.java | 3 +- .../node/accessibility/related/Spoken.java | 3 +- .../accessibility/related/StructuredMask.java | 12 +- .../accessibility/related/TactileFile.java | 3 +- .../accessibility/related/VideoFileInfo.java | 37 +- .../ph/jqtiplus/node/item/AssessmentItem.java | 3 +- .../declaration/OutcomeDeclaration.java | 26 +- .../jqtiplus/node/test/AssessmentSection.java | 24 +- .../ph/jqtiplus/reading/QtiObjectReader.java | 1 + .../ed/ph/jqtiplus/reading/QtiXmlReader.java | 12 +- .../serialization/QtiSaxDocumentFirer.java | 115 +- .../serialization/SaxFiringOptions.java | 34 +- .../ed/ph/jqtiplus/types/DataTypeBinder.java | 19 +- .../apipv1p0/apipv1p0_qtiextv2p1_v1p0.xsd | 1001 ++ .../apipv1p0/apipv1p0_qtiitemv2p1_v1p0.xsd | 9258 +++++++++++++++++ .../apipv1p0_qtioutcomesv2p1_v1p0.xsd | 596 ++ .../apipv1p0_qtiresprocessingv2p1_v1p0.xsd | 2892 +++++ .../apipv1p0/apipv1p0_qtisectionv2p1_v1p0.xsd | 2209 ++++ .../apipv1p0/apipv1p0_qtitestv2p1_v1p0.xsd | 4927 +++++++++ .../jqtiplus/reading/QtiObjectReaderTest.java | 82 +- .../serialization/QtiSerializerTest.java | 112 +- .../ph/jqtiplus/testutils/UnitTestHelper.java | 36 +- .../resources/reading/minimal-core-apip.xml | 147 + .../roundtrippable-core-apip.xml | 152 + 104 files changed, 22209 insertions(+), 274 deletions(-) create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityNode.java create mode 100644 qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiextv2p1_v1p0.xsd create mode 100644 qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiitemv2p1_v1p0.xsd create mode 100644 qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtioutcomesv2p1_v1p0.xsd create mode 100644 qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiresprocessingv2p1_v1p0.xsd create mode 100644 qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtisectionv2p1_v1p0.xsd create mode 100644 qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtitestv2p1_v1p0.xsd create mode 100644 qtiworks-jqtiplus/src/test/resources/reading/minimal-core-apip.xml create mode 100644 qtiworks-jqtiplus/src/test/resources/serialization/roundtrippable-core-apip.xml diff --git a/qtiworks-engine/src/main/java/uk/ac/ed/ph/qtiworks/rendering/XsltParamDocumentBuilder.java b/qtiworks-engine/src/main/java/uk/ac/ed/ph/qtiworks/rendering/XsltParamDocumentBuilder.java index 2339cab2d..deba7af69 100644 --- a/qtiworks-engine/src/main/java/uk/ac/ed/ph/qtiworks/rendering/XsltParamDocumentBuilder.java +++ b/qtiworks-engine/src/main/java/uk/ac/ed/ph/qtiworks/rendering/XsltParamDocumentBuilder.java @@ -80,8 +80,7 @@ public Document buildDocument() { final SimpleDomBuilderHandler domBuilderHandler = new SimpleDomBuilderHandler(document); /* Create QTI SAX firer with suitable options */ - final SaxFiringOptions saxFiringOptions = new SaxFiringOptions(); - saxFiringOptions.setOmitSchemaLocation(true); + final SaxFiringOptions saxFiringOptions = new SaxFiringOptions(true); final QtiSaxDocumentFirer qtiSaxDocumentFirer = new QtiSaxDocumentFirer(jqtiExtensionManager, domBuilderHandler, saxFiringOptions); /* Register namespace for parameter XML */ diff --git a/qtiworks-jqtiplus/pom.xml b/qtiworks-jqtiplus/pom.xml index ad369f0f6..e7712be41 100644 --- a/qtiworks-jqtiplus/pom.xml +++ b/qtiworks-jqtiplus/pom.xml @@ -57,6 +57,11 @@ All Rights Reserved ${xmlunit.version} test + + joda-time + joda-time + 2.2 + diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/JqtiExtensionManager.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/JqtiExtensionManager.java index 2201879ae..4433fe582 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/JqtiExtensionManager.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/JqtiExtensionManager.java @@ -88,9 +88,7 @@ private Map buildExtensionNamespaceInfoMap() { for (final JqtiExtensionPackage extensionPackage : jqtiExtensionPackages) { for (final Entry entry : extensionPackage.getNamespaceInfoMap().entrySet()) { final String namespaceUri = entry.getKey(); - if (QtiConstants.QTI_21_NAMESPACE_URI.equals(namespaceUri) - || QtiConstants.QTI_20_NAMESPACE_URI.equals(namespaceUri) - || QtiConstants.QTI_RESULT_21_NAMESPACE_URI.equals(namespaceUri)) { + if (QtiProfile.getAllNamespaceUrisFromAllProfiles().contains(namespaceUri)) { throw new IllegalArgumentException("Namespace URI " + namespaceUri + " is reserved for QTI and may not be used for extensions"); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiConstants.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiConstants.java index e1e95be13..4580837a4 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiConstants.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiConstants.java @@ -45,10 +45,12 @@ public final class QtiConstants { public static final String QTI_20_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imsqti_v2p0"; public static final String QTI_21_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imsqti_v2p1"; public static final String QTI_RESULT_21_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imsqti_result_v2p1"; + public static final String QTI_METADATA_21_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imsqti_metadata_v2p1"; public static final String QTI_20_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/imsqti_v2p0.xsd"; public static final String QTI_21_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/imsqti_v2p1.xsd"; public static final String QTI_RESULT_21_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/imsqti_result_v2p1.xsd"; + public static final String QTI_METADATA_21_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_metadata_v2p1.xsd"; public static final String CP_11_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imscp_v1p1"; public static final String CP_12_NAMESPACE_URI = "http://www.imsglobal.org/xsd/imscp_v1p2"; @@ -56,6 +58,27 @@ public final class QtiConstants { public static final String MATHML_NAMESPACE_URI = "http://www.w3.org/1998/Math/MathML"; public static final String MATHML_SCHEMA_LOCATION = "http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"; + public static final String APIP_CORE_ACCESSIBILITY_URI = "http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0"; + public static final String APIP_CORE_ACCESSIBILITY_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiextv2p1_v1p0.xsd"; + + public static final String APIP_CORE_ITEM_URI = "http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p1"; + public static final String APIP_CORE_ITEM_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiitemv2p1_v1p0.xsd"; + + public static final String APIP_CORE_SECTION_URI = "http://www.imsglobal.org/xsd/apip/apipv1p0/qtisection/imsqti_v2p1"; + public static final String APIP_CORE_SECTION_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtisectionv2p1_v1p0.xsd"; + + public static final String APIP_CORE_TEST_URI = "http://www.imsglobal.org/xsd/apip/apipv1p0/qtitest/imsqti_v2p1"; + public static final String APIP_CORE_TEST_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtitestv2p1_v1p0.xsd"; + + public static final String APIP_CORE_RESPONSE_PROCESSING_URI = "http://www.imsglobal.org/xsd/apip/apipv1p0/qtiresproc/imsqti_v2p1"; + public static final String APIP_CORE_RESPONSE_PROCESSING_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiresprocessingv2p1_v1p0.xsd"; + + public static final String APIP_CORE_OUTCOMES_URI = "http://www.imsglobal.org/xsd/apip/apipv1p0/qtioutcomes/imsqti_v2p1"; + public static final String APIP_CORE_OUTCOMES_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtioutcomesv2p1_v1p0.xsd"; + + public static final String APIP_CORE_QTI_METADATA_URI = "http://www.imsglobal.org/xsd/apip/apipv1p0/qtimetadata/imsqti_v2p1"; + public static final String APIP_CORE_QTI_METADATA_SCHEMA_LOCATION = "http://www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtimetadatav2p1_v1p0.xsd"; + /** Name of duration built-in variable. */ public static final String VARIABLE_DURATION_NAME = "duration"; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java new file mode 100644 index 000000000..3fe03733b --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java @@ -0,0 +1,329 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus; + +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; +import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.RootNode; +import uk.ac.ed.ph.jqtiplus.node.block.ForeignElement; +import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; +import uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing; +import uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration; +import uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult; +import uk.ac.ed.ph.jqtiplus.node.result.ResultNode; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest; + +import java.util.AbstractMap; +import java.util.AbstractMap.SimpleEntry; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Encapsulates the namespace URI and schema location settings for a given QTI/APIP profile. + * TODO : NLQTI, APIP Entry, etc + * + * @author Zack Pierce + */ +public enum QtiProfile { + QTI_20(QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION, + QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION, + QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION, + QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION, + QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION, + QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION, + QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION, + QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION), + + QTI_21_CORE(QtiConstants.QTI_21_NAMESPACE_URI, QtiConstants.QTI_21_SCHEMA_LOCATION, + QtiConstants.QTI_21_NAMESPACE_URI, QtiConstants.QTI_21_SCHEMA_LOCATION, + QtiConstants.QTI_21_NAMESPACE_URI, QtiConstants.QTI_21_SCHEMA_LOCATION, + QtiConstants.QTI_21_NAMESPACE_URI, QtiConstants.QTI_21_SCHEMA_LOCATION, + QtiConstants.QTI_21_NAMESPACE_URI, QtiConstants.QTI_21_SCHEMA_LOCATION, + QtiConstants.QTI_METADATA_21_NAMESPACE_URI, QtiConstants.QTI_METADATA_21_SCHEMA_LOCATION, + QtiConstants.APIP_CORE_ACCESSIBILITY_URI, QtiConstants.APIP_CORE_ACCESSIBILITY_SCHEMA_LOCATION, + QtiConstants.QTI_RESULT_21_NAMESPACE_URI, QtiConstants.QTI_RESULT_21_SCHEMA_LOCATION), + + APIP_CORE(QtiConstants.APIP_CORE_ITEM_URI, QtiConstants.APIP_CORE_ITEM_SCHEMA_LOCATION, + QtiConstants.APIP_CORE_SECTION_URI, QtiConstants.APIP_CORE_SECTION_SCHEMA_LOCATION, + QtiConstants.APIP_CORE_TEST_URI, QtiConstants.APIP_CORE_TEST_SCHEMA_LOCATION, + QtiConstants.APIP_CORE_RESPONSE_PROCESSING_URI, QtiConstants.APIP_CORE_RESPONSE_PROCESSING_SCHEMA_LOCATION, + QtiConstants.APIP_CORE_OUTCOMES_URI, QtiConstants.APIP_CORE_OUTCOMES_SCHEMA_LOCATION, + QtiConstants.APIP_CORE_QTI_METADATA_URI, QtiConstants.APIP_CORE_QTI_METADATA_SCHEMA_LOCATION, + QtiConstants.APIP_CORE_ACCESSIBILITY_URI, QtiConstants.APIP_CORE_ACCESSIBILITY_SCHEMA_LOCATION, + QtiConstants.QTI_RESULT_21_NAMESPACE_URI, QtiConstants.QTI_RESULT_21_SCHEMA_LOCATION); + + private final String itemNamespace; + private final String itemSchemaLocation; + private final String sectionNamespace; + private final String sectionSchemaLocation; + private final String testNamespace; + private final String testSchemaLocation; + private final String responseProcessingNamespace; + private final String responseProcessingSchemaLocation; + private final String outcomesNamespace; + private final String outcomesSchemaLocation; + private final String qtiMetadataNamespace; + private final String qtiMetadataSchemaLocation; + private final String accessibilityNamespace; + private final String accessibilitySchemaLocation; + private final String resultsNamespace; + private final String resultsSchemaLocation; + + private static final Set allNamespacesFromAllProfiles; + private static final Set allSchemaLocationsFromAllProfiles; + private static final List> allNamespaceUriToSchemaLocationPairs; + + static { + final Set uris = new HashSet(); + final Set locations = new HashSet(); + final List> pairs = new ArrayList>(); + for (final QtiProfile profile : QtiProfile.values()) { + for (final String uri : profile.getNamespaceUris()) { + uris.add(uri); + } + for (final String location : profile.getSchemaLocations()) { + locations.add(location); + } + pairs.addAll(profile.getNamespaceUriToSchemaLocationPairs()); + } + allNamespacesFromAllProfiles = ObjectUtilities.unmodifiableSet(uris); + allSchemaLocationsFromAllProfiles = ObjectUtilities.unmodifiableSet(locations); + allNamespaceUriToSchemaLocationPairs = ObjectUtilities.unmodifiableList(pairs); + + } + + private QtiProfile(final String itemNamespace, final String itemSchemaLocation, final String sectionNamespace, final String sectionSchemaLocation, final String testNamespace, final String testSchemaLocation, final String responseProcessingNamespace, final String responseProcessingSchemaLocation, final String outcomesNamespace, final String outcomesSchemaLocation, final String qtiMetadataNamespace, final String qtiMetadataSchemaLocation, final String accessibilityNamespace, final String accessibilitySchemaLocation, final String resultsNamespace, final String resultsSchemaLocation) { + this.itemNamespace = itemNamespace; + this.itemSchemaLocation = itemSchemaLocation; + this.sectionNamespace = sectionNamespace; + this.sectionSchemaLocation = sectionSchemaLocation; + this.testNamespace = testNamespace; + this.testSchemaLocation = testSchemaLocation; + this.responseProcessingNamespace = responseProcessingNamespace; + this.responseProcessingSchemaLocation = responseProcessingSchemaLocation; + this.outcomesNamespace = responseProcessingNamespace; + this.outcomesSchemaLocation = outcomesSchemaLocation; + this.accessibilityNamespace = accessibilityNamespace; + this.accessibilitySchemaLocation = accessibilitySchemaLocation; + this.qtiMetadataNamespace = qtiMetadataNamespace; + this.qtiMetadataSchemaLocation = qtiMetadataSchemaLocation; + this.resultsNamespace = resultsNamespace; + this.resultsSchemaLocation = resultsSchemaLocation; + } + + public String getItemNamespace() { + return itemNamespace; + } + + public String getItemSchemaLocation() { + return itemSchemaLocation; + } + + public String getSectionNamespace() { + return sectionNamespace; + } + + public String getSectionSchemaLocation() { + return sectionSchemaLocation; + } + + public String getTestNamespace() { + return testNamespace; + } + + public String getTestSchemaLocation() { + return testSchemaLocation; + } + + public String getResponseProcessingNamespace() { + return responseProcessingNamespace; + } + + public String getResponseProcessingSchemaLocation() { + return responseProcessingSchemaLocation; + } + + public String getOutcomesNamespace() { + return outcomesNamespace; + } + + public String getOutcomesSchemaLocation() { + return outcomesSchemaLocation; + } + + public String getQtiMetadataNamespace() { + return qtiMetadataNamespace; + } + + public String getQtiMetadataSchemaLocation() { + return qtiMetadataSchemaLocation; + } + + public String getAccessibilityNamespace() { + return accessibilityNamespace; + } + + public String getAccessibilitySchemaLocation() { + return accessibilitySchemaLocation; + } + + public String getResultsNamespace() { + return resultsNamespace; + } + + public String getResultsSchemaLocation() { + return resultsSchemaLocation; + } + + public List getNamespaceUris() { + return Arrays.asList(itemNamespace, sectionNamespace, testNamespace, responseProcessingNamespace, + outcomesNamespace, qtiMetadataNamespace, accessibilityNamespace, resultsNamespace); + } + + public List getSchemaLocations() { + return Arrays.asList(itemSchemaLocation, sectionSchemaLocation, testSchemaLocation, + responseProcessingSchemaLocation, outcomesSchemaLocation, qtiMetadataSchemaLocation, + accessibilitySchemaLocation, resultsSchemaLocation); + } + + public List> getNamespaceUriToSchemaLocationPairs() { + final List> pairs = new ArrayList>(); + pairs.add(new SimpleEntry(itemNamespace, itemSchemaLocation)); + pairs.add(new SimpleEntry(sectionNamespace, sectionSchemaLocation)); + pairs.add(new SimpleEntry(testNamespace, testSchemaLocation)); + pairs.add(new SimpleEntry(responseProcessingNamespace, responseProcessingSchemaLocation)); + pairs.add(new SimpleEntry(outcomesNamespace, outcomesSchemaLocation)); + pairs.add(new SimpleEntry(qtiMetadataNamespace, qtiMetadataSchemaLocation)); + pairs.add(new SimpleEntry(accessibilityNamespace, accessibilitySchemaLocation)); + pairs.add(new SimpleEntry(resultsNamespace, resultsSchemaLocation)); + return pairs; + } + + /** + * + * @param namespaceUri + * @return The first schemalocation paired with the namespace in this profile, if any. null if no matching namespace found. + */ + public String getSchemaLocationForNamespace(final String namespaceUri) { + final List> pairs = this.getNamespaceUriToSchemaLocationPairs(); + for (final SimpleEntry simpleEntry : pairs) { + if (simpleEntry.getKey().equals(namespaceUri)) { + return simpleEntry.getValue(); + } + } + return null; + } + + /** + * Determines the namespace URI appropriate to this node's root + * within this profile. + * + * @param node + * @return A Uri, or an empty string if no known root found + */ + public String getNamespaceForInstanceRoot(final QtiNode node) { + final RootNode root = node.getRootNode(); + if (root instanceof AssessmentItem) { + return this.getItemNamespace(); + } + else if (root instanceof AssessmentSection) { + return this.getSectionNamespace(); + } + else if (root instanceof AssessmentTest) { + return this.getTestNamespace(); + } + else if (root instanceof ResponseProcessing) { + // TODO - consider whether to also allow ResponseProcessingFragment as a root. + return this.getResponseProcessingNamespace(); + } + else if (root instanceof OutcomeDeclaration) { + return this.getOutcomesNamespace(); + } + else if (root instanceof AssessmentResult) { + return this.getResultsNamespace(); + } + return ""; + } + + /** + * @param node + * @return The namespace appropriate for this node within the profile, falling back to the item namespace if not determinable + */ + public String getNamespaceForInstance(final QtiNode node) { + return getNamespaceForInstance(node, getNamespaceForInstanceRoot(node)); + } + + /** + * + * @param node + * @param rootNamespace A pre-computed value for the node's root's namespace. + * @return The namespace appropriate for this node within the profile, falling back to the item namespace if not determinable + */ + public String getNamespaceForInstance(final QtiNode node, final String rootNamespace) { + if (node instanceof ResultNode) { + return this.getResultsNamespace(); + } + else if (node instanceof AccessibilityNode) { + return this.getAccessibilityNamespace(); + } + // TODO - QtiMetadata + else if (node instanceof ForeignElement) { + return ((ForeignElement) node).getNamespaceUri(); + } + else if (node instanceof uk.ac.ed.ph.jqtiplus.node.content.mathml.Math) { + return QtiConstants.MATHML_NAMESPACE_URI; + } + else if (rootNamespace != null && !rootNamespace.isEmpty()) { + return rootNamespace; + } + return this.getItemNamespace(); + } + + public static Set getAllNamespaceUrisFromAllProfiles() { + return allNamespacesFromAllProfiles; + } + + public static Set getAllSchemaLocationsFromAllProfiles() { + return allSchemaLocationsFromAllProfiles; + } + + public static List> getAllNamespaceUriToSchemaLocationPairs() { + return allNamespaceUriToSchemaLocationPairs; + } +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityNode.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityNode.java new file mode 100644 index 000000000..58bb07c17 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessibilityNode.java @@ -0,0 +1,43 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.group.accessibility; + +/** + * Marker interface for nodes in the apipAccessibility information model. + * + * @author Zack Pierce + */ +public interface AccessibilityNode { + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java index edb8b4ec9..6413ea323 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/AudioFileInfoGroup.java @@ -56,12 +56,12 @@ public AudioFileInfoGroup(final QtiNode parent, final String localName, final In /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup#create() */ @Override public AudioFileInfo create() { - return new AudioFileInfo(getParent()); + return new AudioFileInfo(getParent(), getName()); } public List getAudioFileInfos() { diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java index 0ad212c94..2f57f2bee 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/related/NormalizedStringElementGroup.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.group.accessibility.related; import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.NormalizedStringElement; @@ -42,7 +43,8 @@ /** * @author Zack Pierce */ -public class NormalizedStringElementGroup extends SimpleMultipleNodeGroup { +public class NormalizedStringElementGroup extends SimpleMultipleNodeGroup implements + AccessibilityNode { private static final long serialVersionUID = 909398384463659441L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNode.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNode.java index 617b3aff6..e65b547bf 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNode.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNode.java @@ -36,6 +36,7 @@ import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; import uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing; import uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection; import uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest; import java.net.URI; @@ -45,6 +46,7 @@ * * @see RootNodeTypes * @see AssessmentItem + * @see AssessmentSection * @see AssessmentTest * @see AssessmentResult * @see ResponseProcessing diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNodeTypes.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNodeTypes.java index a749db266..3f7e8d3a0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNodeTypes.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/RootNodeTypes.java @@ -34,10 +34,12 @@ package uk.ac.ed.ph.jqtiplus.node; import uk.ac.ed.ph.jqtiplus.QtiConstants; +import uk.ac.ed.ph.jqtiplus.QtiProfile; import uk.ac.ed.ph.jqtiplus.exception.QtiLogicException; import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; import uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing; import uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection; import uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest; import java.net.URI; @@ -62,6 +64,13 @@ public enum RootNodeTypes { */ ASSESSMENT_TEST(AssessmentTest.QTI_CLASS_NAME, AssessmentTest.class), + /** + * Creates assessmentSection root node. + * + * @see AssessmentSection + */ + ASSESSMENT_SECTION(AssessmentSection.QTI_CLASS_NAME, AssessmentSection.class), + /** * Creates assessmentItem root node. * @@ -154,17 +163,17 @@ public static RootNode load(final Element sourceElement, final URI systemId, fin /* Check namespaces */ final String namespaceUri = sourceElement.getNamespaceURI(); if (root instanceof AssessmentResult) { - if (!QtiConstants.QTI_RESULT_21_NAMESPACE_URI.equals(namespaceUri)) { + if (!(QtiProfile.QTI_21_CORE.getResultsNamespace().equals(namespaceUri) || QtiProfile.APIP_CORE.getResultsNamespace().equals(namespaceUri)) ) { throw new IllegalArgumentException("Element {" + namespaceUri + "}" + sourceElement.getLocalName() - + " is not in the correct namespace " + QtiConstants.QTI_RESULT_21_NAMESPACE_URI); + + " is not in a correct results namespace, typically " + QtiConstants.QTI_RESULT_21_NAMESPACE_URI); } } else { - if (!QtiConstants.QTI_21_NAMESPACE_URI.equals(namespaceUri) && !QtiConstants.QTI_20_NAMESPACE_URI.equals(namespaceUri)) { + if (!QtiProfile.getAllNamespaceUrisFromAllProfiles().contains(namespaceUri)) { throw new IllegalArgumentException("Element {" + namespaceUri + "}" + sourceElement.getLocalName() - + " is not in either the QTI 2.1 or 2.0 namespaces"); + + " is not in either the QTI 2.1, QTI 2.0, or APIP 1.0 Core namespaces"); } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java index 4af1af29e..c65f82ea4 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.link.ContentLinkInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RelatedElementInfoGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -49,7 +50,7 @@ * * @author Zack Pierce */ -public class AccessElement extends AbstractNode { +public class AccessElement extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -7875203339228083764L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java index af6b51c92..f3add7f44 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessElementGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public class AccessibilityInfo extends AbstractNode { +public class AccessibilityInfo extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 3607456133476499236L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java index 38381780e..216f8d0ab 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityInfoGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CompanionMaterialsInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.InclusionOrderGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -48,7 +49,7 @@ * * @author Zack Pierce */ -public class ApipAccessibility extends AbstractNode { +public class ApipAccessibility extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 624091309484859804L; /** Name of this class in xml schema. */ diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java index f7fc213a7..94f2f91b8 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/EmptyElement.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public abstract class EmptyElement extends AbstractNode { +public abstract class EmptyElement extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -751561804207938794L; @@ -54,7 +55,7 @@ public EmptyElement(final QtiNode parent, final String qtiClassName) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#hasChildNodes() */ @Override @@ -64,7 +65,7 @@ public boolean hasChildNodes() { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -75,7 +76,7 @@ protected void loadAttributes(final Element element, final LoadingContext contex /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java index b092ddcb0..43ea4d22e 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/FileInfo.java @@ -34,19 +34,22 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility; import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; import org.w3c.dom.Element; +import org.xml.sax.SAXException; /** * Base class for data objects containing a fileHref and a mimeType * * @author Zack Pierce */ -public abstract class FileInfo extends AbstractNode { +public abstract class FileInfo extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -1524033363125950739L; @@ -59,7 +62,7 @@ public FileInfo(final QtiNode parent, final String qtiClassName, final boolean m /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -68,6 +71,11 @@ protected void loadChildren(final Element element, final LoadingContext context) fileHref = XmlParseUtils.getChildContent(element, "fileHref"); } + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + qtiSaxDocumentFirer.fireSimpleElement("fileHref", fileHref); + } + public String getFileHref() { return fileHref; } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java index bf41b39f0..dee7d89a7 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleEnumerateElement.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility; import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -48,7 +49,8 @@ * * @author Zack Pierce */ -public abstract class SingleEnumerateElement & Stringifiable> extends AbstractNode { +public abstract class SingleEnumerateElement & Stringifiable> extends AbstractNode implements + AccessibilityNode { private static final long serialVersionUID = -8448200082436631640L; @@ -64,7 +66,7 @@ public SingleEnumerateElement(final QtiNode parent, final String qtiClassName, f /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#load(org.w3c.dom.Element, uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @Override @@ -74,7 +76,7 @@ public final void load(final Element sourceElement, final LoadingContext context /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -97,7 +99,7 @@ protected void loadChildren(final Element element, final LoadingContext context) /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -108,7 +110,7 @@ protected void loadAttributes(final Element element, final LoadingContext contex /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#hasChildNodes() */ @Override @@ -118,7 +120,7 @@ public boolean hasChildNodes() { /* * (non-Javadoc) - * + * * @see * uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) */ diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java index c85b51cfb..d0a2454dc 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/SingleIntegerElement.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility; import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -49,7 +50,7 @@ * * @author Zack Pierce */ -public class SingleIntegerElement extends AbstractNode { +public class SingleIntegerElement extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -2288768722969592203L; @@ -72,7 +73,7 @@ protected void loadChildren(final Element element, final LoadingContext context) /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -83,7 +84,7 @@ protected void loadAttributes(final Element element, final LoadingContext contex /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#hasChildNodes() */ @Override @@ -93,7 +94,7 @@ public boolean hasChildNodes() { /* * (non-Javadoc) - * + * * @see * uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) */ diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java index db5b64044..6b418cb64 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Calculator.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CalculatorInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CalculatorTypeGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; @@ -43,7 +44,7 @@ * * @author Zack Pierce */ -public class Calculator extends AbstractNode implements CompanionMaterial { +public class Calculator extends AbstractNode implements CompanionMaterial, AccessibilityNode { private static final long serialVersionUID = 1863389297633576964L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java index d5f1941a9..25df34ebb 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class CalculatorInfo extends FileInfo { +public class CalculatorInfo extends FileInfo implements AccessibilityNode { private static final long serialVersionUID = 4984152168422629159L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java index db3401499..754a075f2 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleEnumerateElement; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class CalculatorType extends SingleEnumerateElement { +public class CalculatorType extends SingleEnumerateElement implements AccessibilityNode { private static final long serialVersionUID = 1473701226676474701L; @@ -53,7 +54,7 @@ public CalculatorType(final QtiNode parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.SingleEnumerateElement#parseQtiString(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java index bf48b2a33..8e1e5f33c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CompanionMaterialsInfo.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CompanionMaterialGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -45,7 +46,7 @@ * * @author Zack Pierce */ -public class CompanionMaterialsInfo extends AbstractNode { +public class CompanionMaterialsInfo extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -2322734469468312351L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java index 7b8335495..e71a470f8 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DecimalUnitElement.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -54,7 +55,8 @@ * * @author Zack Pierce */ -public abstract class DecimalUnitElement & Stringifiable> extends AbstractNode { +public abstract class DecimalUnitElement & Stringifiable> extends AbstractNode implements + AccessibilityNode { private static final long serialVersionUID = -90607178471563924L; @@ -87,7 +89,7 @@ public void setDecimal(final BigDecimal decimal) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadAttributes(org.w3c.dom.Element , * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -110,7 +112,7 @@ protected void loadAttributes(final Element element, final LoadingContext contex /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -124,16 +126,12 @@ protected void loadChildren(final Element element, final LoadingContext context) } } - /* - * (non-Javadoc) - * - * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireSaxEvents(uk.ac.ed.ph.jqtiplus - * .serialization.QtiSaxDocumentFirer) + /* (non-Javadoc) + * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) */ @Override - public void fireSaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { - // TODO : Requires some custom handling for direct value here. - super.fireSaxEvents(qtiSaxDocumentFirer); + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + qtiSaxDocumentFirer.fireText(this.decimal.toPlainString()); } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java index 8293d1cbd..a846d165f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Description.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.NormalizedStringElement; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class Description extends NormalizedStringElement { +public class Description extends NormalizedStringElement implements AccessibilityNode { private static final long serialVersionUID = -5879465717015902371L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java index c6757491f..2bf4c8ee4 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class DigitalMaterial extends FileInfo implements CompanionMaterial { +public class DigitalMaterial extends FileInfo implements CompanionMaterial, AccessibilityNode{ private static final long serialVersionUID = 4504325495092703478L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java index 2da822b60..1bd51e462 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearSI.java @@ -33,12 +33,14 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; + /** * FIXME: Document this type * * @author Zack Pierce */ -public class MajorIncrementLinearSI extends DecimalUnitElement { +public class MajorIncrementLinearSI extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -50,7 +52,7 @@ public MajorIncrementLinearSI(final RuleSystemSI parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java index 83422feb3..c3c2afaba 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class MajorIncrementLinearUS extends DecimalUnitElement { +public class MajorIncrementLinearUS extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -52,7 +53,7 @@ public MajorIncrementLinearUS(final QtiNode parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java index 3e3d1cd1a..071ec982a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialSI.java @@ -33,12 +33,14 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; + /** * FIXME: Document this type * * @author Zack Pierce */ -public class MajorIncrementRadialSI extends DecimalUnitElement { +public class MajorIncrementRadialSI extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -50,7 +52,7 @@ public MajorIncrementRadialSI(final RadialIncrementSystemSI parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java index c73891d1a..f345dbacb 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementRadialUS.java @@ -33,12 +33,14 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; + /** * FIXME: Document this type * * @author Zack Pierce */ -public class MajorIncrementRadialUS extends DecimalUnitElement { +public class MajorIncrementRadialUS extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -50,7 +52,7 @@ public MajorIncrementRadialUS(final RadialIncrementSystemUS parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java index 04a9343b1..d2783ac12 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class MinimumLength extends SingleIntegerElement { +public class MinimumLength extends SingleIntegerElement implements AccessibilityNode { private static final long serialVersionUID = -3099958433934984161L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java index e97c8d4a6..096cce15c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearSI.java @@ -33,12 +33,14 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; + /** * FIXME: Document this type * * @author Zack Pierce */ -public class MinorIncrementLinearSI extends DecimalUnitElement { +public class MinorIncrementLinearSI extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -50,7 +52,7 @@ public MinorIncrementLinearSI(final RuleSystemSI parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java index e34d8ab95..59044508d 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementLinearUS.java @@ -33,12 +33,14 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; + /** * FIXME: Document this type * * @author Zack Pierce */ -public class MinorIncrementLinearUS extends DecimalUnitElement { +public class MinorIncrementLinearUS extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -50,7 +52,7 @@ public MinorIncrementLinearUS(final RuleSystemUS parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java index f71dbca21..bf5460973 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialSI.java @@ -33,12 +33,14 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; + /** * FIXME: Document this type * * @author Zack Pierce */ -public class MinorIncrementRadialSI extends DecimalUnitElement { +public class MinorIncrementRadialSI extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -50,7 +52,7 @@ public MinorIncrementRadialSI(final RadialIncrementSystemSI parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java index 8c4376aa9..14954d11f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinorIncrementRadialUS.java @@ -33,12 +33,14 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; + /** * FIXME: Document this type * * @author Zack Pierce */ -public class MinorIncrementRadialUS extends DecimalUnitElement { +public class MinorIncrementRadialUS extends DecimalUnitElement implements AccessibilityNode { private static final long serialVersionUID = 8729041333872417927L; @@ -50,7 +52,7 @@ public MinorIncrementRadialUS(final RadialIncrementSystemUS parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.accessibility.companion.DecimalUnitElement#parseUnit(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java index 7bc69026c..7971a2300 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/PhysicalMaterial.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.NormalizedStringElement; @@ -42,7 +43,7 @@ * * @author Zack Pierce */ -public class PhysicalMaterial extends NormalizedStringElement implements CompanionMaterial { +public class PhysicalMaterial extends NormalizedStringElement implements CompanionMaterial, AccessibilityNode { private static final long serialVersionUID = 5563995507027859438L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java index 174e40526..3bfe8acbb 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.RadialIncrementSystemGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -43,7 +44,7 @@ * * @author Zack Pierce */ -public class Protractor extends AbstractNode implements CompanionMaterial { +public class Protractor extends AbstractNode implements CompanionMaterial, AccessibilityNode { private static final long serialVersionUID = 862855054032106527L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java index cad387efc..be57b5cef 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialSIGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialSIGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -43,7 +44,7 @@ * * @author Zack Pierce */ -public class RadialIncrementSystemSI extends AbstractNode implements RadialIncrementSystem { +public class RadialIncrementSystemSI extends AbstractNode implements RadialIncrementSystem, AccessibilityNode { private static final long serialVersionUID = 2377913760017151553L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java index b2116be01..d595ff8bb 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialUSGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialUSGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -43,7 +44,7 @@ * * @author Zack Pierce */ -public class RadialIncrementSystemUS extends AbstractNode implements RadialIncrementSystem { +public class RadialIncrementSystemUS extends AbstractNode implements RadialIncrementSystem, AccessibilityNode { private static final long serialVersionUID = 7573986330792238975L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java index aa18e40db..476d5892a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class ReadingPassage extends FileInfo implements CompanionMaterial { +public class ReadingPassage extends FileInfo implements CompanionMaterial, AccessibilityNode { private static final long serialVersionUID = -2296060500631152438L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java index c3fbffd78..bf69e50c7 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.LinearRuleSystemGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -43,7 +44,7 @@ * * @author Zack Pierce */ -public class Rule extends AbstractNode implements CompanionMaterial { +public class Rule extends AbstractNode implements CompanionMaterial, AccessibilityNode { private static final long serialVersionUID = 7718173939741152563L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java index ef3159091..d150a5f50 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementLinearSIGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinimumLengthGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearSIGroup; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public class RuleSystemSI extends AbstractNode implements LinearRuleSystem { +public class RuleSystemSI extends AbstractNode implements LinearRuleSystem, AccessibilityNode { private static final long serialVersionUID = 3931136937331215221L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java index 1f6d5d265..dd678389c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementLinearUSGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinimumLengthGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearUSGroup; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public class RuleSystemUS extends AbstractNode implements LinearRuleSystem { +public class RuleSystemUS extends AbstractNode implements LinearRuleSystem, AccessibilityNode { private static final long serialVersionUID = 3204093022466226633L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java index 63e71c131..2f8c90f29 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class AslDefaultOrder extends ElementOrderList { +public class AslDefaultOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = -7164101127069073031L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java index 093b45a52..e70a99986 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class AslOnDemandOrder extends ElementOrderList { +public class AslOnDemandOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = 642737172902802766L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java index ecdf20ca3..b47fcbcb5 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class BrailleDefaultOrder extends ElementOrderList { +public class BrailleDefaultOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = -3913991997025492985L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java index 7b7cf6445..2ec8fc622 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrder.java @@ -34,13 +34,16 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierReferenceAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; import uk.ac.ed.ph.jqtiplus.types.Identifier; import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; import org.w3c.dom.Element; +import org.xml.sax.SAXException; /** * A reference to an accessElement by identifier, and the intended order that accessElement's @@ -48,7 +51,7 @@ * * @author Zack Pierce */ -public class ElementOrder extends AbstractNode { +public class ElementOrder extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -410983290920433202L; @@ -66,6 +69,11 @@ protected void loadChildren(final Element element, final LoadingContext context) order = XmlParseUtils.getChildContentAsInteger(element, "order"); } + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + qtiSaxDocumentFirer.fireSimpleElement("order", order.toString()); + } + public Identifier getIdentifierRef() { return getAttributes().getIdentifierRefAttribute("identifierRef").getValue(); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java index a5ac90a6b..0bb966713 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.ElementOrderGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public abstract class ElementOrderList extends AbstractNode { +public abstract class ElementOrderList extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 4302185581837683599L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java index 9394bf92d..e0a173b7e 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class GraphicsOnlyOnDemandOrder extends ElementOrderList { +public class GraphicsOnlyOnDemandOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = -8890598866649354931L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java index 3ffc18b95..ad3389dfb 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.StandardElementOrderListGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -42,7 +43,7 @@ * * @author Zack Pierce */ -public class InclusionOrder extends AbstractNode { +public class InclusionOrder extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -1269503851231233625L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java index 3391de9e5..053e90841 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class NonVisualDefaultOrder extends ElementOrderList { +public class NonVisualDefaultOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = -3218765627881854346L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java index e96131e31..23037f6d2 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class SignedEnglishDefaultOrder extends ElementOrderList { +public class SignedEnglishDefaultOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = 6278519403559059969L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java index 0371d27f7..270ccac98 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class SignedEnglishOnDemandOrder extends ElementOrderList { +public class SignedEnglishOnDemandOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = 535478176905195639L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java index 2995badb6..b3699a5b0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class TextGraphicsDefaultOrder extends ElementOrderList { +public class TextGraphicsDefaultOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = -8171599174282644231L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java index c939d7b43..37fe37586 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class TextGraphicsOnDemandOrder extends ElementOrderList { +public class TextGraphicsOnDemandOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = -3675282225304964651L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java index 7b8db6ce6..f8155ef16 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class TextOnlyDefaultOrder extends ElementOrderList { +public class TextOnlyDefaultOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = 6428229054625877043L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java index 192df574f..263d9580b 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class TextOnlyOnDemandOrder extends ElementOrderList { +public class TextOnlyOnDemandOrder extends ElementOrderList implements AccessibilityNode { private static final long serialVersionUID = 6625518889535555113L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java index 524d81749..c4ea3f477 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class CharacterLink extends SingleIntegerElement implements StringLink { +public class CharacterLink extends SingleIntegerElement implements StringLink, AccessibilityNode { private static final long serialVersionUID = 6422961217240087811L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java index b1fd23b8e..55e3a29f6 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -47,7 +48,7 @@ * * @author Zack Pierce */ -public class CharacterStringLink extends AbstractNode implements StringLink { +public class CharacterStringLink extends AbstractNode implements StringLink, AccessibilityNode { private static final long serialVersionUID = 4994298956888418294L; @@ -63,7 +64,7 @@ public CharacterStringLink(final QtiNode parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#loadChildren(org.w3c.dom.Element, * uk.ac.ed.ph.jqtiplus.node.LoadingContext) */ @@ -75,14 +76,14 @@ protected void loadChildren(final Element element, final LoadingContext context) /* * (non-Javadoc) - * + * * @see * uk.ac.ed.ph.jqtiplus.node.AbstractNode#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) */ @Override protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { - // TODO : Special handling for outputting our flattened simple elements, startCharacter and stopCharacter. - super.fireBodySaxEvents(qtiSaxDocumentFirer); + qtiSaxDocumentFirer.fireSimpleElement("startCharacter", this.startCharacter.toString()); + qtiSaxDocumentFirer.fireSimpleElement("stopCharacter", this.stopCharacter.toString()); } /** diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java index fbd80b932..2d00af690 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierReferenceAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.link.LinkGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -45,7 +46,7 @@ * * @author Zack Pierce */ -public class ContentLinkInfo extends AbstractNode { +public class ContentLinkInfo extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -3814738853269263616L; @@ -86,7 +87,7 @@ public TextLink getTextLink() { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.node.AbstractNode#validateThis(uk.ac.ed.ph.jqtiplus.validation.ValidationContext) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java index 78aa9f7c2..09a13d29f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class FullString extends EmptyElement implements StringLink { +public class FullString extends EmptyElement implements StringLink, AccessibilityNode { private static final long serialVersionUID = -1557676888910066274L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java index 82bcd6a8d..c12d35433 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class ObjectLink extends EmptyElement implements Link { +public class ObjectLink extends EmptyElement implements Link, AccessibilityNode { private static final long serialVersionUID = 4938414147445323246L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java index cf6a6720f..d7a68f45a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.link.StringLinkGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -48,7 +49,7 @@ * * @author Zack Pierce */ -public class TextLink extends AbstractNode implements Link { +public class TextLink extends AbstractNode implements Link, AccessibilityNode { private static final long serialVersionUID = 7765175490211170308L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java index 7ffe807bd..250fc665f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; @@ -41,7 +42,7 @@ * * @author Zack Pierce */ -public class WordLink extends SingleIntegerElement implements StringLink { +public class WordLink extends SingleIntegerElement implements StringLink, AccessibilityNode { private static final long serialVersionUID = -5938900918101611503L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java index eb351578e..7ba5bfeda 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RemoveTagGroupGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -49,7 +50,7 @@ * * @author Zack Pierce */ -public class AnswerReduction extends AbstractNode { +public class AnswerReduction extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 1659866116384977816L; public static final String QTI_CLASS_NAME = "answerReduction"; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java index aef745f88..a070d0db1 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AudioFileInfo.java @@ -34,14 +34,16 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; -import java.util.Calendar; - +import org.joda.time.LocalTime; import org.w3c.dom.Element; +import org.xml.sax.SAXException; /** * Container for the accessibility content contained in an external audio file. @@ -51,7 +53,7 @@ * * @author Zack Pierce */ -public class AudioFileInfo extends ObjectFileInfo implements ContentLinkIdentifierBearer { +public class AudioFileInfo extends ObjectFileInfo implements ContentLinkIdentifierBearer, AccessibilityNode { private static final long serialVersionUID = -6758112561134526415L; @@ -64,15 +66,21 @@ public class AudioFileInfo extends ObjectFileInfo implements ContentLinkIdentifi private VoiceSpeed voiceSpeed; - // TODO - consider using Joda-Time's LocalTime rather than Calendar, since xsd:time is date-less. - private Calendar startTime; + private LocalTime startTime; - private Calendar duration; + /** + * A duration, represented as a time-of-day to match the (odd) XML representation + */ + private LocalTime duration; public AudioFileInfo(final QtiNode parent) { super(parent, QTI_CLASS_NAME, true); } + public AudioFileInfo(final QtiNode parent, final String localName) { + super(parent, localName, true); + } + @Override protected void loadChildren(final Element element, final LoadingContext context) { super.loadChildren(element, context); @@ -109,7 +117,22 @@ protected void loadChildren(final Element element, final LoadingContext context) context.modelBuildingError(e, element); } } + } + /* (non-Javadoc) + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer) + */ + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + super.fireBodySaxEvents(qtiSaxDocumentFirer); + qtiSaxDocumentFirer.fireSimpleElement(VoiceType.QTI_CLASS_NAME, this.voiceType.toQtiString()); + qtiSaxDocumentFirer.fireSimpleElement(VoiceSpeed.QTI_CLASS_NAME, this.voiceSpeed.toQtiString()); + if (startTime != null) { + qtiSaxDocumentFirer.fireSimpleElement("startTime", DataTypeBinder.toString(startTime)); + } + if (duration != null) { + qtiSaxDocumentFirer.fireSimpleElement("duration", DataTypeBinder.toString(duration)); + } } public VoiceType getVoiceType() { @@ -128,19 +151,19 @@ public void setVoiceSpeed(final VoiceSpeed voiceSpeed) { this.voiceSpeed = voiceSpeed; } - public Calendar getStartTime() { + public LocalTime getStartTime() { return startTime; } - public void setStartTime(final Calendar startTime) { + public void setStartTime(final LocalTime startTime) { this.startTime = startTime; } - public Calendar getDuration() { + public LocalTime getDuration() { return duration; } - public void setDuration(final Calendar duration) { + public void setDuration(final LocalTime duration) { this.duration = duration; } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java index 603d07784..a8f341c41 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -46,7 +47,7 @@ * * @author Zack Pierce */ -public class BrailleText extends AbstractNode { +public class BrailleText extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 5477136156238256916L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java index faebcf15f..25ce01b26 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Chunk.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class Chunk extends EmptyElement { +public class Chunk extends EmptyElement implements AccessibilityNode { private static final long serialVersionUID = -6305016529747908312L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java index 2c7c0e709..d550213b7 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/DefinitionId.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -45,7 +46,7 @@ * * @author Zack Pierce */ -public class DefinitionId extends AbstractNode { +public class DefinitionId extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 5046067935847319414L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java index d9571d7e8..fe89cabd8 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.GuidanceSupportGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public class Guidance extends AbstractNode { +public class Guidance extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -7537570999760584634L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java index 19abd15a9..97e051a8a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/GuidanceSupport.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public class GuidanceSupport extends AbstractNode { +public class GuidanceSupport extends AbstractNode implements AccessibilityNode { private static final String ELEM_TEXT_STRING = "textString"; private static final String ELEM_SUPPORT_ORDER = "supportOrder"; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java index d760d0f9f..f30c953a6 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordEmphasis.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; /** @@ -40,7 +41,7 @@ * * @author Zack Pierce */ -public class KeyWordEmphasis extends EmptyElement { +public class KeyWordEmphasis extends EmptyElement implements AccessibilityNode { private static final long serialVersionUID = -5063781232556512932L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java index d7b6f5a48..0df5a0e0e 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.DefinitionIdGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -48,7 +49,7 @@ * * @author Zack Pierce */ -public class KeyWordTranslation extends AbstractNode { +public class KeyWordTranslation extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -5539729363209564169L; public static final String QTI_CLASS_NAME = "keyWordTranslation"; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java index 60796f649..a32375a06 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/LabelledString.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -49,7 +50,7 @@ * * @author Zack Pierce */ -public class LabelledString extends AbstractNode implements ContentLinkIdentifierBearer { +public class LabelledString extends AbstractNode implements ContentLinkIdentifierBearer, AccessibilityNode { private static final long serialVersionUID = 721887805676767346L; @@ -85,7 +86,9 @@ public boolean hasChildNodes() { @Override protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { - qtiSaxDocumentFirer.fireText(textContent); + if (textContent != null) { + qtiSaxDocumentFirer.fireText(textContent); + } } public String getTextContent() { diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java index 60d3596b7..202999dd0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/MarkupFileEmbedded.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -43,7 +44,7 @@ * * @author Zack Pierce */ -public class MarkupFileEmbedded extends AbstractNode { +public class MarkupFileEmbedded extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -1156517878936311554L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java index e6ed3efee..4bb18a8bd 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ObjectFileInfo.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; import uk.ac.ed.ph.jqtiplus.types.Identifier; @@ -43,7 +44,7 @@ * * @author Zack Pierce */ -public class ObjectFileInfo extends FileInfo implements ContentLinkIdentifierBearer { +public class ObjectFileInfo extends FileInfo implements ContentLinkIdentifierBearer, AccessibilityNode { private static final long serialVersionUID = -4239752002593493052L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java index b5c895e16..832ac2d9a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AnswerReductionGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.BrailleTextGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ChunkGroup; @@ -53,7 +54,7 @@ * * @author Zack Pierce */ -public class RelatedElementInfo extends AbstractNode { +public class RelatedElementInfo extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -3694130873474050407L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java index 2e73636d8..f7a56c9d6 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RemoveTagGroup.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.NormalizedStringElementGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -47,7 +48,7 @@ * * @author Zack Pierce */ -public class RemoveTagGroup extends AbstractNode { +public class RemoveTagGroup extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 820309193192700393L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java index 22d32fb45..105d87ca0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.MarkupFileEmbeddedGroup; @@ -48,7 +49,7 @@ * * @author Zack Pierce */ -public class RevealAlternativeRepresentation extends AbstractNode { +public class RevealAlternativeRepresentation extends AbstractNode implements AccessibilityNode { private static final String ELEM_MARKUP_FILE_INFO = "markupFileInfo"; private static final String ELEM_EXECUTABLE_FILE_INFO = "executableFileInfo"; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java index 910bffca7..ec59ac93f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ScaffoldBehaviorGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -44,7 +45,7 @@ * * @author Zack Pierce */ -public class Scaffold extends AbstractNode { +public class Scaffold extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -77398742244467029L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java index 852814764..b2c52bd0c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/ScaffoldBehavior.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -48,7 +49,7 @@ * * @author Zack Pierce */ -public class ScaffoldBehavior extends AbstractNode { +public class ScaffoldBehavior extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -987626634176615011L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java index c4633c33c..f17c6d924 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/SignFile.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ObjectFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.VideoFileInfoGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -46,7 +47,7 @@ * * @author Zack Pierce */ -public class SignFile extends AbstractNode { +public class SignFile extends AbstractNode implements AccessibilityNode { private static final String ELEM_BONE_ANIMATION_VIDEO_FILE = "boneAnimationVideoFile"; private static final long serialVersionUID = -6661340513986646006L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java index 8672960d2..3adb4d74b 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Signing.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SignFileGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -42,7 +43,7 @@ * * @author Zack Pierce */ -public class Signing extends AbstractNode { +public class Signing extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -8663009705465444076L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java index 63950bc0a..8a028c5ca 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -45,7 +46,7 @@ * * @author Zack Pierce */ -public class Spoken extends AbstractNode { +public class Spoken extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 3704460079478676370L; public static final String QTI_CLASS_NAME = "spoken"; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java index 2d6327966..9de7796ed 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; @@ -52,7 +53,7 @@ * * @author Zack Pierce */ -public class StructuredMask extends AbstractNode { +public class StructuredMask extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = -3598197907209423743L; @@ -75,8 +76,13 @@ protected void loadChildren(final Element element, final LoadingContext context) @Override protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { - // TODO : fire off elements for revealOrder and answerOption - super.fireBodySaxEvents(qtiSaxDocumentFirer); + if (revealOrder != null) { + qtiSaxDocumentFirer.fireSimpleElement("revealOrder", revealOrder.toString()); + } + if (answerOption != null) { + qtiSaxDocumentFirer.fireSimpleElement("answerOption", answerOption.toString()); + } + } public Integer getRevealOrder() { diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java index e243e66e2..9f66f3d1f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java @@ -33,6 +33,7 @@ */ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; @@ -43,7 +44,7 @@ /** * @author Zack Pierce */ -public class TactileFile extends AbstractNode { +public class TactileFile extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 5540725777117688624L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java index 96ee1553f..1bd084dd5 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/VideoFileInfo.java @@ -34,21 +34,23 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.related; import uk.ac.ed.ph.jqtiplus.exception.QtiParseException; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; -import java.util.Calendar; - +import org.joda.time.LocalTime; import org.w3c.dom.Element; +import org.xml.sax.SAXException; /** * FIXME: Document this type * * @author Zack Pierce */ -public class VideoFileInfo extends ObjectFileInfo { +public class VideoFileInfo extends ObjectFileInfo implements AccessibilityNode { public static final String QTI_CLASS_NAME = "videoFileInfo"; @@ -58,9 +60,9 @@ public class VideoFileInfo extends ObjectFileInfo { private static final long serialVersionUID = 5319846662148524016L; - private Calendar startCue; + private LocalTime startCue; - private Calendar endCue; + private LocalTime endCue; public VideoFileInfo(final QtiNode parent) { super(parent, QTI_CLASS_NAME, true); @@ -89,19 +91,36 @@ protected void loadChildren(final Element element, final LoadingContext context) } } - public Calendar getStartCue() { + /* + * (non-Javadoc) + * + * @see uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo#fireBodySaxEvents(uk.ac.ed.ph.jqtiplus.serialization. + * QtiSaxDocumentFirer) + */ + @Override + protected void fireBodySaxEvents(final QtiSaxDocumentFirer qtiSaxDocumentFirer) throws SAXException { + super.fireBodySaxEvents(qtiSaxDocumentFirer); + if (startCue != null) { + qtiSaxDocumentFirer.fireSimpleElement("startCue", DataTypeBinder.toString(startCue)); + } + if (endCue != null) { + qtiSaxDocumentFirer.fireSimpleElement("endCue", DataTypeBinder.toString(endCue)); + } + } + + public LocalTime getStartCue() { return startCue; } - public void setStartCue(final Calendar startCue) { + public void setStartCue(final LocalTime startCue) { this.startCue = startCue; } - public Calendar getEndCue() { + public LocalTime getEndCue() { return endCue; } - public void setEndCue(final Calendar endCue) { + public void setEndCue(final LocalTime endCue) { this.endCue = endCue; } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java index 14da8c58b..dca75e478 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java @@ -75,6 +75,7 @@ * @author Jonathon Hare * @author Jiri Kajaba * @author David McKain + * @author Zack Pierce */ public class AssessmentItem extends AbstractNode implements AssessmentObject { @@ -110,7 +111,7 @@ public class AssessmentItem extends AbstractNode implements AssessmentObject { /** (Implicit) declaration for numAttempts */ private final ResponseDeclaration numAttemptsResponseDeclaration; - /** (Implicit) declaraiton for duration */ + /** (Implicit) declaration for duration */ private final ResponseDeclaration durationResponseDeclaration; /** System ID of this RootNode (optional) */ diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/outcome/declaration/OutcomeDeclaration.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/outcome/declaration/OutcomeDeclaration.java index c6cf0c3d9..bfbbfea1f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/outcome/declaration/OutcomeDeclaration.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/outcome/declaration/OutcomeDeclaration.java @@ -39,6 +39,7 @@ import uk.ac.ed.ph.jqtiplus.attribute.value.UriAttribute; import uk.ac.ed.ph.jqtiplus.group.outcome.declaration.LookupTableGroup; import uk.ac.ed.ph.jqtiplus.node.AssessmentObject; +import uk.ac.ed.ph.jqtiplus.node.RootNode; import uk.ac.ed.ph.jqtiplus.node.shared.VariableDeclaration; import uk.ac.ed.ph.jqtiplus.node.shared.VariableType; import uk.ac.ed.ph.jqtiplus.node.test.View; @@ -50,9 +51,12 @@ /** * Outcome variables are declared by outcome declarations. * + * May also optionally be used as a root node for independent outcome declaration resource + * files with associated standards metadata. + * * @author Jiri Kajaba */ -public final class OutcomeDeclaration extends VariableDeclaration { +public final class OutcomeDeclaration extends VariableDeclaration implements RootNode { private static final long serialVersionUID = -5519664280437668195L; @@ -77,6 +81,9 @@ public final class OutcomeDeclaration extends VariableDeclaration { /** Name of masteryValue attribute in xml schema. */ public static final String ATTR_MASTERY_VALUE_NAME = "masteryValue"; + /** System ID of this RootNode (optional) */ + private URI systemId; + public OutcomeDeclaration(final AssessmentObject parent) { super(parent, QTI_CLASS_NAME); @@ -210,4 +217,21 @@ && getNormalMaximum().doubleValue() < getNormalMinimum().doubleValue()) { + ATTR_NORMAL_MINIMUM_NAME); } } + + @Override + public URI getSystemId() { + return systemId; + } + + @Override + public void setSystemId(final URI systemId) { + this.systemId = systemId; + } + + @Override + public String toString() { + return super.toString() + + "(systemId=" + systemId + + ")"; + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/AssessmentSection.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/AssessmentSection.java index 84d38ed8a..172f551c8 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/AssessmentSection.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/AssessmentSection.java @@ -39,8 +39,10 @@ import uk.ac.ed.ph.jqtiplus.group.test.RubricBlockGroup; import uk.ac.ed.ph.jqtiplus.group.test.SectionPartGroup; import uk.ac.ed.ph.jqtiplus.group.test.SelectionGroup; +import uk.ac.ed.ph.jqtiplus.node.RootNode; import uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock; +import java.net.URI; import java.util.List; /** @@ -49,7 +51,7 @@ * @author Jiri Kajaba * @author Jonathon Hare */ -public final class AssessmentSection extends SectionPart { +public final class AssessmentSection extends SectionPart implements RootNode { private static final long serialVersionUID = 371468215845203409L; @@ -68,6 +70,9 @@ public final class AssessmentSection extends SectionPart { /** Default value of keepTogether attribute. */ public static final boolean ATTR_KEEP_TOGETHER_DEFAULT_VALUE = true; + /** System ID of this RootNode (optional) */ + private URI systemId; + public AssessmentSection(final AbstractPart parent) { super(parent, QTI_CLASS_NAME); @@ -138,4 +143,21 @@ public List getRubricBlocks() { public List getSectionParts() { return getNodeGroups().getSectionPartGroup().getSectionParts(); } + + @Override + public URI getSystemId() { + return systemId; + } + + @Override + public void setSystemId(final URI systemId) { + this.systemId = systemId; + } + + @Override + public String toString() { + return super.toString() + + "(systemId=" + systemId + + ")"; + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReader.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReader.java index 9aa7a88ae..011606914 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReader.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReader.java @@ -149,6 +149,7 @@ public QtiObjectReadResult lookupRootNode(final URI syst final Element rootElement = document.getDocumentElement(); final String rootNamespaceUri = rootElement.getNamespaceURI(); try { + // TODO - update system to allow the loading of arbitrary Qti Xml documents, as would be necessary for X:Include resolution. rootNode = RootNodeTypes.load(rootElement, systemId, loadingContext); } catch (final IllegalArgumentException e) { diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiXmlReader.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiXmlReader.java index 0f6922356..a574ec2c4 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiXmlReader.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/reading/QtiXmlReader.java @@ -35,7 +35,7 @@ import uk.ac.ed.ph.jqtiplus.ExtensionNamespaceInfo; import uk.ac.ed.ph.jqtiplus.JqtiExtensionManager; -import uk.ac.ed.ph.jqtiplus.QtiConstants; +import uk.ac.ed.ph.jqtiplus.QtiProfile; import uk.ac.ed.ph.jqtiplus.internal.util.Assert; import uk.ac.ed.ph.jqtiplus.xmlutils.SchemaCache; import uk.ac.ed.ph.jqtiplus.xmlutils.XmlReadResult; @@ -47,6 +47,7 @@ import uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator; import java.net.URI; +import java.util.AbstractMap.SimpleEntry; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; @@ -101,14 +102,15 @@ public QtiXmlReader(final JqtiExtensionManager jqtiExtensionManager) { public QtiXmlReader(final JqtiExtensionManager jqtiExtensionManager, final SchemaCache schemaCache) { Assert.notNull(jqtiExtensionManager, "jqtiExtensionManager"); - /* Merge extension schemas with core QTI 2.0 and 2.1 schemas */ + /* Merge extension schemas with core QTI 2.0 and 2.1 and Apip schemas */ final Map resultingSchemaMapTemplate = new HashMap(); for (final Entry entry : jqtiExtensionManager.getExtensionNamepaceInfoMap().entrySet()) { resultingSchemaMapTemplate.put(entry.getKey(), entry.getValue().getSchemaLocationUri()); } - resultingSchemaMapTemplate.put(QtiConstants.QTI_21_NAMESPACE_URI, QtiConstants.QTI_21_SCHEMA_LOCATION); - resultingSchemaMapTemplate.put(QtiConstants.QTI_RESULT_21_NAMESPACE_URI, QtiConstants.QTI_RESULT_21_SCHEMA_LOCATION); - resultingSchemaMapTemplate.put(QtiConstants.QTI_20_NAMESPACE_URI, QtiConstants.QTI_20_SCHEMA_LOCATION); + + for (final SimpleEntry pair : QtiProfile.getAllNamespaceUriToSchemaLocationPairs()) { + resultingSchemaMapTemplate.put(pair.getKey(), pair.getValue()); + } this.jqtiExtensionManager = jqtiExtensionManager; this.xmlResourceReader = new XmlResourceReader(JQTIPLUS_PARSER_RESOURCE_LOCATOR, resultingSchemaMapTemplate, schemaCache); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java index 8acb780c4..e1ea7f59a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java @@ -37,14 +37,15 @@ import uk.ac.ed.ph.jqtiplus.JqtiExtensionManager; import uk.ac.ed.ph.jqtiplus.JqtiExtensionPackage; import uk.ac.ed.ph.jqtiplus.QtiConstants; +import uk.ac.ed.ph.jqtiplus.QtiProfile; import uk.ac.ed.ph.jqtiplus.attribute.Attribute; import uk.ac.ed.ph.jqtiplus.attribute.ForeignAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.block.ForeignElement; import uk.ac.ed.ph.jqtiplus.node.expression.operator.CustomOperator; import uk.ac.ed.ph.jqtiplus.node.item.interaction.CustomInteraction; -import uk.ac.ed.ph.jqtiplus.node.result.ResultNode; import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; import uk.ac.ed.ph.jqtiplus.utils.TreeWalkNodeHandler; @@ -91,14 +92,20 @@ public final class QtiSaxDocumentFirer { */ private final Map defaultNamespaceChangeMap; - /** Current default namespace URI */ + /** Current default namespace URI - used for prefix-less serialization in combination with defaultNamespaceChangeMap */ private String currentDefaultNamespaceUri; /** Gets set once we have fired the document Element so that we know not to fire off xsi:schemaLocation again */ private boolean doneStartDocumentElement; - /** Current QTI namespace being written */ - private String currentQtiNamespace; + /** QTI namespace of document root*/ + private String rootQtiNamespace; + + /** + * The namespace Uri of the most recently started element. + */ + private String lastOpenedNamespaceUri; + private int currentQtiDepth; public QtiSaxDocumentFirer(final JqtiExtensionManager jqtiExtensionManager, @@ -117,7 +124,7 @@ public QtiSaxDocumentFirer(final JqtiExtensionManager jqtiExtensionManager, this.defaultNamespaceChangeMap = new HashMap(); this.currentDefaultNamespaceUri = null; this.doneStartDocumentElement = false; - this.currentQtiNamespace = null; + this.rootQtiNamespace = null; this.currentQtiDepth = 0; } @@ -137,14 +144,14 @@ public void prepareFor(final QtiNode node) { final boolean omitSchemaLocation = saxFiringOptions.isOmitSchemaLocation(); /* See if caller wants the NS for this node prefixed */ - final String nodeNsUri = getNodeNamespaceUri(node); - final String nodePreferredPrefix = preferredPrefixMappings.getPrefix(nodeNsUri); + rootQtiNamespace = getNodeNamespaceUri(node); + final String nodePreferredPrefix = preferredPrefixMappings.getPrefix(rootQtiNamespace); if (nodePreferredPrefix!=null) { - requirePrefixMapping(nodeNsUri, nodePreferredPrefix); + requirePrefixMapping(rootQtiNamespace, nodePreferredPrefix); } /* Next traverse the JQTI model to work out what namespaces will be required in the resulting XML */ - final NamespacePreparationHandler handler = new NamespacePreparationHandler(); + final NamespacePreparationHandler handler = new NamespacePreparationHandler(getQtiProfile()); QueryUtils.walkTree(handler, node); /* Put extension prefix mappings in scope */ @@ -176,10 +183,10 @@ public void prepareFor(final QtiNode node) { /* Record QTI schema information for this Node */ if (!omitSchemaLocation) { - /* NB: We are *always* writing out QTI 2.1 */ - final String schemaLocation = getSchemaLocation(node); + /* We are *always* writing out the location of the root namespace, usually QTI 2.1, but possibly a profile-specific URI */ + final String schemaLocation = getSchemaLocation(rootQtiNamespace); if (schemaLocation!=null) { - schemaLocationMap.put(nodeNsUri, schemaLocation); + schemaLocationMap.put(rootQtiNamespace, schemaLocation); } /* Now record schema information for extensions */ @@ -233,12 +240,19 @@ public void fireEndDocumentAndPrefixMappings() throws SAXException { targetHandler.endDocument(); } + /** + * Requires at least one previous call to {@link QtiSaxDocumentFirer#prepareFor(QtiNode)} + * + * @param node + * @throws SAXException + */ public void fireStartQtiElement(final AbstractNode node) throws SAXException { /* Build up attributes */ final AttributesImpl xmlAttributes = new AttributesImpl(); for (final Attribute attribute : node.getAttributes()) { if (attribute.isRequired() || attribute.isSet()) { final String localName = attribute.getLocalName(); + // TODO - handle potential mismatch between the namespace/prefixes used during read and the desired output serialization namespaces final String namespaceUri = attribute.getNamespaceUri(); final String qName = requiredPrefixMappings.getQName(namespaceUri, localName); xmlAttributes.addAttribute(namespaceUri, localName, qName, @@ -246,9 +260,10 @@ public void fireStartQtiElement(final AbstractNode node) throws SAXException { } } + // TODO : update to use more flexible profile namespace selection if (currentQtiDepth==0) { /* This is the opening a new QTI subtree. Decide on correct namespace for native QTI elements */ - currentQtiNamespace = (node instanceof ResultNode) ? QtiConstants.QTI_RESULT_21_NAMESPACE_URI : QtiConstants.QTI_21_NAMESPACE_URI; + rootQtiNamespace = getQtiProfile().getNamespaceForInstance(node); } /* Decide on element namespace */ @@ -260,6 +275,8 @@ public void fireStartQtiElement(final AbstractNode node) throws SAXException { } public void fireStartElement(final Object object, final String localName, final String namespaceUri, final AttributesImpl attributes) throws SAXException { + final AttributesImpl localAttributes = attributes != null ? attributes : new AttributesImpl(); + lastOpenedNamespaceUri = namespaceUri; final String prefix = requiredPrefixMappings.getPrefix(namespaceUri); String qName; if (prefix!=null) { @@ -283,13 +300,13 @@ public void fireStartElement(final Object object, final String localName, final /* Maybe fire xsi:schemaLocation */ if (!doneStartDocumentElement && !saxFiringOptions.isOmitSchemaLocation() && !schemaLocationMap.isEmpty()) { /* Add xsi:schemaLocation attribute */ - attributes.addAttribute(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation", + localAttributes.addAttribute(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation", requiredPrefixMappings.getQName(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation"), "CDATA", createSchemaLocationAttributeValue()); } /* Start element */ - targetHandler.startElement(namespaceUri, localName, qName, attributes); + targetHandler.startElement(namespaceUri, localName, qName, localAttributes); doneStartDocumentElement = true; } @@ -335,7 +352,7 @@ public void fireEndElement(final Object object, final String localName, final St public void fireEndQtiElement(final AbstractNode node) throws SAXException { fireEndElement(node, node.getQtiClassName(), getNodeNamespaceUri(node)); if (--currentQtiDepth==0) { - currentQtiNamespace = null; + rootQtiNamespace = null; } } @@ -343,47 +360,33 @@ public void fireText(final String string) throws SAXException { targetHandler.characters(string.toCharArray(), 0, string.length()); } + /** + * Fires a textual element, namespaced the same as the last opened XML tag. + * @param localName + * @param content + */ + public void fireSimpleElement(final String localName, final String content) throws SAXException { + this.fireStartElement(content, localName, lastOpenedNamespaceUri, null); + this.fireText(content); + this.fireEndElement(content, localName, lastOpenedNamespaceUri); + } + //----------------------------------------------- + public QtiProfile getQtiProfile() { + return this.saxFiringOptions.getQtiProfile(); + } + private String getNodeNamespaceUri(final QtiNode node) { - String namespaceUri = ""; - if (node instanceof ForeignElement) { - namespaceUri = ((ForeignElement) node).getNamespaceUri(); - } - else if (node instanceof uk.ac.ed.ph.jqtiplus.node.content.mathml.Math) { - namespaceUri = QtiConstants.MATHML_NAMESPACE_URI; + final QtiProfile profile = getQtiProfile(); + if (rootQtiNamespace != null) { + profile.getNamespaceForInstance(node, rootQtiNamespace); } - else if (currentQtiNamespace!=null) { - namespaceUri = currentQtiNamespace; - } - else if (node instanceof ResultNode) { - namespaceUri = QtiConstants.QTI_RESULT_21_NAMESPACE_URI; - } - // TODO - handle APIP Accessibility related nodes - else { - namespaceUri = QtiConstants.QTI_21_NAMESPACE_URI; - } - return namespaceUri; + return profile.getNamespaceForInstance(node); } - private String getSchemaLocation(final QtiNode node) { - final String schemaLocation; - if (node instanceof ForeignElement) { - schemaLocation = null; /* Can't do anything here? */ - } - else if (node instanceof uk.ac.ed.ph.jqtiplus.node.content.mathml.Math) { - schemaLocation = QtiConstants.MATHML_SCHEMA_LOCATION; - } - else if (node instanceof ResultNode) { - /* (These Nodes have a different schema) */ - schemaLocation = QtiConstants.QTI_RESULT_21_SCHEMA_LOCATION; - } - //TODO - handle APIP Accessibility related nodes - else { - /* (NB: We are *always* writing out QTI 2.1) */ - schemaLocation = QtiConstants.QTI_21_SCHEMA_LOCATION; - } - return schemaLocation; + private String getSchemaLocation(final String namespaceUri) { + return getQtiProfile().getSchemaLocationForNamespace(namespaceUri); } //----------------------------------------------- @@ -399,6 +402,12 @@ private final class NamespacePreparationHandler implements TreeWalkNodeHandler { private final Set> usedExtensionPackages = new HashSet>(); private final Set nonQtiElementNamespaceUris = new HashSet(); private final Set attributeNamespaceUris = new HashSet(); + private final QtiProfile qtiProfile; + + private NamespacePreparationHandler(final QtiProfile qtiProfile) { + this.qtiProfile = qtiProfile; + } + @Override public boolean handleNode(final QtiNode node) { @@ -415,7 +424,9 @@ else if (node instanceof CustomInteraction) { usedExtensionPackages.add(jqtiExtensionPackage); } } - /* TODO: If we add support for apip:accessibility, check for it here */ + if (node instanceof AccessibilityNode) { + nonQtiElementNamespaceUris.add(qtiProfile.getAccessibilityNamespace()); + } /* Check for use of MathML */ if (node instanceof uk.ac.ed.ph.jqtiplus.node.content.mathml.Math) { diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/SaxFiringOptions.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/SaxFiringOptions.java index 5bad3b171..dfd98651e 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/SaxFiringOptions.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/SaxFiringOptions.java @@ -33,12 +33,13 @@ */ package uk.ac.ed.ph.jqtiplus.serialization; +import uk.ac.ed.ph.jqtiplus.QtiProfile; import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; import java.io.Serializable; /** - * Encapsulates options for serializing QTI Object by firing SAX events. + * Encapsulates immutable options for serializing QTI Object by firing SAX events. * * @see QtiSaxDocumentFirer * @@ -49,30 +50,47 @@ public final class SaxFiringOptions implements Serializable { private static final long serialVersionUID = -7438651199833877599L; private final NamespacePrefixMappings preferredPrefixMappings; - private boolean omitSchemaLocation; + private final boolean omitSchemaLocation; + private final QtiProfile qtiProfile; + public SaxFiringOptions() { - this.preferredPrefixMappings = new NamespacePrefixMappings(); - this.omitSchemaLocation = false; + this(false, QtiProfile.QTI_21_CORE, null); + } + + public SaxFiringOptions(final QtiProfile qtiProfile) { + this(false, qtiProfile, null); } + public SaxFiringOptions(final boolean omitSchemaLocation) { + this(omitSchemaLocation, QtiProfile.QTI_21_CORE, null); + } + + public SaxFiringOptions(final boolean omitSchemaLocation, final QtiProfile qtiProfile) { + this(omitSchemaLocation, qtiProfile, null); + } + + public SaxFiringOptions(final boolean omitSchemaLocation, final QtiProfile qtiProfile, final NamespacePrefixMappings namespacePrefixMappings) { + this.preferredPrefixMappings = new NamespacePrefixMappings(namespacePrefixMappings); + this.omitSchemaLocation = omitSchemaLocation; + this.qtiProfile = qtiProfile; + } public NamespacePrefixMappings getPreferredPrefixMappings() { return preferredPrefixMappings; } - public boolean isOmitSchemaLocation() { return omitSchemaLocation; } - public void setOmitSchemaLocation(final boolean omitSchemaLocation) { - this.omitSchemaLocation = omitSchemaLocation; + public QtiProfile getQtiProfile() { + return qtiProfile; } - @Override public String toString() { return ObjectUtilities.beanToString(this); } + } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java index 22385f633..8341014a9 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/types/DataTypeBinder.java @@ -40,9 +40,9 @@ import java.math.BigDecimal; import java.net.URI; import java.net.URISyntaxException; -import java.util.Calendar; -import javax.xml.bind.DatatypeConverter; +import org.joda.time.LocalTime; +import org.joda.time.format.ISODateTimeFormat; /** * Helper class to bind certain QTI data types to and from Strings. @@ -235,13 +235,24 @@ public static BigDecimal parseBigDecimal(final String string) { * @param iso8601Time A string containing the ISO 8601 representation of time used by the xsd:time datatype * @return */ - public static Calendar parseTime(final String iso8601Time) throws QtiParseException { + public static LocalTime parseTime(final String iso8601Time) throws QtiParseException { try { - return DatatypeConverter.parseTime(iso8601Time); + return ISODateTimeFormat.localTimeParser().parseLocalTime(iso8601Time); + } + catch (final UnsupportedOperationException e) { + throw new QtiParseException("Invalid time '" + iso8601Time + "'", e); } catch (final IllegalArgumentException e) { throw new QtiParseException("Invalid time '" + iso8601Time + "'", e); } } + /** + * @param localTime + * @return A string containing the ISO 8601 representation of the calendar's time used by the xsd:time datatype + */ + public static String toString(final LocalTime localTime) { + return ISODateTimeFormat.time().print(localTime); + } + } diff --git a/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiextv2p1_v1p0.xsd b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiextv2p1_v1p0.xsd new file mode 100644 index 000000000..204e89a49 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiextv2p1_v1p0.xsd @@ -0,0 +1,1001 @@ + + + + + + + XSD Data File Information + ========================= + Author: Colin Smythe + Date: 30th April, 2012 + Version: 1.0 + Status: Final Release + Description: This is the data model for the Accessible Portable Item Protocol (APIP) v1.0 . + This defines the set of QTIv2.1 extensions. + + History: Version 1.0 - the first release of this APIP v1.0 PSM data model extensions for QTIv2.1. + + License: IPR, License and Distribution Notices + + This machine readable file is derived from IMS Global specification IMS Accessible Portable Item Protocol (APIP) Version 1.0 + found at http://www.imsglobal.org/apip and the original IMS Global schema binding or code base + http://www.imsglobal.org/apip. + + Recipients of this document are requested to submit, with their comments, notification of any + relevant patent claims or other intellectual property rights of which they may be aware that might be + infringed by the schema binding contained in this document. + + IMS Global takes no position regarding the validity or scope of any intellectual property or other + rights that might be claimed to pertain to the implementation or use of the technology described in this + document or the extent to which any license under such rights might or might not be available; neither + does it represent that it has made any effort to identify any such rights. Information on IMS Global + procedures with respect to rights in IMS Global specifications can be found at the IMS Global Intellectual Property + Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. + + Copyright (c) IMS Global Learning Consortium 1999-2013. All Rights Reserved. + + License Notice for Users + + Users of products or services that include this document are hereby granted a worldwide, royalty-free, + non-exclusive license to use this document. + + Distribution Notice for Developers + + Developers of products or services that are not original incorporators of this document and + have not changed this document, that is, are distributing a software product that incorporates this + document as is from a third-party source other than IMS, are hereby granted permission to copy, + display and distribute the contents of this document in any medium for any purpose without fee or + royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL + copies, or portions thereof. + + Developers of products or services that are original incorporators of this document and wish + to provide distribution of this document as is or with modifications and developers of products and + services that are not original incorporators of this document and have changed this document, are + required to register with the IMS Global community on the IMS Global website as described in the following two + paragraphs:- + + * If you wish to distribute this document as is, with no modifications, you are hereby granted + permission to copy, display and distribute the contents of this document in any medium for any + purpose without fee or royalty provided that you include this IPR, License and Distribution notice in + its entirety on ALL copies, or portions thereof, that you make and you complete a valid license + registration with IMS and receive an email from IMS granting the license. To register, follow the + instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once + registered you are granted permission to transfer unlimited distribution rights of this document for the + purposes of third-party or other distribution of your product or service that incorporates this + document as long as this IPR, License and Distribution notice remains in place in its entirety; + + * If you wish to create and distribute a derived work from this document, you are hereby + granted permission to copy, display and distribute the contents of the derived work in any medium for + any purpose without fee or royalty provided that you include this IPR, License and Distribution + notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid + profile registration with IMS Global and receive an email from IMS Global granting the license. To register, follow + the instructions on the IMS Global website: http://www.imsglobal.org/profile/. Once registered you are + granted permission to transfer unlimited distribution rights of the derived work for the purposes of + third-party or other distribution of your product or service that incorporates the derived work as long + as this IPR, License and Distribution notice remains in place in its entirety. + + The limited permissions granted above are perpetual and will not be revoked by IMS Global or its + successors or assigns. + + THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS + EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM + NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF + ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. + + Source UML File Information + =========================== + The source file information must be supplied as an XMI file (without diagram layout information). + The supported UML authoring tools are: + (a) Poseidon - v6 (and later) + + Source XSLT File Information + ============================ + XSL Generator: Specificationv1p0_GenerationToolv1.xsl + XSLT Processor: Saxon-HE-9.4.0.4 + Release: 1.0 + Date: 31st January, 2013 + Autogen Engineer: Colin Smythe (IMS Global, UK) + Autogen Date: 2013-03-22Z + + IMS Global Auto-generation Binding Tool-kit (I-BAT) + =================================================== + This file was auto-generated using the IMS Global Binding Auto-generation Tool-kit (I-BAT). While every + attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware + that this is an experimental tool. Permission is given to make use of this tool. IMS Global makes no + claim on the materials created by third party users of this tool. Details on how to use this tool + are contained in the IMS Global "I-BAT" documentation available at the IMS Global web-site: + http://www.imsglobal.org. + + Tool Copyright: 2012-2013 (c) IMS Global Learning Consortium Inc. All Rights Reserved. + + + + + + Schematron Strict Selection Validation Rules + ============================================ + This is the set of Schematron rules that have been created to enforce the use of the "Unordered" stereotype. + These rules ensure that the number of entries in an unordered complexType of an element obey the multiplicity constraints. + This is required so that any-order/any-multiplicity complexTypes can be constructed and validated. + + + + Schematron validation rules for the enforcement of the Unordered stereotype. + + + + [RULESET] For the CompanionMaterialsInfo.Type complexType. + + + + + [RULE for Local Attribute 1] Invalid number of "calculator" elements: . + + + + + + + + + + [RULESET] For the InclusionOrder.Type complexType. + + + + + [RULE for Local Attribute 1] Invalid number of "brailleDefaultOrder" elements: . + + + + [RULE for Local Attribute 2] Invalid number of "textOnlyDefaultOrder" elements: . + + + + [RULE for Local Attribute 3] Invalid number of "textOnlyOnDemandOrder" elements: . + + + + [RULE for Local Attribute 4] Invalid number of "textGraphicsDefaultOrder" elements: . + + + + [RULE for Local Attribute 5] Invalid number of "textGraphicsOnDemandOrder" elements: . + + + + [RULE for Local Attribute 6] Invalid number of "graphicsOnlyOnDemandOrder" elements: . + + + + [RULE for Local Attribute 7] Invalid number of "nonVisualDefaultOrder" elements: . + + + + [RULE for Local Attribute 8] Invalid number of "aslDefaultOrder" elements: . + + + + [RULE for Local Attribute 9] Invalid number of "aslOnDemandOrder" elements: . + + + + [RULE for Local Attribute 10] Invalid number of "signedEnglishDefaultOrder" elements: . + + + + [RULE for Local Attribute 11] Invalid number of "signedEnglishOnDemandOrder" elements: . + + + + + + + + + + [RULESET] For the RelatedElementInfo.Type complexType. + + + + + [RULE for Local Attribute 1] Invalid number of "spoken" elements: . + + + + [RULE for Local Attribute 2] Invalid number of "brailleText" elements: . + + + + [RULE for Local Attribute 3] Invalid number of "tactileFile" elements: . + + + + [RULE for Local Attribute 4] Invalid number of "signing" elements: . + + + + [RULE for Local Attribute 5] Invalid number of "keyWordTranslation" elements: . + + + + [RULE for Local Attribute 6] Invalid number of "revealAlternativeRepresentation" elements: . + + + + [RULE for Local Attribute 7] Invalid number of "guidance" elements: . + + + + [RULE for Local Attribute 8] Invalid number of "structuredMask" elements: . + + + + [RULE for Local Attribute 9] Invalid number of "scaffold" elements: . + + + + [RULE for Local Attribute 10] Invalid number of "chunk" elements: . + + + + [RULE for Local Attribute 11] Invalid number of "answerReduction" elements: . + + + + [RULE for Local Attribute 12] Invalid number of "keyWordEmphasis" elements: . + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any namespaced element from any namespace may be included within an "any" element. + The namespace for the imported element must be defined in the instance, and the schema must be imported. + The extension has a definition of "strict" i.e. they must have their own namespace. + + + + + + + + + + + Any namespaced element from any namespace may be included within an "any" element. + The namespace for the imported element must be defined in the instance, and the schema must be imported. + The extension has a definition of "lax" i.e. they can reuse elements from the target namespace. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The AccessElement complexType is the container for the accessibility information defined as an access element i.e. the atomic unity for the new accessibility content. Each access element has a unique identifier and points to the source content (either in the original QTI content or to another access element). An access element can refer to more than one source content structure. + + + + + + + + + + + + + The AccessibilityInfo complexType is the container for all of the new content defined for teh set of accessibility features. + + + + + + + + + + + The AnswerReduction complexType is the container for the instructions on how answer reduction is to be achieved. The reduction process is defined in terms of groups that are handled separately. + + + + + + + + + + + The APIPAccessibility complexType is the top level container for all of the APIP information used to describe the accessibility features to be added to a QTI XML description of a QTI Item. This optional information consists of: companion materials, the inclusion orders to be used rendering the content in trems of the new accessibility information, and the set of accessibility information itself. + + + + + + + + + + + + + + The AudioFileInfo complexType is the container for the accessibility content contained in an external audio file. The start and durations are supplied so that one audio file can be used to support more than one accessibility element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The BrailleText complexType is the container for the text string that is to be passed to a Braile reader. + + + + + + + + + + + The Calculator complexType is the container for the information on the permitted type of calculator available for use with the APIP Items. A human readable description of the calculator should also be available. + + + + + + + + + + + + + + + + + + + + + + The CharacterStringLink is the container for the identification of the start and stop characters to which the text link refers. + + + + + + + + + + + + The CompanionMaterialsInfo complexType is the container for information about materials and tools that the examinee is expected to work with while performing the relevant QTI Item(s). These materials and tools may include a reading passage, rule, protractor, calculator, etc. + + + + + + + + + + + + + + + + + The ContentLinkInfo complexType is the container for the link information between the new accessibility information and the original content (this can be in the original QTI or another piece of accessibility information). The link can refer to a string, a word, a character or an object. + + + + + + + + + + + + + + The DefinitionId complexType is the container for the keyword translation for a specific language for the associated text. + + + + + + + + + + + + The ElementOrder complexType is the container for the identification of the order in which the associated accessibility element (identified by the 'identifierRef' value). + + + + + + + + + + + + The ElementOrderList is the complexType container for the definition of the order in which the set of accessibility elements are to be applied for the associated accessibility support. + + + + + + + + + + + The Guidance complexType is the container for the content to provide guidance through the original material. The gidance takes the form of supporting language learners and those requiring cognitive guidance. + + + + + + + + + + + + The GuidanceSupport complexType is the container for the definition of the order in which the guidance is to be presented and the text string used as part of the guidance. + + + + + + + + + + + + The InclusionOrder complexType is the container for the inclusion order for the set of accessibility elements for each of the accessibility capabilities. Only those accessibility capabilities addressed in the instance are provided i.e. an instace is NOT required to provide information for all of these capabilities. Note that there is no preferred order for this set of inclusion order descriptions. + + + + + + + + + + + + + + + + + + + + + + The IncrementSI complexType is the container for the simple specification of the Protractor, using SI units, to be used with the set of APIP Items. The Protractor is defined in terms of its increment resolutions. + + + + + + + + + + + + The IncrementUS complexType is the container for the simple specification of the Protractor, using US units, to be used with the set of APIP Items. The Protractor is defined in terms of its increment resolutions. + + + + + + + + + + + + The ItemFileInfo complexType is the for the 'href' pointer to an external file. The 'href' should contain sufficient information for the correct location of the file within the associated Content Package (all files must be contained within the content package that is used to contained the APIP Item). + + + + + + + + + + + + The KeyWordTranslation complexType is the container for the keyword translation text content. Support for multiple languages is provided. + + + + + + + + + + + The MarkupFileEmbedded complexType is the container for the alternative markup content i.e.the markup is embedded in the instance file. + + + + + + + + + + + The ObjectFileInfo complexType is the container for the file reference to the external object. + + + + + + + + + + + + + The Protractor complexType is the container for the specification of the protractor tool that is to be used to support the APIP Items. The Protractor is defined in terms of its radial resolution. A human readable description of the tool should also be available.. + + + + + + + + + + + + + + + The RelatedElementInfo complexType is the container for the accessibility information for a specific access element. Only those accessibility capabilities supported for an instance are included. Note that there is no preferred order for this information. + + + + + + + + + + + + + + + + + + + + + + + The RemoveTagGroup complexType is the container for the answer reduction instructions for the associated group. + + + + + + + + + + + + The RevealAlternativeRepresentation complexType is the container for the alternative representation that is to be rendered. Note that each alternative representation must be defined as its own access element. + + + + + + + + + + + + + + + + + + + The Rule complexType is the container for the simple specification of the Rule to be used with the set of APIP Items. + + + + + + + + + + + + + + + The Scaffold complexType is the container for the scaffolding accessibility content. Each piece of scaffolding has an associated order of revelation for the alternative content.. + + + + + + + + + + + + The ScaffoldBehavior complexType is the container for the scaffolding. This content can take the form of audio, text and verbal materials. + + + + + + + + + + + + + The SignFile complexType is the container for the links to the external signing files. Signing is available as video or bone animation files. + + + + + + + + + + + + The Signing complexType is the container for the instructions for the provision of signing. ASL and Signed English are the supported modes for signing. + + + + + + + + + + + + The SIRuleSystem complexType is the container for the simple specification of the Rule, using SI units, to be used with the set of APIP Items. The Rule is defined in terms of its length and increment resolution. + + + + + + + + + + + + + The Spoken complexType is the container for the spoken accessibility content as an alternative to visual content. + + + + + + + + + + + + + The StructuredMask complexType is the container for the settings to be aplied to a structured mask usage. The settings are the order of revelation for this object and whether or not it is to be applied to the answer fields of a question.. + + + + + + + + + + + + The TactileFile complexType is the container for the audio/Braille accessibility content as an alternative to tactile content. + + + + + + + + + + + + + The TextLink complexType is the container for the information that is used to identify the object in the original content that the new accessibility content is to replace. + + + + + + + + + + + + + + The USRuleSystem complexType is the container for the simple specification of the Rule, using US units, to be used with the set of APIP Items. The Rule is defined in terms of its length and increment resolution. + + + + + + + + + + + + + The VideoFileInfo complexType is the container for the accessibility content contained in an external video file. The start and end points are supplied so that one video file can be used to support more than one accessibility element. + + + + + + + + + + + + + + + + + + + The LabelledString derivedType is the container for the text string labels that have their own content link identifier. + + + + + + + + + + + + + The RadialSIValue derivedType is the container for the radial measurements in terms of SI units. + + + + + + + + + + + + + + + + + + + The RadialUSValue derivedType is the container for the radial measurements in terms of US units. + + + + + + + + + + + + + + + + + + + + + The SILinearValue derivedType is the container for the linear measurements in terms of an SI unit. + + + + + + + + + + + + + + + + + + + + + + The USLinearValue derivedType is the container for the linear measurements in terms of US units. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiitemv2p1_v1p0.xsd b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiitemv2p1_v1p0.xsd new file mode 100644 index 000000000..06eb3305d --- /dev/null +++ b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiitemv2p1_v1p0.xsd @@ -0,0 +1,9258 @@ + + + + + + + + + + XSD Data File Information + ========================= + Author: Colin Smythe (IMS Global) + Date: 31st July, 2012 + Version: Final 1.0 + Status: Final Release + Description: This is the Platform Specific Model of the APIPv1.0 profile of the IMS QTI v2.1 Information Model. + This is the Core level profile for APIPv1.0 QTIv2.1 Items. + + History: This is the first version of the APIPv1.0 QTIv2.1 Item Profile. + + PROFILE: This is the "APIP-Item (Core)". THIS IS A PROFILE OF THE BASE SPECIFICATION. + The changes to the base specification are: + * The schema namespace has been changed to "http://www.imsglobal.org/xsd/apip/apipv1p0/qtiitem/imsqti_v2p1". + * The schema version has been changed to "IMS APIP 1.0 QTI 2.1 ITEM". + * The "AssessmentItemRef" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSection" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSectionRef" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSectionSelection" class/complexType and set of XML attributes have been deleted; + * The "AssessmentTest" class/complexType and set of XML attributes have been deleted; + * The "BranchRule" class/complexType and set of XML attributes have been deleted; + * The "Ordering" class/complexType and set of XML attributes have been deleted; + * The "SectionPart" class/complexType and set of XML attributes have been deleted; + * The "Selection" class/complexType and set of XML attributes have been deleted; + * The "TemplateDefault" class/complexType and set of XML attributes have been deleted; + * The "TestFeedback" class/complexType and set of XML attributes have been deleted; + * The "TestPart" class/complexType and set of XML attributes have been deleted; + * The "TimeLimits" class/complexType and set of XML attributes have been deleted; + * The "VariableMapping" class/complexType and set of XML attributes have been deleted; + * The "Weight" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItem" class/complexType has been modified by:- + - The "apipAccessibility" attribute has been made required i.e. multiplicity [1..1]; + + License: IPR, License and Distribution Notices + + This machine readable file is derived from IMS Global specification IMS Question and Test Interoperability (QTI) Version 2.1 + found at http://www.imsglobal.org/qti and the original IMS Global schema binding or code base + http://www.imsglobal.org/qti. + + Recipients of this document are requested to submit, with their comments, notification of any + relevant patent claims or other intellectual property rights of which they may be aware that might be + infringed by the schema binding contained in this document. + + IMS Global takes no position regarding the validity or scope of any intellectual property or other + rights that might be claimed to pertain to the implementation or use of the technology described in this + document or the extent to which any license under such rights might or might not be available; neither + does it represent that it has made any effort to identify any such rights. Information on IMS Global + procedures with respect to rights in IMS Global specifications can be found at the IMS Global Intellectual Property + Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. + + Copyright (c) IMS Global Learning Consortium 1999-2013. All Rights Reserved. + + License Notice for Users + + Users of products or services that include this document are hereby granted a worldwide, royalty-free, + non-exclusive license to use this document. + + Distribution Notice for Developers + + Developers of products or services that are not original incorporators of this document and + have not changed this document, that is, are distributing a software product that incorporates this + document as is from a third-party source other than IMS, are hereby granted permission to copy, + display and distribute the contents of this document in any medium for any purpose without fee or + royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL + copies, or portions thereof. + + Developers of products or services that are original incorporators of this document and wish + to provide distribution of this document as is or with modifications and developers of products and + services that are not original incorporators of this document and have changed this document, are + required to register with the IMS Global community on the IMS Global website as described in the following two + paragraphs:- + + * If you wish to distribute this document as is, with no modifications, you are hereby granted + permission to copy, display and distribute the contents of this document in any medium for any + purpose without fee or royalty provided that you include this IPR, License and Distribution notice in + its entirety on ALL copies, or portions thereof, that you make and you complete a valid license + registration with IMS and receive an email from IMS granting the license. To register, follow the + instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once + registered you are granted permission to transfer unlimited distribution rights of this document for the + purposes of third-party or other distribution of your product or service that incorporates this + document as long as this IPR, License and Distribution notice remains in place in its entirety; + + * If you wish to create and distribute a derived work from this document, you are hereby + granted permission to copy, display and distribute the contents of the derived work in any medium for + any purpose without fee or royalty provided that you include this IPR, License and Distribution + notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid + profile registration with IMS Global and receive an email from IMS Global granting the license. To register, follow + the instructions on the IMS Global website: http://www.imsglobal.org/profile/. Once registered you are + granted permission to transfer unlimited distribution rights of the derived work for the purposes of + third-party or other distribution of your product or service that incorporates the derived work as long + as this IPR, License and Distribution notice remains in place in its entirety. + + The limited permissions granted above are perpetual and will not be revoked by IMS Global or its + successors or assigns. + + THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS + EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM + NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF + ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. + + Source UML File Information + =========================== + The source file information must be supplied as an XMI file (without diagram layout information). + The supported UML authoring tools are: + (a) Poseidon - v6 (and later) + + Source XSLT File Information + ============================ + XSL Generator: Specificationv1p0_GenerationToolv1.xsl + XSLT Processor: Saxon-HE-9.4.0.4 + Release: 1.0 + Date: 31st March, 2013 + Autogen Engineer: Colin Smythe (IMS Global, UK) + Autogen Date: 2013-04-30 + + IMS Global Auto-generation Binding Tool-kit (I-BAT) + =================================================== + This file was auto-generated using the IMS Global Binding Auto-generation Tool-kit (I-BAT). While every + attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware + that this is an experimental tool. Permission is given to make use of this tool. IMS Global makes no + claim on the materials created by third party users of this tool. Details on how to use this tool + are contained in the IMS Global "I-BAT" documentation available at the IMS Global web-site: + http://www.imsglobal.org. + + Tool Copyright: 2012-2013 (c) IMS Global Learning Consortium Inc. All Rights Reserved. + + + + + + Definition of Schematron Validation Rules + ========================================= + Author: Colin Smythe (IMS Global) + Date: 31st October, 2012 + Version: 1.0 + Status: Final Release + + Description: This is the set of Schematron Rules to further enforce the QTIv2.1 Information Model. The rule sets that have been defined are: + + [RULE SET GENERAL 1] Ensure that certain expressions are NOT used for Response Processing. + [RULE SET GENERAL 2] Ensure that the Item, Section, Test and TestPart identifiers are unique. + [RULE SET GENERAL 3] Ensure that AssessmentItem Response Declarations are correct. + [RULE SET INTERACTION 1] Enforce the correct use the TextEntryInteraction attributes. + + RULE SET GENERAL 1: Ensure that certain expressions are NOT used for Response Processing. The set of rules are:- + * RULE GENERAL 1a-Assertion 1 :- The expression numberCorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 2 :- The expression numberIncorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 3 :- The expression numberPresented must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 4 :- The expression numberResponded must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 5 :- The expression numberSelected must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 6 :- The expression outcomeMinimum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 7 :- The expression outcomeMaximum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 8 :- The expression testVariables must NOT be used in Response Processing. + + RULE SET GENERAL 2: Ensure that the Item, Section, Test and TestPart identifiers are unique. The set of rules are:- + * RULE GENERAL 2a-Assertion 1 :- The AssessmentTest and a TestPart must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 2 :- The AssessmentTest and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 3 :- The AssessmentTest and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 4 :- The AssessmentTest and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 5 :- The AssessmentTest and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 1 :- Two TestParts must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 2 :- The TestPart and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 3 :- The TestPart and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 4 :- The TestPart and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 5 :- The TestPart and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 1 :- Two AssessmentSection children of a TestPart must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 2 :- The AssessmentSection and a descendant AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 3 :- The AssessmentSection and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 4 :- The AssessmentSection and a descendant AssessmentItemRef must not have the same unique identifier. + + RULE SET GENERAL 3: Ensure that AssessmentItem Response Declarations are correct. The set of rules are:- + * RULE GENERAL 3a-Assertion 1 :- ***To be completed***.. + + RULE SET INTERACTION 1: Enforce the correct use the TextEntryInteraction attributes. The set of rules are:- + * RULE INTERACTION 1a-Assertion 1 :- The StringIdentifier and ResponseIdentifier attribute values must not be the same. + + History: Version 1.0: The first set of schematron rules for the IMS Global QTIv2.1 specification. + + + + + Schematron Validation Rules for QTI Specification v2.1. + + + + Ensure that certain expressions are NOT used for Response Processing. + + + + [RULE GENERAL 1a: Assertion 1] The expression numberCorrect must NOT be used in Response Processing. + + + [RULE GENERAL 1a: Assertion 2] The expression numberIncorrect must NOT be used in Response Processing. + + + [RULE GENERAL 1a: Assertion 3] The expression numberPresented must NOT be used in Response Processing. + + + [RULE GENERAL 1a: Assertion 4] The expression numberResponded must NOT be used in Response Processing. + + + [RULE GENERAL 1a: Assertion 5] The expression numberSelected must NOT be used in Response Processing. + + + [RULE GENERAL 1a: Assertion 6] The expression outcomeMinimum must NOT be used in Response Processing. + + + [RULE GENERAL 1a: Assertion 7] The expression outcomeMaximum must NOT be used in Response Processing. + + + [RULE GENERAL 1a: Assertion 8] The expression testVariables must NOT be used in Response Processing. + + + + + + + + + Ensure that the Item, Section, Test and TestPart identifiers are unique. + + + + + + + + + + + + + Ensure that AssessmentItem Response Declarations are correct. + + + + [RULE GENERAL 3a: Assertion 1] ***To be completed***.. + + + + + + + + + Enforce the correct use the TextEntryInteraction attributes. + + + + [RULE INTERACTION 1a: Assertion 1] The StringIdentifier and ResponseIdentifier attribute values must not be the same. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any namespaced element from any namespace may be included within an "any" element. + The namespace for the imported element must be defined in the instance, and the schema must be imported. + The extension has a definition of "lax" i.e. they can reuse elements from the target namespace. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'A' complexType is the container for content that is equivalent to the HTML 'a' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The anyN operator takes one or more sub-expressions each with a base-type of boolean and single cardinality. The result is a single boolean which is true if at least min of the sub-expressions are true and at most max of the sub-expressions are true. If more than n - min sub-expressions are false (where n is the total number of sub-expressions) or more than max sub-expressions are true then the result is false. If one or more sub-expressions are NULL then it is possible that neither of these conditions is satisfied, in which case the operator results in NULL. For example, if min is 3 and max is 4 and the sub-expressions have values {true,true,false,NULL} then the operator results in NULL whereas {true,false,false,NULL} results in false and {true,true,true,NULL} results in true. The result NULL indicates that the correct value for the operator cannot be determined. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The AreaMapping complexType is the container for information about for mapping data points in areas. The areaMapping, which may only be present in declarations of variables with baseType point, provides an alternative form of mapping which tests against areas of the coordinate space instead of mapping single values (i.e., single points). + + + + + + + + + + + + + + An Assessment consists of one or more Items. An 'assessmentItem' is the binding form of an Item. An Item is the smallest exchangeable assessment object. An Item is more than a 'Question' in that it contains the question and instructions to be presented, the response processing to be applied to the candidates response(s) and then feedback that may be presented (including hints and solutions). + [APIP-Item (Core)] Profile - the changes to the XML element list are: + * The "apipAccessibility" element has been made required i.e. multiplicity [1..1]; + + + + + + + + + + + + + + + + + + + + + + + + + + + The AssociateInteraction complexType is the container for information about associate interactions. An associate interaction is a blockInteraction that presents candidates with a number of choices and allows them to create associations between them. The associateInteraction must be bound to a response variable with base-type pair and either single or multiple cardinality. + + + + + + + + + + + + + + + + + + + + + The 'BlockQuote' complexType is the container for content that is equivalent to the HTML 'blockquote' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Caption' complexType is the container for content that is equivalent to the HTML 'caption' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ChoiceInteraction is the complexType for the information in a choice interaction. The choice interaction presents a set of choices to the candidate. The candidate's task is to select one or more of the choices, up to a maximum of maxChoices. There is no corresponding minimum number of choices. The interaction is always initialized with no choices selected. + + + + + + + + + + + + + + + + + + + + + + The 'ColGroup' complexType is the container for set of columns defined within a table. The content is the set of 'col' HTML markup. + + + + + + + + + + + + + + + + The CorrectResponse complexType is the container for information about the correct response for an interaction. A response declaration may assign an optional 'correctResponse'. This value may indicate the only possible value of the response variable to be considered correct or merely just a correct value. For responses that are being measured against a more complex scale than correct/incorrect this value should be set to the (or an) optimal value. Finally, for responses for hwich no such optimal value is defined the 'correctResponse' must be omitted. If a delivery system supports the display of a solution then it should display the correct values of responses (where defined) to the candidate's own responses (which may be hidden completely if necessary). + + + + + + + + + + + + The CustomInteraction complexType is the container for undefined QTI interactions i.e. ones of a proprietary nature. These are supported using a lax namespacing approach but developers are encouraged to define and use an associated validation XSD. + + + + + + + + + + + + + + + + + + The custom operator provides a namespaced extension mechanism for defining operations not currently supported by this specification. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'DD' complexType is the container for term definitions as per the HTML 'dd' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the container for the permitted set of default values. A human readable interpretation of the default value is also supplied using the 'interpretation' attribute. + + + + + + + + + + + + The 'Div' complexType is the container for content that is equivalent to the HTML 'div' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'DL' complexType is the container for list definitions as per the HTML 'dl' markup. This can contain any combination of 'dd' and 'dt' HTML elements. + + + + + + + + + + + + + + + + + + + DrawingInteraction is the complexType for graphic gap match QTI interactions. The drawing interaction allows the candidate to use a common set of drawing tools to modify a given graphical image (the canvas). It must be bound to a response variable with base-type file and single cardinality. The result is a file in the same format as the original image. + + + + + + + + + + + + + + + + + + The 'DT' complexType is the container for term definitions as per the HTML 'dt' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The equal operator takes two sub-expressions which must both have single cardinality and have a numerical base-type. The result is a single boolean with a value of true if the two expressions are numerically equal and false if they are not. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The equalRounded operator takes two sub-expressions which must both have single cardinality and have a numerical base-type. The result is a single boolean with a value of true if the two expressions are numerically equal after rounding and false if they are not. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ExtendedTextInteraction complexType is the container for information about an extendedText interaction. An extended text interaction is a blockInteraction that allows the candidate to enter an extended amount of text. The extendedTextInteraction must be bound to a response variable with baseType of string, integer or float. When bound to response variable with single cardinality a single string of text is required from the candidate. When bound to a response variable with multiple or ordered cardinality several separate text strings may be required, see maxStrings below. + + + + + + + + + + + + + + + + + + + + + + + + + + The TemplateBlockFeedbackBlock complexType is the container for block-based feedback used within a templateBlock. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The FeedbackInline complexType is the container for the feedback to be presented to the candidate inline to other content. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The field-value operator takes a sub-expression with a record container value. The result is the value of the field with the specified fieldIdentifier. If there is no field with that identifier then the result of the operator is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The GapImg complexType is the container for an image assigned to a gap-based interaction. A gap image contains a single image object to be inserted into a gap by the candidate. + + + + + + + + + + + + + + + + + + + + + + + The GapMatchInteraction complexType is the container for the information about a gap match interaction. A gap match interaction is a block interaction that contains a number gaps that the candidate can fill from an associated set of choices. The candidate must be able to review the content with the gaps filled in context, as indicated by their choices. The gapMatchInteraction must be bound to a response variable with base-type directedPair and either single or multiple cardinality, depending on the number of gaps. The choices represent the source of the pairing and gaps the targets. Each gap can have at most one choice associated with it. The maximum occurrence of the choices is controlled by the matchMax attribute of gapChoice. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The GapText complexType is the container for text assigned to a gap-based interaction. A simple run of text to be inserted into a gap by the user, may be subject to variable value substitution with printedVariable. + + + + + + + + + + + + + + + + + + + + + + GraphicAssociateInteraction is the complexType for graphic associate QTI interactions. A graphic associate interaction is a graphic interaction with a corresponding set of choices that are defined as areas of the graphic image. The candidate's task is to associate the areas (hotspots) with each other. The graphic associate interaction should only be used when the graphical relationship of the choices with respect to each other (as represented by the graphic image) is important to the needs of the item. + + + + + + + + + + + + + + + + + + + + + GraphicGapMatchInteraction is the complexType for graphic gap match QTI interactions. A graphic gap-match interaction is a graphical interaction with a set of gaps that are defined as areas (hotspots) of the graphic image and an additional set of gap choices that are defined outside the image. The candidate must associate the gap choices with the gaps in the image and be able to review the image with the gaps filled in context, as indicated by their choices. + + + + + + + + + + + + + + + + + + + + GraphicOrderInteraction is the complexType for graphic order QTI interactions. A graphic order interaction is a graphic interaction with a corresponding set of choices that are defined as areas of the graphic image. The candidate's task is to impose an ordering on the areas (hotspots). The order hotspot interaction should only be used when the spacial relationship of the choices with respect to each other (as represented by the graphic image) is important to the needs of the item. + + + + + + + + + + + + + + + + + + + + + The HotspotInteraction complexType is the container for infromation on hotspot interactions. A hotspot interaction is a graphical interaction with a corresponding set of choices that are defined as areas of the graphic image. The candidate's task is to select one or more of the areas (hotspots). The hotspot interaction should only be used when the spacial relationship of the choices with respect to each other (as represented by the graphic image) is important to the needs of the item. Otherwise, choiceInteraction should be used instead with separate material for each option.The delivery engine must clearly indicate the selected area(s) of the image and may also indicate the unselected areas as well. Interactions with hidden hotspots are achieved with the selectPointInteraction. + + + + + + + + + + + + + + + + + + + + + The HotText complexType is the container for HotText information. A hottext area is used within the content of an hottextInteraction to provide the individual choices. It must not contain any nested interactions or other hottext areas. When a hottext choice is hidden (by the value of an associated template variable) the content of the choice must still be presented to the candidate as if it were simply part of the surrounding material. In the case of hottext, the effect of hiding the choice is simply to make the run of text unselectable by the candidate. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The HotTextInteraction complexType is the container for information about a hotText interaction. The hottext interaction presents a set of choices to the candidate represented as selectable runs of text embedded within a surrounding context, such as a simple passage of text. Like choiceInteraction, the candidate's task is to select one or more of the choices, up to a maximum of maxChoices. The interaction is initialized from the defaultValue of the associated response variable, a NULL value indicating that no choices are selected (the usual case). The hottextInteraction must be bound to a response variable with a baseType of identifier and single or multiple cardinality. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The complexType for the set of HTML text elements i.e. h1, h2, h3, h4, h5, h6, p, pre and address. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The index operator takes a sub-expression with an ordered container value and any base-type. The result is the nth value of the container. The result has the same base-type as the sub-expression but single cardinality. The first value of a container has index 1, the second 2 and so on. n must be a positive integer. If n exceeds the number of values in the container (or the sub-expression is NULL) then the result of the index operator is NULL. If n is an identifier, it is the value of n at runtime that is used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'InfoControl' complexType is the container to provide the candidate with extra information about the item when s/he chooses to trigger the control. The extra information can be a hint, but could also be additional tools such as a ruler or a (javaScript) calculator. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An InlineChoice complexType is the container for a simple run of text to be displayed to the user, and which may be subject to variable value substitution with printedVariable(s). + + + + + + + + + + + + + + + + + + + The InlineChoiceInteraction complexType is the container for information about an inline choice interaction. An inline choice is an inlineInteraction that presents the user with a set of choices, each of which is a simple piece of text. The candidate's task is to select one of the choices. Unlike the choiceInteraction, the delivery engine must allow the candidate to review their choice within the context of the surrounding text. + + + + + + + + + + + + + + + + + + + The inside operator takes a single sub-expression which must have a baseType of point. The result is a single boolean with a value of true if the given point is inside the area defined by shape and coords. If the sub-expression is a container the result is true if any of the points are inside the area. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The InterpolationTable complexType is the container for interpolation information. An interpolationTable transforms a source float (or integer) by finding the first interpolationTableEntry with a sourceValue that is less than or equal to (subject to includeBoundary) the source value. For example, an interpolation table can be used to map a raw numeric score onto an identifier representing a grade. It may also be used to implement numeric transformations such as those from a simple raw score to a value on a calibrated scale. + + + + + + + + + + + + This is the container for the set of materials that are to be rendered as the question itself. The content model is XHTML-based and combines with it the range of QTI interactions (an interaction defines the nature of the question e.g. multple choice, hotspot, etc.). The rubric material can be interleaved with the block content. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'LI' complexType is the container for the definition of lists as per the HTML 'li' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable operator e.g. an 'and' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable operator e.g. an 'and' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a two variable operator e.g. greater than. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a single variable operator e.g. a 'not'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The LookupOutcomeValue complexType is the container for look-up mapping values to outcome variables. The lookupOutcomeValue rule sets the value of an outcome variable to the value obtained by looking up the value of the associated expression in the lookupTable associated with the outcome's declaration. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A special class used to create a mapping from a source set of any baseType (except file and duration) to a single float. Note that mappings from values of base type float should be avoided due to the difficulty of matching floating point values, see the match operator for more details. When mapping containers the result is the sum of the mapped values from the target set. See mapResponse for details. + + + + + + + + + + + + + + The MatchInteraction complexType is the container for information about a match interaction. A match interaction is a blockInteraction that presents candidates with two sets of choices and allows them to create associates between pairs of choices in the two sets, but not between pairs of choices in the same set. Further restrictions can still be placed on the allowable associations using the matchMax and matchGroup attributes of the choices. The matchInteraction must be bound to a response variable with base-type directedPair and either single or multiple cardinality. + + + + + + + + + + + + + + + + + + + + + The MatchTable complexType is the container source mapping. A matchTable transforms a source integer by finding the first matchTableEntry with an exact match to the source. + + + + + + + + + + + + The mathOperator operator takes 1 or more sub-expressions which all have single cardinality and have numerical base-types. The trigonometric functions, sin, cos and tan, take one argument in radians, which evaluates to a single float. Other functions take one numerical argument. Further functions might take more than one numerical argument, e.g. atan2 (two argument arc tan). The result is a single float, except for the functions signum, floor and ceil, which return a single integer. If any of the sub-expressions is NULL, the result is NULL. If any of the sub-expressions falls outside the natural domain of the function called by mathOperator, e.g. log(0) or asin(2), then the result is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The MediaInteraction complexType is the container for the media interaction information. The media interaction allows more control over the way the candidate interacts with a time-based media object and allows the number of times the media object was experienced to be reported in the value of the associated response variable, which must be of base-type integer and single cardinality. + + + + + + + + + + + + + + + + + + + + + + The ModalFeedback complexType is the container for the item feedback to be presented to the candidate. Modal feedback is shown to the candidate directly following response processing. The value of an outcome variable is used in conjunction with the showHide and identifier attributes to determine whether or not the feedback is shown. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable numeric-based operator e.g. a 'sum' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The Object complexType is the container for the objects used with the associated content i.e. positionObjectStage, graphicInteraction, positionObjectInteraction, mediaInteraction, drawingInteraction and gapImg. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The OrderInteraction complexType is the container for the information about an order interaction.In an order interaction the candidate's task is to reorder the choices, the order in which the choices are displayed initially is significant. By default the candidate's task is to order all of the choices but a subset of the choices can be requested using the maxChoices and minChoices attributes. When specified, the candidate must select a subset of the choices and impose an ordering on them. + + + + + + + + + + + + + + + + + + + + + + The 'OUL' complexType is the container for ordered and unordered lists as per the HTML 'ul' and 'ol' markup. + + + + + + + + + + + + + + + + The OutcomeCondition complexType is the container for the sequence of outcome conditions to be applied. The condition is structured as an 'If..ElseIf..ElseIf..Else' sequence. Each clause as its own outcome rule construct. + + + + + + + + + + + + + The OutcomeDeclaration complexType is the container for the declaration of outcome variables. Outcome variables are declared by outcome declarations. Their value is set either from a default given in the declaration itself or by a 'responseRule' during 'responseProcessing'. + + + + + + + + + + + + + + + + + + + + + + + + The OutcomeElse complexType is the container for 'Else' processing. An outcomeElse part consists of an expression which must have an effective baseType of boolean and single cardinality. For more information about the runtime data model employed see Expressions. It also contains a set of sub-rules. If the expression is true then the sub-rules are processed. + + + + + + + + + + + + + + + + + + The OutcomeIf complexType is the container for 'If' processing. An outcomeIf part consists of an expression which must have an effective baseType of boolean and single cardinality. For more information about the runtime data model employed see Expressions. It also contains a set of sub-rules. If the expression is true then the sub-rules are processed, otherwise they are skipped (including if the expression is NULL) and the following outcomeElseIf or outcomeElse parts (if any) are considered instead. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The OutcomeProcessing complexType is the container for the outcome processing instructions. Outcome processing takes place each time the candidate submits the responses for an item (when in individual submission mode) or a group of items (when in simultaneous submission mode). It happens after any (item level) response processing triggered by the submission. The values of the test's outcome variables are always reset to their defaults prior to carrying out the instructions described by the outcomeRules. Because outcome processing happend each time the candidate submits responses the resulting values of the test-level outcomes may be used to activate test-level feedback during the test or to control the behaviour of subsequent parts through the use of preConditions and branchRules. + + + + + + + + + + + + + + + + + + The OutcomeProcessingFragment is the complexType for a group of outcome rules. An outcomeProcessingFragment is a simple group of outcomeRules which are grouped together in order to allow them to be managed as a separate resource. It should not be used for any other purpose. + + + + + + + + + + + + + + + + + + The patternMatch operator takes a sub-expression which must have single cardinality and a base-type of string. The result is a single boolean with a value of true if the sub-expression matches the regular expression given by pattern and false if it doesn't. If the sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The PositionObjectInteraction is the complexType for position object interactions. The position object interaction consists of a single image which must be positioned on another graphic image (the stage) by the candidate. Like selectPointInteraction, the associated response may have an areaMapping that scores the response on the basis of comparing it against predefined areas but the delivery engine must not indicate these areas of the stage. Only the actual position(s) selected by the candidate shall be indicated. + + + + + + + + + + + + + + + + + + + The PositionObjectStage is the complexType container for the image to be used as a stage onto which individual 'positionObjectInteractions' allow the candidate to place their objects. + + + + + + + + + + + + A Prompt complexType is the container for the material that is to be presented to a candidate as the prompt for the question e.g. the actual question after which the set of possible answers for a multiple choice are presented. CHANGED: To contain FlowStaticGroup instead of InlineStaticGroup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Q' complexType is the container for content that is equivalent to the HTML 'q' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The repeat operator allows the filling of an ordered container. The result of a repeat operator is an ordered set of values calculated from the expressions. Values will be set in the associated container by a setTemplateValue expression. Each expression is calculated as many times as it is queried by numberRepeats. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ResponseCondition complexType is the container for the sequence of outcome conditions to be applied. The condition is structured as an 'If..ElseIf..ElseIf..Else' sequence. Each clause as its own response rule construct. + + + + + + + + + + + + + The ResponseDeclaration complexType is used to contain the definition of the Response Variable that are to be bound to the interactions in the Item. + + + + + + + + + + + + + + + + + The ResponseElse complexType is the container for the 'Else' clause. If the expression given in a responseIf or responseElseIf evaluates to true then the sub-rules contained within it are followed and any following responseElseIf or responseElse parts are ignored for this response condition. If the expression given in a responseIf or responseElseIf does not evaluate to true then consideration passes to the next responseElseIf or, if there are no more responseElseIf parts then the sub-rules of the responseElse are followed (if specified). + + + + + + + + + + + + + + + + + + The ResponseIf complexType is the container for the 'If' clause. If the expression given in a responseIf or responseElseIf evaluates to true then the sub-rules contained within it are followed and any following responseElseIf or responseElse parts are ignored for this response condition. If the expression given in a responseIf or responseElseIf does not evaluate to true then consideration passes to the next responseElseIf or, if there are no more responseElseIf parts then the sub-rules of the responseElse are followed (if specified). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ResponseProcessing complexType is the container for response processing instructions. Response processing involves the application of a set of responseRules, including the testing of responseConditions and the evaluation of expressions involving the item variables. For delivery engines that are only designed to support very simple use cases the implementation of a system for carrying out this evaluation, conditional testing and processing may pose a barrier to the adoption of the specification. + + + + + + + + + + + + + + + + + + + + The ResponseProcessingFragment complexType is the container for a group of response rules. A responseProcessingFragment is a simple group of responseRules which are grouped together in order to allow them to be managed as a separate resource. It should not be used for any other purpose. + + + + + + + + + + + + + + + + + + The roundTo operator takes one sub-expression which must have single cardinality and a numerical base-type. The result is a single float with the value nearest to that of the expression's value such that when converted to a decimal string it represents the expression rounded by the specified rounding method to the specified precision. If the sub-expression is NULL, then the result is NULL. If the sub-expression is INF, then the result is INF. If the sub-expression is -INF, then the result is -INF. If the argument is NaN, then the result is NULL. When rounding to n significant figures, the deciding digit is the (n+1)th digit counting from the first non-zero digit from the left in the number. If the deciding digit is 5 or greater, the nth digit is increased by 1 and all digits to its right are discarded; if the deciding digit is less than 5, all digits to the right of the nth digit are discarded. When rounding to n decimal places, the deciding digit is the (n+1)th digit counting to the right from the decimal point. If the deciding digit is 5 or greater, the nth digit is increased by 1 and all digits to its right are discarded; if the deciding digit is less than 5, all digits to the right of the nth digit are discarded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A rubric block identifies instructions to one or more of the actors that view the item or set of items (as per a section). Although rubric blocks are defined as simpleBlocks they must not contain interactions. The visibility of nested bodyElements or rubricBlocks is determined by the outermost element. In other words, if an element is determined to be hidden then all of its content is hidden including conditionally visible elements for which the conditions are satisfied and that therefore would otherwise be visible. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A rubricBlock template block identifies content to be used in a template within a rubricBlock. The visibility of nested bodyElements or templateBlocks is determined by the outermost element. In other words, if an element is determined to be hidden then all of its content is hidden including conditionally visible elements for which the conditions are satisfied and that therefore would otherwise be visible. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The RubricBlockTemplateInline complexType is the container for inline objects (excluding interactions) that are used to create a template layout within a rubricBlock. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SelectPointInteraction is the complexType for select point QTI interactions. Like hotspotInteraction, a select point interaction is a graphic interaction. The candidate's task is to select one or more points. The associated response may have an areaMapping that scores the response on the basis of comparing it against predefined areas but the delivery engine must not indicate these areas of the image. Only the actual point(s) selected by the candidate shall be indicated. + + + + + + + + + + + + + + + + + + + + The SetValue complexType is the container for the value set for the associated element (the element is identified using the 'identifier' attribute). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The SimpleAssociableChoice complexType is the container for the ordered set of choices for the match set. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The SimpleChoice complexType is the container for the information that is to be presented to a candidate as a possible answer to be selected i.e. in a multiple choice, true/false types of questions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The SimpleMatchSet complexType is the container for the match set chocies. There are two sets of choices: the first set defines the source choices and the second set the targets. + + + + + + + + + + + The SliderInteraction complexType is the container for the information abourt a slider nteraction. The slider interaction presents the candidate with a control for selecting a numerical value between a lower and upper bound. It must be bound to a response variable with single cardinality with a base-type of either integer or float. + + + + + + + + + + + + + + + + + + + + + + + The statsOperator operator takes 1 sub-expression which is a container of multiple or ordered cardinality and has a numerical base-type. The result is a single float. If the sub-expression or any value contained therein is NULL, the result is NULL. If any value contained in the sub-expression is not a numerical value, then the result is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The stringMatch operator takes two sub-expressions which must have single and a base-type of string. The result is a single boolean with a value of true if the two strings match according to the comparison rules defined by the attributes below and false if they don't. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The substring operator takes two sub-expressions which must both have an effective base-type of string and single cardinality. The result is a single boolean with a value of true if the first expression is a substring of the second expression and false if it isn't. If either sub-expression is NULL then the result of the operator is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Table' complexType is the container for content that is equivalent to the HTML 'table' markup. + + + + + + + + + + + + + + + + + + + + + + The TablePart complexType is the container for set of table row content that is used to the support content within a table. + + + + + + + + + + + + + + + The 'TDH' complexType is the container for content that is equivalent to the HTML 'td' and 'th' markup within a table. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A template block identifies content to be used in a template. The visibility of nested bodyElements or templateBlocks is determined by the outermost element. In other words, if an element is determined to be hidden then all of its content is hidden including conditionally visible elements for which the conditions are satisfied and that therefore would otherwise be visible. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The TemplateBlockFeedbackBlock complexType is the container for block-based feedback used within a templateBlock. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The TemplateCondition complexType is the container for the definition of the 'If..Then..Else/ElseIf' rule construction. If the expression given in the templateIf or templateElseIf evaluates to true then the sub-rules contained within it are followed and any following templateElseIf or templateElse parts are ignored for this template condition. If the expression given in the templateIf or templateElseIf does not evaluate to true then consideration passes to the next templateElseIf or, if there are no more templateElseIf parts then the sub-rules of the templateElse are followed (if specified). + + + + + + + + + + + + + The TemplateConstraint complexType is the container for the constraints to be applied to a templateRule. A templateConstraint determines constraints on the binding of variables in the contained expression. The expression must have an effective baseType of boolean and single cardinality. At the runtime the template variables must be instantiated according to these constraints. Implementors need to be aware that some configurations of templateConstraint can cause an infinite loop. For that reason, the minimum supported maximum number of templateConstraint iterations is 100. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The templateDeclaration complexType is the container for template declarations. Template declarations declare item variables that are to be used specifically for the purposes of cloning items. They can have their value set only during templateProcessing. They are referred to within the itemBody in order to individualize the clone and possibily also within the responseProcessing rules if the cloning process affects the way the item is scored. + + + + + + + + + + + + + + + + The TemplateElse complexType is the container for the alternative rules that are to be applied if the templateIf rules are NULL/FALSE. + + + + + + + + + + + + + + + + + + The TemplateIf complexType is the container of an expression which must have an effective baseType of boolean and single cardinality. For more information about the runtime data model employed see 'Expressions'. It also contains a set of sub-rules. If the expression is true then the sub-rules are processed, otherwise they are skipped (including if the expression is NULL) and the following templateElseIf or templateElse parts (if any) are considered instead. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The TemplateInline complexType is the container for inline objects (excluding interactions) that are used to create a template layout. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The TemplateProcessing complexType is the container for the template processing rules. Template processing consists of one or more templateRules that are followed by the cloning engine or delivery system in order to assign values to the template variables. Template processing is identical in form to responseProcessing except that the purpose is to assign values to template variables, not outcome variables. + + + + + + + + + + + + + + + + + + The 'TR' complexType is the container for content that is equivalent to the HTML 'tr' markup. + + + + + + + + + + + + + + + + + + The UploadInteraction complexType is the container for QTI interactions that involve submission of information in an external file. The upload interaction allows the candidate to upload a pre-prepared file representing their response. + + + + + + + + + + + + + + + + + + + + + + The AreaMapEntry complexType is the container for area map entries. A map is defined by a set of areaMapEntries, each of which maps an area of the coordinate space onto a single float. When mapping points each area is tested in turn, with those listed first taking priority in the case where areas overlap and a point falls in the intersection. + + + + + + + + + + + + + + + The AssociableHotspot complexType is the container for association of associableChoice, and hotspot interactions. This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + + + + + The simplest expression returns a single value from the set defined by the given baseType. + + + + + + + + + + + + + The 'BR' complexType is the container for content that is equivalent to the HTML 'br' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + The 'Col' complexType is the container for content that is equivalent to the HTML 'col' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + This expression looks up the declaration of a response variable and returns the associated correctResponse or NULL if no correct value was declared. When used in outcomes processing item identifier prefixing (see variable) may be used to obtain the correct response from an individual item. This is intentionally empty. + + + + + + + + + + + + + This expression looks up the declaration of an itemVariable and returns the associated defaultValue or NULL if no default value was declared. When used in outcomes processing item identifier prefixing (see variable) may be used to obtain the default value from an individual item. This is intentionally empty. + + + + + + + + + + + + + The EndAttemptInteraction complexType is the container for the end attempt interaction information. The end attempt interaction is a special type of interaction which allows item authors to provide the candidate with control over the way in which the candidate terminates an attempt. The candidate can use the interaction to terminate the attempt (triggering response processing) immediately, typically to request a hint. It must be bound to a response variable with base-type boolean and single cardinality. + + + + + + + + + + + + + + + + + + + + The Gap complexType is the container for the inline content as part of a gap-based interaction. The gap is an inline static element that must only appear within a gapMatchInteraction. + + + + + + + + + + + + + + + + + + + + + + The HotspotChoice complexType is the container for data about hotspot choices (this ComplexType is intentionally empty). The hotspots that define the choices that can be selected by the candidate. If the delivery system does not support pointer-based selection then the order in which the choices are given must be the order in which they are offered to the candidate for selection. For example, the 'tab order' in simple keyboard navigation. If hotspots overlap then those listed first hide overlapping hotspots that appear later. The default hotspot, if defined, must appear last. + + + + + + + + + + + + + + + + + + + + + + + The 'HR' complexType is the container for content that is equivalent to the HTML 'hr' markup.This complexType is intentionally empty. + + + + + + + + + + + + + + + + + The 'Img' complexType is the container for content that is equivalent to the HTML 'img' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + The InterpolationTableEntry complexType is the container for an entry in the corresponding interpolationTable. This complexType is intentionally empty. + + + + + + + + + + + + + + + When items are referenced as part of a test, the test may impose constraints on how many attempts, and which states are allowed. These constraints can be specified for individual items, for whole sections or for an entire testPart. By default, a setting at testPart level affects all items in that part unless the setting is overridden at the assessmentSection level or ultimately at the individual assessmentItemRef. The defaults given below are used only in the absence of any applicable constraint. This complexType is intentionally empty. + + + + + + + + + + + + + + + + + + + The map is defined by a set of mapEntries, each of which maps a single value from the source set onto a single float. + + + + + + + + + + + + + + + This expression looks up the value of a response variable and then transforms it using the associated mapping, which must have been declared. The result is a single float. If the response variable has single cardinality then the value returned is simply the mapped target value from the map. If the response variable has multiple or ordered cardinality then the value returned is the sum of the mapped target values. This expression cannot be applied to variables of record cardinality. This is intentionally empty. + + + + + + + + + + + + + The MatchTableEnry complexType is the container for an entry n a match table. Intentionally empty comlexType. + + + + + + + + + + + + + + The result is a mathematical constant returned as a single float, e.g. pi and e. + + + + + + + + + + + + + Provides an operator that returns the number of values that confrm to the associated constraints e.g. 'numberCorrect'. + + + + + + + + + + + + + + + This expression, which can only be used in outcomes processing, simultaneously looks up the normal Maximum/Minimum value of an outcome variable in a sub-set of the items referred to in a test. Only variables with single cardinality are considered. If any of the items within the given subset have no declared maximum the result is NULL, otherwise the result has cardinality multiple and base-type float. This is intentionally empty. + + + + + + + + + + + + + + + + + The Param complexType is the container for the parameter information to be used for the associated object. AN Object can have zero or more parameters. + + + + + + + + + + + + + + + + The PrintedVariable complexType is the container for variables that are to be printed. The outcome variable or template variable must have been defined and have single cardinality. The values of response variables cannot be printed directly as their values are implicitly known to the candidate through the interactions they are bound to; if necessary, their values can be assigned to outcomes during responseProcessing and displayed to the candidate as part of a bodyElement visible only in the appropriate feedback states. + + + + + + + + + + + + + + + + + + + + + + + + + Selects a random float from the specified range [min,max]. This is intentionally empty. + + + + + + + + + + + + + + Selects a random integer from the specified range [min,max] satisfying min + step * n for some integer n. For example, with min=2, max=11 and step=3 the values {2,5,8,11} are possible. + + + + + + + + + + + + + + + This is used to associate an external stylesheet (it is assumed that this takes the form of a CSS file but other formats are permitted). + + + + + + + + + + + + + + + + This expression, which can only be used in outcomes processing, simultaneously looks up the value of an itemVariable in a sub-set of the items referred to in a test. Only variables with single cardinality are considered, all NULL values are ignored. The result has cardinality multiple and base-type as specified below. This is intentionally empty. + + + + + + + + + + + + + + + + + + The TestEntryInteraction complexType is the container for information about a textEntry interaction. A textEntry interaction is an inlineInteraction that obtains a simple piece of text from the candidate. Like inlineChoiceInteraction, the delivery engine must allow the candidate to review their choice within the context of the surrounding text. The textEntryInteraction must be bound to a response variable with single cardinality only. The baseType must be one of string, integer or float. This complexType is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + + A class that can represent a single value of any baseType in variable declarations and result reports. The base-type is defined by the baseType attribute of the declaration except in the case of variables with record cardinality. + + + + + + + + + + + + + + This expression looks up the value of an itemVariable that has been declared in a corresponding variableDeclaration or is one of the built-in variables. The result has the base-type and cardinality declared for the variable subject to the type promotion of weighted outcomes. This is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtioutcomesv2p1_v1p0.xsd b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtioutcomesv2p1_v1p0.xsd new file mode 100644 index 000000000..0e6aad6ff --- /dev/null +++ b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtioutcomesv2p1_v1p0.xsd @@ -0,0 +1,596 @@ + + + + + + + + + + XSD Data File Information + ========================= + Author: Colin Smythe + Date: 31st July, 2012 + Version: Final 1.0 + Status: Final Release + Description: This is the Platform Specific Model of the APIPv1.0 profile of the IMS QTI v2.1 Information Model. + This is the Entry and Core Level Profile for APIPv1.0 QTIv2.1 Outcomes Declarations. + + History: This is the first version of the APIPv1.0 QTIv2.1 Outcomes Declaration Profile. + + PROFILE: This is the "APIP-Outcomes". THIS IS A PROFILE OF THE BASE SPECIFICATION. + The changes to the base specification are: + * The schema namespace has been changed to "http://www.imsglobal.org/xsd/apip/apipv1p0/qtioutcomes/imsqti_v2p1". + * The schema version has been changed to "IMS APIP 1.0 QTI 2.1 OUTCOMES". + * The "A" class/complexType and set of XML attributes have been deleted; + * The "AnyN" class/complexType and set of XML attributes have been deleted; + * The "AreaMapEntry" class/complexType and set of XML attributes have been deleted; + * The "AreaMapEntry" class/complexType and set of XML attributes have been deleted; + * The "AreaMapping" class/complexType and set of XML attributes have been deleted; + * The "AreaMapping" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItem" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItemRef" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSection" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSectionRef" class/complexType and set of XML attributes have been deleted; + * The "AssessmentTest" class/complexType and set of XML attributes have been deleted; + * The "AssociableHotspot" class/complexType and set of XML attributes have been deleted; + * The "AssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "BaseValue" class/complexType and set of XML attributes have been deleted; + * The "BlockQuote" class/complexType and set of XML attributes have been deleted; + * The "BR" class/complexType and set of XML attributes have been deleted; + * The "BranchRule" class/complexType and set of XML attributes have been deleted; + * The "Caption" class/complexType and set of XML attributes have been deleted; + * The "ChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "Col" class/complexType and set of XML attributes have been deleted; + * The "ColGroup" class/complexType and set of XML attributes have been deleted; + * The "Correct" class/complexType and set of XML attributes have been deleted; + * The "CorrectResponse" class/complexType and set of XML attributes have been deleted; + * The "CustomInteraction" class/complexType and set of XML attributes have been deleted; + * The "CustomOperator" class/complexType and set of XML attributes have been deleted; + * The "DD" class/complexType and set of XML attributes have been deleted; + * The "Default" class/complexType and set of XML attributes have been deleted; + * The "DefaultValue" class/complexType and set of XML attributes have been deleted; + * The "Div" class/complexType and set of XML attributes have been deleted; + * The "DL" class/complexType and set of XML attributes have been deleted; + * The "DrawingInteraction" class/complexType and set of XML attributes have been deleted; + * The "DT" class/complexType and set of XML attributes have been deleted; + * The "EndAttemptInteraction" class/complexType and set of XML attributes have been deleted; + * The "Equal" class/complexType and set of XML attributes have been deleted; + * The "EqualRounded" class/complexType and set of XML attributes have been deleted; + * The "ExpressionGroup" class/complexType and set of XML attributes have been deleted; + * The "ExtendedTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "FeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "FeedbackInline" class/complexType and set of XML attributes have been deleted; + * The "FieldValue" class/complexType and set of XML attributes have been deleted; + * The "Gap" class/complexType and set of XML attributes have been deleted; + * The "GapChoice" class/complexType and set of XML attributes have been deleted; + * The "GapImg" class/complexType and set of XML attributes have been deleted; + * The "GapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GapText" class/complexType and set of XML attributes have been deleted; + * The "GraphicAssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicGapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicOrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotspotChoice" class/complexType and set of XML attributes have been deleted; + * The "HotspotInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotText" class/complexType and set of XML attributes have been deleted; + * The "HotTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "HR" class/complexType and set of XML attributes have been deleted; + * The "HTMLText" class/complexType and set of XML attributes have been deleted; + * The "Img" class/complexType and set of XML attributes have been deleted; + * The "Index" class/complexType and set of XML attributes have been deleted; + * The "InfoControl" class/complexType and set of XML attributes have been deleted; + * The "InlineChoice" class/complexType and set of XML attributes have been deleted; + * The "InlineChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "Inside" class/complexType and set of XML attributes have been deleted; + * The "InterpolationTable" class/complexType and set of XML attributes have been deleted; + * The "InterpolationTableEntry" class/complexType and set of XML attributes have been deleted; + * The "ItemBody" class/complexType and set of XML attributes have been deleted; + * The "ItemSessionControl" class/complexType and set of XML attributes have been deleted; + * The "LI" class/complexType and set of XML attributes have been deleted; + * The "Logic0toMany" class/complexType and set of XML attributes have been deleted; + * The "Logic1toMany" class/complexType and set of XML attributes have been deleted; + * The "LogicPair" class/complexType and set of XML attributes have been deleted; + * The "LogicSingle" class/complexType and set of XML attributes have been deleted; + * The "LookupOutcomeValue" class/complexType and set of XML attributes have been deleted; + * The "MapEntry" class/complexType and set of XML attributes have been deleted; + * The "Mapping" class/complexType and set of XML attributes have been deleted; + * The "MapResponse" class/complexType and set of XML attributes have been deleted; + * The "MatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "MatchTable" class/complexType and set of XML attributes have been deleted; + * The "MatchTableEntry" class/complexType and set of XML attributes have been deleted; + * The "MathConstant" class/complexType and set of XML attributes have been deleted; + * The "MathOperator" class/complexType and set of XML attributes have been deleted; + * The "MediaInteraction" class/complexType and set of XML attributes have been deleted; + * The "ModalFeedback" class/complexType and set of XML attributes have been deleted; + * The "Number" class/complexType and set of XML attributes have been deleted; + * The "NumericLogic1toMany" class/complexType and set of XML attributes have been deleted; + * The "Object" class/complexType and set of XML attributes have been deleted; + * The "ObjectFlowGroup" class/complexType and set of XML attributes have been deleted; + * The "Ordering" class/complexType and set of XML attributes have been deleted; + * The "OrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "OUL" class/complexType and set of XML attributes have been deleted; + * The "OutcomeCondition" class/complexType and set of XML attributes have been deleted; + * The "OutcomeElse" class/complexType and set of XML attributes have been deleted; + * The "OutcomeIf" class/complexType and set of XML attributes have been deleted; + * The "OutcomeMinMax" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessing" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "OutcomeRule" class/complexType and set of XML attributes have been deleted; + * The "Param" class/complexType and set of XML attributes have been deleted; + * The "PatternMatch" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectInteraction" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectStage" class/complexType and set of XML attributes have been deleted; + * The "PrintedVariable" class/complexType and set of XML attributes have been deleted; + * The "Prompt" class/complexType and set of XML attributes have been deleted; + * The "Q" class/complexType and set of XML attributes have been deleted; + * The "RandomFloat" class/complexType and set of XML attributes have been deleted; + * The "RandomInteger" class/complexType and set of XML attributes have been deleted; + * The "Repeat" class/complexType and set of XML attributes have been deleted; + * The "ResponseCondition" class/complexType and set of XML attributes have been deleted; + * The "ResponseDeclaration" class/complexType and set of XML attributes have been deleted; + * The "ResponseElse" class/complexType and set of XML attributes have been deleted; + * The "ResponseIf" class/complexType and set of XML attributes have been deleted; + * The "ResponseProcessing" class/complexType and set of XML attributes have been deleted; + * The "ResponseProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "ResponseRuleGroup" class/complexType and set of XML attributes have been deleted; + * The "RoundTo" class/complexType and set of XML attributes have been deleted; + * The "RubricBlock" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateInline" class/complexType and set of XML attributes have been deleted; + * The "SectionPart" class/complexType and set of XML attributes have been deleted; + * The "Selection" class/complexType and set of XML attributes have been deleted; + * The "SelectPointInteraction" class/complexType and set of XML attributes have been deleted; + * The "SetValue" class/complexType and set of XML attributes have been deleted; + * The "SimpleAssociableChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleMatchSet" class/complexType and set of XML attributes have been deleted; + * The "SliderInteraction" class/complexType and set of XML attributes have been deleted; + * The "StatsOperator" class/complexType and set of XML attributes have been deleted; + * The "StringMatch" class/complexType and set of XML attributes have been deleted; + * The "StyleSheet" class/complexType and set of XML attributes have been deleted; + * The "Substring" class/complexType and set of XML attributes have been deleted; + * The "Table" class/complexType and set of XML attributes have been deleted; + * The "TablePart" class/complexType and set of XML attributes have been deleted; + * The "TDH" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlockFeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateCondition" class/complexType and set of XML attributes have been deleted; + * The "TemplateConstraint" class/complexType and set of XML attributes have been deleted; + * The "TemplateDeclaration" class/complexType and set of XML attributes have been deleted; + * The "TemplateDefault" class/complexType and set of XML attributes have been deleted; + * The "TemplateElse" class/complexType and set of XML attributes have been deleted; + * The "TemplateIf" class/complexType and set of XML attributes have been deleted; + * The "TemplateInline" class/complexType and set of XML attributes have been deleted; + * The "TemplateProcessing" class/complexType and set of XML attributes have been deleted; + * The "TemplateRuleGroup" class/complexType and set of XML attributes have been deleted; + * The "TestFeedback" class/complexType and set of XML attributes have been deleted; + * The "TestPart" class/complexType and set of XML attributes have been deleted; + * The "TestVariables" class/complexType and set of XML attributes have been deleted; + * The "TextEntryInteraction" class/complexType and set of XML attributes have been deleted; + * The "TimeLimits" class/complexType and set of XML attributes have been deleted; + * The "TR" class/complexType and set of XML attributes have been deleted; + * The "UploadInteraction" class/complexType and set of XML attributes have been deleted; + * The "Value" class/complexType and set of XML attributes have been deleted; + * The "Variable" class/complexType and set of XML attributes have been deleted; + * The "VariableMapping" class/complexType and set of XML attributes have been deleted; + * The "Weight" class/complexType and set of XML attributes have been deleted; + + License: IPR, License and Distribution Notices + + This machine readable file is derived from IMS Global specification IMS Question and Test Interoperability (QTI) Version 2.1 + found at http://www.imsglobal.org/qti and the original IMS Global schema binding or code base + http://www.imsglobal.org/qti. + + Recipients of this document are requested to submit, with their comments, notification of any + relevant patent claims or other intellectual property rights of which they may be aware that might be + infringed by the schema binding contained in this document. + + IMS Global takes no position regarding the validity or scope of any intellectual property or other + rights that might be claimed to pertain to the implementation or use of the technology described in this + document or the extent to which any license under such rights might or might not be available; neither + does it represent that it has made any effort to identify any such rights. Information on IMS Global + procedures with respect to rights in IMS Global specifications can be found at the IMS Global Intellectual Property + Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. + + Copyright (c) IMS Global Learning Consortium 1999-2013. All Rights Reserved. + + License Notice for Users + + Users of products or services that include this document are hereby granted a worldwide, royalty-free, + non-exclusive license to use this document. + + Distribution Notice for Developers + + Developers of products or services that are not original incorporators of this document and + have not changed this document, that is, are distributing a software product that incorporates this + document as is from a third-party source other than IMS, are hereby granted permission to copy, + display and distribute the contents of this document in any medium for any purpose without fee or + royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL + copies, or portions thereof. + + Developers of products or services that are original incorporators of this document and wish + to provide distribution of this document as is or with modifications and developers of products and + services that are not original incorporators of this document and have changed this document, are + required to register with the IMS Global community on the IMS Global website as described in the following two + paragraphs:- + + * If you wish to distribute this document as is, with no modifications, you are hereby granted + permission to copy, display and distribute the contents of this document in any medium for any + purpose without fee or royalty provided that you include this IPR, License and Distribution notice in + its entirety on ALL copies, or portions thereof, that you make and you complete a valid license + registration with IMS and receive an email from IMS granting the license. To register, follow the + instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once + registered you are granted permission to transfer unlimited distribution rights of this document for the + purposes of third-party or other distribution of your product or service that incorporates this + document as long as this IPR, License and Distribution notice remains in place in its entirety; + + * If you wish to create and distribute a derived work from this document, you are hereby + granted permission to copy, display and distribute the contents of the derived work in any medium for + any purpose without fee or royalty provided that you include this IPR, License and Distribution + notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid + profile registration with IMS Global and receive an email from IMS Global granting the license. To register, follow + the instructions on the IMS Global website: http://www.imsglobal.org/profile/. Once registered you are + granted permission to transfer unlimited distribution rights of the derived work for the purposes of + third-party or other distribution of your product or service that incorporates the derived work as long + as this IPR, License and Distribution notice remains in place in its entirety. + + The limited permissions granted above are perpetual and will not be revoked by IMS Global or its + successors or assigns. + + THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS + EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM + NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF + ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. + + Source UML File Information + =========================== + The source file information must be supplied as an XMI file (without diagram layout information). + The supported UML authoring tools are: + (a) Poseidon - v6 (and later) + + Source XSLT File Information + ============================ + XSL Generator: Specificationv1p0_GenerationToolv1.xsl + XSLT Processor: Saxon-HE-9.4.0.4 + Release: 1.0 + Date: 31st March, 2013 + Autogen Engineer: Colin Smythe (IMS Global, UK) + Autogen Date: 2013-04-30 + + IMS Global Auto-generation Binding Tool-kit (I-BAT) + =================================================== + This file was auto-generated using the IMS Global Binding Auto-generation Tool-kit (I-BAT). While every + attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware + that this is an experimental tool. Permission is given to make use of this tool. IMS Global makes no + claim on the materials created by third party users of this tool. Details on how to use this tool + are contained in the IMS Global "I-BAT" documentation available at the IMS Global web-site: + http://www.imsglobal.org. + + Tool Copyright: 2012-2013 (c) IMS Global Learning Consortium Inc. All Rights Reserved. + + + + + + Definition of Schematron Validation Rules + ========================================= + Author: Colin Smythe (IMS Global) + Date: 31st October, 2012 + Version: 1.0 + Status: Final Release + + Description: This is the set of Schematron Rules to further enforce the QTIv2.1 Information Model. The rule sets that have been defined are: + + [RULE SET GENERAL 1] Ensure that certain expressions are NOT used for Response Processing. + [RULE SET GENERAL 2] Ensure that the Item, Section, Test and TestPart identifiers are unique. + [RULE SET GENERAL 3] Ensure that AssessmentItem Response Declarations are correct. + [RULE SET INTERACTION 1] Enforce the correct use the TextEntryInteraction attributes. + + RULE SET GENERAL 1: Ensure that certain expressions are NOT used for Response Processing. The set of rules are:- + * RULE GENERAL 1a-Assertion 1 :- The expression numberCorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 2 :- The expression numberIncorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 3 :- The expression numberPresented must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 4 :- The expression numberResponded must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 5 :- The expression numberSelected must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 6 :- The expression outcomeMinimum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 7 :- The expression outcomeMaximum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 8 :- The expression testVariables must NOT be used in Response Processing. + + RULE SET GENERAL 2: Ensure that the Item, Section, Test and TestPart identifiers are unique. The set of rules are:- + * RULE GENERAL 2a-Assertion 1 :- The AssessmentTest and a TestPart must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 2 :- The AssessmentTest and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 3 :- The AssessmentTest and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 4 :- The AssessmentTest and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 5 :- The AssessmentTest and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 1 :- Two TestParts must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 2 :- The TestPart and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 3 :- The TestPart and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 4 :- The TestPart and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 5 :- The TestPart and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 1 :- Two AssessmentSection children of a TestPart must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 2 :- The AssessmentSection and a descendant AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 3 :- The AssessmentSection and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 4 :- The AssessmentSection and a descendant AssessmentItemRef must not have the same unique identifier. + + RULE SET GENERAL 3: Ensure that AssessmentItem Response Declarations are correct. The set of rules are:- + * RULE GENERAL 3a-Assertion 1 :- ***To be completed***.. + + RULE SET INTERACTION 1: Enforce the correct use the TextEntryInteraction attributes. The set of rules are:- + * RULE INTERACTION 1a-Assertion 1 :- The StringIdentifier and ResponseIdentifier attribute values must not be the same. + + History: Version 1.0: The first set of schematron rules for the IMS Global QTIv2.1 specification. + + + + + Schematron Validation Rules for QTI Specification v2.1. + + + + Ensure that certain expressions are NOT used for Response Processing. + + + + + + + + + Ensure that the Item, Section, Test and TestPart identifiers are unique. + + + + + + + + + + + + + Ensure that AssessmentItem Response Declarations are correct. + + + + + + + + + Enforce the correct use the TextEntryInteraction attributes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The OutcomeDeclaration complexType is the container for the declaration of outcome variables. Outcome variables are declared by outcome declarations. Their value is set either from a default given in the declaration itself or by a 'responseRule' during 'responseProcessing'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiresprocessingv2p1_v1p0.xsd b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiresprocessingv2p1_v1p0.xsd new file mode 100644 index 000000000..11455a2c5 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtiresprocessingv2p1_v1p0.xsd @@ -0,0 +1,2892 @@ + + + + + + + + + + XSD Data File Information + ========================= + Author: Colin Smythe + Date: 31st July, 2012 + Version: Final 1.0 + Status: Final Release + Description: This is the Platform Specific Model of the APIPv1.0 profile of the IMS QTI v2.1 Information Model. + This is the Entry and Core Level Profile for APIPv1.0 QTIv2.1 Response Processing Templates. + + History: This is the first version of the APIPv1.0 QTIv2.1 Response Processing Template Profile. + + PROFILE: This is the "APIP-ResponseProcessing". THIS IS A PROFILE OF THE BASE SPECIFICATION. + The changes to the base specification are: + * The schema namespace has been changed to "http://www.imsglobal.org/xsd/apip/apipv1p0/qtiresproc/imsqti_v2p1". + * The schema version has been changed to "IMS APIP 1.0 QTI 2.1 RESPROC". + * The "A" class/complexType and set of XML attributes have been deleted; + * The "AnyN" class/complexType and set of XML attributes have been deleted; + * The "AreaMapEntry" class/complexType and set of XML attributes have been deleted; + * The "AreaMapEntry" class/complexType and set of XML attributes have been deleted; + * The "AreaMapping" class/complexType and set of XML attributes have been deleted; + * The "AreaMapping" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItem" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItemRef" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSection" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSectionRef" class/complexType and set of XML attributes have been deleted; + * The "AssessmentTest" class/complexType and set of XML attributes have been deleted; + * The "AssociableHotspot" class/complexType and set of XML attributes have been deleted; + * The "AssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "BlockQuote" class/complexType and set of XML attributes have been deleted; + * The "BR" class/complexType and set of XML attributes have been deleted; + * The "BranchRule" class/complexType and set of XML attributes have been deleted; + * The "Caption" class/complexType and set of XML attributes have been deleted; + * The "ChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "Col" class/complexType and set of XML attributes have been deleted; + * The "ColGroup" class/complexType and set of XML attributes have been deleted; + * The "CorrectResponse" class/complexType and set of XML attributes have been deleted; + * The "CustomInteraction" class/complexType and set of XML attributes have been deleted; + * The "DD" class/complexType and set of XML attributes have been deleted; + * The "DefaultValue" class/complexType and set of XML attributes have been deleted; + * The "Div" class/complexType and set of XML attributes have been deleted; + * The "DL" class/complexType and set of XML attributes have been deleted; + * The "DrawingInteraction" class/complexType and set of XML attributes have been deleted; + * The "DT" class/complexType and set of XML attributes have been deleted; + * The "EndAttemptInteraction" class/complexType and set of XML attributes have been deleted; + * The "ExtendedTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "FeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "FeedbackInline" class/complexType and set of XML attributes have been deleted; + * The "Gap" class/complexType and set of XML attributes have been deleted; + * The "GapChoice" class/complexType and set of XML attributes have been deleted; + * The "GapImg" class/complexType and set of XML attributes have been deleted; + * The "GapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GapText" class/complexType and set of XML attributes have been deleted; + * The "GraphicAssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicGapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicOrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotspotChoice" class/complexType and set of XML attributes have been deleted; + * The "HotspotInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotText" class/complexType and set of XML attributes have been deleted; + * The "HotTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "HR" class/complexType and set of XML attributes have been deleted; + * The "HTMLText" class/complexType and set of XML attributes have been deleted; + * The "Img" class/complexType and set of XML attributes have been deleted; + * The "InfoControl" class/complexType and set of XML attributes have been deleted; + * The "InlineChoice" class/complexType and set of XML attributes have been deleted; + * The "InlineChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "InterpolationTable" class/complexType and set of XML attributes have been deleted; + * The "InterpolationTableEntry" class/complexType and set of XML attributes have been deleted; + * The "ItemBody" class/complexType and set of XML attributes have been deleted; + * The "ItemSessionControl" class/complexType and set of XML attributes have been deleted; + * The "LI" class/complexType and set of XML attributes have been deleted; + * The "MapEntry" class/complexType and set of XML attributes have been deleted; + * The "Mapping" class/complexType and set of XML attributes have been deleted; + * The "MatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "MatchTable" class/complexType and set of XML attributes have been deleted; + * The "MatchTableEntry" class/complexType and set of XML attributes have been deleted; + * The "MediaInteraction" class/complexType and set of XML attributes have been deleted; + * The "ModalFeedback" class/complexType and set of XML attributes have been deleted; + * The "Object" class/complexType and set of XML attributes have been deleted; + * The "ObjectFlowGroup" class/complexType and set of XML attributes have been deleted; + * The "Ordering" class/complexType and set of XML attributes have been deleted; + * The "OrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "OUL" class/complexType and set of XML attributes have been deleted; + * The "OutcomeCondition" class/complexType and set of XML attributes have been deleted; + * The "OutcomeDeclaration" class/complexType and set of XML attributes have been deleted; + * The "OutcomeElse" class/complexType and set of XML attributes have been deleted; + * The "OutcomeIf" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessing" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "OutcomeRule" class/complexType and set of XML attributes have been deleted; + * The "Param" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectInteraction" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectStage" class/complexType and set of XML attributes have been deleted; + * The "PrintedVariable" class/complexType and set of XML attributes have been deleted; + * The "Prompt" class/complexType and set of XML attributes have been deleted; + * The "Q" class/complexType and set of XML attributes have been deleted; + * The "ResponseDeclaration" class/complexType and set of XML attributes have been deleted; + * The "RubricBlock" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateInline" class/complexType and set of XML attributes have been deleted; + * The "SectionPart" class/complexType and set of XML attributes have been deleted; + * The "Selection" class/complexType and set of XML attributes have been deleted; + * The "SelectPointInteraction" class/complexType and set of XML attributes have been deleted; + * The "SimpleAssociableChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleMatchSet" class/complexType and set of XML attributes have been deleted; + * The "SliderInteraction" class/complexType and set of XML attributes have been deleted; + * The "StyleSheet" class/complexType and set of XML attributes have been deleted; + * The "Table" class/complexType and set of XML attributes have been deleted; + * The "TablePart" class/complexType and set of XML attributes have been deleted; + * The "TDH" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlockFeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateCondition" class/complexType and set of XML attributes have been deleted; + * The "TemplateConstraint" class/complexType and set of XML attributes have been deleted; + * The "TemplateDeclaration" class/complexType and set of XML attributes have been deleted; + * The "TemplateDefault" class/complexType and set of XML attributes have been deleted; + * The "TemplateElse" class/complexType and set of XML attributes have been deleted; + * The "TemplateIf" class/complexType and set of XML attributes have been deleted; + * The "TemplateInline" class/complexType and set of XML attributes have been deleted; + * The "TemplateProcessing" class/complexType and set of XML attributes have been deleted; + * The "TemplateRuleGroup" class/complexType and set of XML attributes have been deleted; + * The "TestFeedback" class/complexType and set of XML attributes have been deleted; + * The "TestPart" class/complexType and set of XML attributes have been deleted; + * The "TextEntryInteraction" class/complexType and set of XML attributes have been deleted; + * The "TimeLimits" class/complexType and set of XML attributes have been deleted; + * The "TR" class/complexType and set of XML attributes have been deleted; + * The "UploadInteraction" class/complexType and set of XML attributes have been deleted; + * The "Value" class/complexType and set of XML attributes have been deleted; + * The "VariableMapping" class/complexType and set of XML attributes have been deleted; + * The "Weight" class/complexType and set of XML attributes have been deleted; + + License: IPR, License and Distribution Notices + + This machine readable file is derived from IMS Global specification IMS Question and Test Interoperability (QTI) Version 2.1 + found at http://www.imsglobal.org/qti and the original IMS Global schema binding or code base + http://www.imsglobal.org/qti. + + Recipients of this document are requested to submit, with their comments, notification of any + relevant patent claims or other intellectual property rights of which they may be aware that might be + infringed by the schema binding contained in this document. + + IMS Global takes no position regarding the validity or scope of any intellectual property or other + rights that might be claimed to pertain to the implementation or use of the technology described in this + document or the extent to which any license under such rights might or might not be available; neither + does it represent that it has made any effort to identify any such rights. Information on IMS Global + procedures with respect to rights in IMS Global specifications can be found at the IMS Global Intellectual Property + Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. + + Copyright (c) IMS Global Learning Consortium 1999-2013. All Rights Reserved. + + License Notice for Users + + Users of products or services that include this document are hereby granted a worldwide, royalty-free, + non-exclusive license to use this document. + + Distribution Notice for Developers + + Developers of products or services that are not original incorporators of this document and + have not changed this document, that is, are distributing a software product that incorporates this + document as is from a third-party source other than IMS, are hereby granted permission to copy, + display and distribute the contents of this document in any medium for any purpose without fee or + royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL + copies, or portions thereof. + + Developers of products or services that are original incorporators of this document and wish + to provide distribution of this document as is or with modifications and developers of products and + services that are not original incorporators of this document and have changed this document, are + required to register with the IMS Global community on the IMS Global website as described in the following two + paragraphs:- + + * If you wish to distribute this document as is, with no modifications, you are hereby granted + permission to copy, display and distribute the contents of this document in any medium for any + purpose without fee or royalty provided that you include this IPR, License and Distribution notice in + its entirety on ALL copies, or portions thereof, that you make and you complete a valid license + registration with IMS and receive an email from IMS granting the license. To register, follow the + instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once + registered you are granted permission to transfer unlimited distribution rights of this document for the + purposes of third-party or other distribution of your product or service that incorporates this + document as long as this IPR, License and Distribution notice remains in place in its entirety; + + * If you wish to create and distribute a derived work from this document, you are hereby + granted permission to copy, display and distribute the contents of the derived work in any medium for + any purpose without fee or royalty provided that you include this IPR, License and Distribution + notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid + profile registration with IMS Global and receive an email from IMS Global granting the license. To register, follow + the instructions on the IMS Global website: http://www.imsglobal.org/profile/. Once registered you are + granted permission to transfer unlimited distribution rights of the derived work for the purposes of + third-party or other distribution of your product or service that incorporates the derived work as long + as this IPR, License and Distribution notice remains in place in its entirety. + + The limited permissions granted above are perpetual and will not be revoked by IMS Global or its + successors or assigns. + + THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS + EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM + NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF + ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. + + Source UML File Information + =========================== + The source file information must be supplied as an XMI file (without diagram layout information). + The supported UML authoring tools are: + (a) Poseidon - v6 (and later) + + Source XSLT File Information + ============================ + XSL Generator: Specificationv1p0_GenerationToolv1.xsl + XSLT Processor: Saxon-HE-9.4.0.4 + Release: 1.0 + Date: 31st March, 2013 + Autogen Engineer: Colin Smythe (IMS Global, UK) + Autogen Date: 2013-04-30 + + IMS Global Auto-generation Binding Tool-kit (I-BAT) + =================================================== + This file was auto-generated using the IMS Global Binding Auto-generation Tool-kit (I-BAT). While every + attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware + that this is an experimental tool. Permission is given to make use of this tool. IMS Global makes no + claim on the materials created by third party users of this tool. Details on how to use this tool + are contained in the IMS Global "I-BAT" documentation available at the IMS Global web-site: + http://www.imsglobal.org. + + Tool Copyright: 2012-2013 (c) IMS Global Learning Consortium Inc. All Rights Reserved. + + + + + + Definition of Schematron Validation Rules + ========================================= + Author: Colin Smythe (IMS Global) + Date: 31st October, 2012 + Version: 1.0 + Status: Final Release + + Description: This is the set of Schematron Rules to further enforce the QTIv2.1 Information Model. The rule sets that have been defined are: + + [RULE SET GENERAL 1] Ensure that certain expressions are NOT used for Response Processing. + [RULE SET GENERAL 2] Ensure that the Item, Section, Test and TestPart identifiers are unique. + [RULE SET GENERAL 3] Ensure that AssessmentItem Response Declarations are correct. + [RULE SET INTERACTION 1] Enforce the correct use the TextEntryInteraction attributes. + + RULE SET GENERAL 1: Ensure that certain expressions are NOT used for Response Processing. The set of rules are:- + * RULE GENERAL 1a-Assertion 1 :- The expression numberCorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 2 :- The expression numberIncorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 3 :- The expression numberPresented must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 4 :- The expression numberResponded must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 5 :- The expression numberSelected must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 6 :- The expression outcomeMinimum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 7 :- The expression outcomeMaximum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 8 :- The expression testVariables must NOT be used in Response Processing. + + RULE SET GENERAL 2: Ensure that the Item, Section, Test and TestPart identifiers are unique. The set of rules are:- + * RULE GENERAL 2a-Assertion 1 :- The AssessmentTest and a TestPart must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 2 :- The AssessmentTest and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 3 :- The AssessmentTest and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 4 :- The AssessmentTest and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 5 :- The AssessmentTest and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 1 :- Two TestParts must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 2 :- The TestPart and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 3 :- The TestPart and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 4 :- The TestPart and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 5 :- The TestPart and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 1 :- Two AssessmentSection children of a TestPart must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 2 :- The AssessmentSection and a descendant AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 3 :- The AssessmentSection and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 4 :- The AssessmentSection and a descendant AssessmentItemRef must not have the same unique identifier. + + RULE SET GENERAL 3: Ensure that AssessmentItem Response Declarations are correct. The set of rules are:- + * RULE GENERAL 3a-Assertion 1 :- ***To be completed***.. + + RULE SET INTERACTION 1: Enforce the correct use the TextEntryInteraction attributes. The set of rules are:- + * RULE INTERACTION 1a-Assertion 1 :- The StringIdentifier and ResponseIdentifier attribute values must not be the same. + + History: Version 1.0: The first set of schematron rules for the IMS Global QTIv2.1 specification. + + + + + Schematron Validation Rules for QTI Specification v2.1. + + + + Ensure that certain expressions are NOT used for Response Processing. + + + + + + + + + Ensure that the Item, Section, Test and TestPart identifiers are unique. + + + + + + + + + + + + + Ensure that AssessmentItem Response Declarations are correct. + + + + + + + + + Enforce the correct use the TextEntryInteraction attributes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any namespaced element from any namespace may be included within an "any" element. + The namespace for the imported element must be defined in the instance, and the schema must be imported. + The extension has a definition of "lax" i.e. they can reuse elements from the target namespace. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The custom operator provides a namespaced extension mechanism for defining operations not currently supported by this specification. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The equal operator takes two sub-expressions which must both have single cardinality and have a numerical base-type. The result is a single boolean with a value of true if the two expressions are numerically equal and false if they are not. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The equalRounded operator takes two sub-expressions which must both have single cardinality and have a numerical base-type. The result is a single boolean with a value of true if the two expressions are numerically equal after rounding and false if they are not. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The field-value operator takes a sub-expression with a record container value. The result is the value of the field with the specified fieldIdentifier. If there is no field with that identifier then the result of the operator is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The index operator takes a sub-expression with an ordered container value and any base-type. The result is the nth value of the container. The result has the same base-type as the sub-expression but single cardinality. The first value of a container has index 1, the second 2 and so on. n must be a positive integer. If n exceeds the number of values in the container (or the sub-expression is NULL) then the result of the index operator is NULL. If n is an identifier, it is the value of n at runtime that is used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The inside operator takes a single sub-expression which must have a baseType of point. The result is a single boolean with a value of true if the given point is inside the area defined by shape and coords. If the sub-expression is a container the result is true if any of the points are inside the area. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable operator e.g. an 'and' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable operator e.g. an 'and' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a two variable operator e.g. greater than. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a single variable operator e.g. a 'not'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The LookupOutcomeValue complexType is the container for look-up mapping values to outcome variables. The lookupOutcomeValue rule sets the value of an outcome variable to the value obtained by looking up the value of the associated expression in the lookupTable associated with the outcome's declaration. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The mathOperator operator takes 1 or more sub-expressions which all have single cardinality and have numerical base-types. The trigonometric functions, sin, cos and tan, take one argument in radians, which evaluates to a single float. Other functions take one numerical argument. Further functions might take more than one numerical argument, e.g. atan2 (two argument arc tan). The result is a single float, except for the functions signum, floor and ceil, which return a single integer. If any of the sub-expressions is NULL, the result is NULL. If any of the sub-expressions falls outside the natural domain of the function called by mathOperator, e.g. log(0) or asin(2), then the result is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable numeric-based operator e.g. a 'sum' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The patternMatch operator takes a sub-expression which must have single cardinality and a base-type of string. The result is a single boolean with a value of true if the sub-expression matches the regular expression given by pattern and false if it doesn't. If the sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The repeat operator allows the filling of an ordered container. The result of a repeat operator is an ordered set of values calculated from the expressions. Values will be set in the associated container by a setTemplateValue expression. Each expression is calculated as many times as it is queried by numberRepeats. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ResponseCondition complexType is the container for the sequence of outcome conditions to be applied. The condition is structured as an 'If..ElseIf..ElseIf..Else' sequence. Each clause as its own response rule construct. + + + + + + + + + + + + + The ResponseElse complexType is the container for the 'Else' clause. If the expression given in a responseIf or responseElseIf evaluates to true then the sub-rules contained within it are followed and any following responseElseIf or responseElse parts are ignored for this response condition. If the expression given in a responseIf or responseElseIf does not evaluate to true then consideration passes to the next responseElseIf or, if there are no more responseElseIf parts then the sub-rules of the responseElse are followed (if specified). + + + + + + + + + + + + + + + + + + The ResponseIf complexType is the container for the 'If' clause. If the expression given in a responseIf or responseElseIf evaluates to true then the sub-rules contained within it are followed and any following responseElseIf or responseElse parts are ignored for this response condition. If the expression given in a responseIf or responseElseIf does not evaluate to true then consideration passes to the next responseElseIf or, if there are no more responseElseIf parts then the sub-rules of the responseElse are followed (if specified). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ResponseProcessing complexType is the container for response processing instructions. Response processing involves the application of a set of responseRules, including the testing of responseConditions and the evaluation of expressions involving the item variables. For delivery engines that are only designed to support very simple use cases the implementation of a system for carrying out this evaluation, conditional testing and processing may pose a barrier to the adoption of the specification. + + + + + + + + + + + + + + + + + + + + The ResponseProcessingFragment complexType is the container for a group of response rules. A responseProcessingFragment is a simple group of responseRules which are grouped together in order to allow them to be managed as a separate resource. It should not be used for any other purpose. + + + + + + + + + + + + + + + + + + The roundTo operator takes one sub-expression which must have single cardinality and a numerical base-type. The result is a single float with the value nearest to that of the expression's value such that when converted to a decimal string it represents the expression rounded by the specified rounding method to the specified precision. If the sub-expression is NULL, then the result is NULL. If the sub-expression is INF, then the result is INF. If the sub-expression is -INF, then the result is -INF. If the argument is NaN, then the result is NULL. When rounding to n significant figures, the deciding digit is the (n+1)th digit counting from the first non-zero digit from the left in the number. If the deciding digit is 5 or greater, the nth digit is increased by 1 and all digits to its right are discarded; if the deciding digit is less than 5, all digits to the right of the nth digit are discarded. When rounding to n decimal places, the deciding digit is the (n+1)th digit counting to the right from the decimal point. If the deciding digit is 5 or greater, the nth digit is increased by 1 and all digits to its right are discarded; if the deciding digit is less than 5, all digits to the right of the nth digit are discarded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The SetValue complexType is the container for the value set for the associated element (the element is identified using the 'identifier' attribute). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The statsOperator operator takes 1 sub-expression which is a container of multiple or ordered cardinality and has a numerical base-type. The result is a single float. If the sub-expression or any value contained therein is NULL, the result is NULL. If any value contained in the sub-expression is not a numerical value, then the result is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The stringMatch operator takes two sub-expressions which must have single and a base-type of string. The result is a single boolean with a value of true if the two strings match according to the comparison rules defined by the attributes below and false if they don't. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The substring operator takes two sub-expressions which must both have an effective base-type of string and single cardinality. The result is a single boolean with a value of true if the first expression is a substring of the second expression and false if it isn't. If either sub-expression is NULL then the result of the operator is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The simplest expression returns a single value from the set defined by the given baseType. + + + + + + + + + + + + + This expression looks up the declaration of a response variable and returns the associated correctResponse or NULL if no correct value was declared. When used in outcomes processing item identifier prefixing (see variable) may be used to obtain the correct response from an individual item. This is intentionally empty. + + + + + + + + + + + + + This expression looks up the declaration of an itemVariable and returns the associated defaultValue or NULL if no default value was declared. When used in outcomes processing item identifier prefixing (see variable) may be used to obtain the default value from an individual item. This is intentionally empty. + + + + + + + + + + + + + This expression looks up the value of a response variable and then transforms it using the associated mapping, which must have been declared. The result is a single float. If the response variable has single cardinality then the value returned is simply the mapped target value from the map. If the response variable has multiple or ordered cardinality then the value returned is the sum of the mapped target values. This expression cannot be applied to variables of record cardinality. This is intentionally empty. + + + + + + + + + + + + + The result is a mathematical constant returned as a single float, e.g. pi and e. + + + + + + + + + + + + + Provides an operator that returns the number of values that confrm to the associated constraints e.g. 'numberCorrect'. + + + + + + + + + + + + + + + This expression, which can only be used in outcomes processing, simultaneously looks up the normal Maximum/Minimum value of an outcome variable in a sub-set of the items referred to in a test. Only variables with single cardinality are considered. If any of the items within the given subset have no declared maximum the result is NULL, otherwise the result has cardinality multiple and base-type float. This is intentionally empty. + + + + + + + + + + + + + + + + + Selects a random float from the specified range [min,max]. This is intentionally empty. + + + + + + + + + + + + + + Selects a random integer from the specified range [min,max] satisfying min + step * n for some integer n. For example, with min=2, max=11 and step=3 the values {2,5,8,11} are possible. + + + + + + + + + + + + + + + This expression, which can only be used in outcomes processing, simultaneously looks up the value of an itemVariable in a sub-set of the items referred to in a test. Only variables with single cardinality are considered, all NULL values are ignored. The result has cardinality multiple and base-type as specified below. This is intentionally empty. + + + + + + + + + + + + + + + + + + This expression looks up the value of an itemVariable that has been declared in a corresponding variableDeclaration or is one of the built-in variables. The result has the base-type and cardinality declared for the variable subject to the type promotion of weighted outcomes. This is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtisectionv2p1_v1p0.xsd b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtisectionv2p1_v1p0.xsd new file mode 100644 index 000000000..8d0560a5b --- /dev/null +++ b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtisectionv2p1_v1p0.xsd @@ -0,0 +1,2209 @@ + + + + + + + + + + XSD Data File Information + ========================= + Author: Colin Smythe + Date: 31st July, 2012 + Version: Final 1.0 + Status: Final Release + Description: This is the Platform Specific Model of the APIPv1.0 profile of the IMS QTI v2.1 Information Model. + This is the Core Level Profile for APIPv1.0 QTIv2.1 Sections. + + History: This is the first version of the APIPv1.0 QTIv2.1 Section Profile. + + PROFILE: This is the "APIP-Section (Core)". THIS IS A PROFILE OF THE BASE SPECIFICATION. + The changes to the base specification are: + * The schema namespace has been changed to "http://www.imsglobal.org/xsd/apip/apipv1p0/qtisection/imsqti_v2p1". + * The schema version has been changed to "IMS APIP 1.0 QTI 2.1 SECTION". + * The "AnyN" class/complexType and set of XML attributes have been deleted; + * The "AreaMapEntry" class/complexType and set of XML attributes have been deleted; + * The "AreaMapping" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItem" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSectionSelection" class/complexType and set of XML attributes have been deleted; + * The "AssessmentTest" class/complexType and set of XML attributes have been deleted; + * The "AssociableHotspot" class/complexType and set of XML attributes have been deleted; + * The "AssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "BaseValue" class/complexType and set of XML attributes have been deleted; + * The "BranchRule" class/complexType and set of XML attributes have been deleted; + * The "ChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "Correct" class/complexType and set of XML attributes have been deleted; + * The "CorrectResponse" class/complexType and set of XML attributes have been deleted; + * The "CustomInteraction" class/complexType and set of XML attributes have been deleted; + * The "CustomOperator" class/complexType and set of XML attributes have been deleted; + * The "Date" class/complexType and set of XML attributes have been deleted; + * The "DateTime" class/complexType and set of XML attributes have been deleted; + * The "Default" class/complexType and set of XML attributes have been deleted; + * The "DefaultValue" class/complexType and set of XML attributes have been deleted; + * The "DrawingInteraction" class/complexType and set of XML attributes have been deleted; + * The "EndAttemptInteraction" class/complexType and set of XML attributes have been deleted; + * The "Equal" class/complexType and set of XML attributes have been deleted; + * The "EqualRounded" class/complexType and set of XML attributes have been deleted; + * The "ExpressionGroup" class/complexType and set of XML attributes have been deleted; + * The "ExtendedTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "FeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "FeedbackInline" class/complexType and set of XML attributes have been deleted; + * The "FieldValue" class/complexType and set of XML attributes have been deleted; + * The "Gap" class/complexType and set of XML attributes have been deleted; + * The "GapChoice" class/complexType and set of XML attributes have been deleted; + * The "GapImg" class/complexType and set of XML attributes have been deleted; + * The "GapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GapText" class/complexType and set of XML attributes have been deleted; + * The "GraphicAssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicGapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicOrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotspotChoice" class/complexType and set of XML attributes have been deleted; + * The "HotspotInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotText" class/complexType and set of XML attributes have been deleted; + * The "HotTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "Index" class/complexType and set of XML attributes have been deleted; + * The "InfoControl" class/complexType and set of XML attributes have been deleted; + * The "InlineChoice" class/complexType and set of XML attributes have been deleted; + * The "InlineChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "Inside" class/complexType and set of XML attributes have been deleted; + * The "InterpolationTable" class/complexType and set of XML attributes have been deleted; + * The "InterpolationTableEntry" class/complexType and set of XML attributes have been deleted; + * The "ItemBody" class/complexType and set of XML attributes have been deleted; + * The "ItemSessionControl" class/complexType and set of XML attributes have been deleted; + * The "Logic0toMany" class/complexType and set of XML attributes have been deleted; + * The "Logic1toMany" class/complexType and set of XML attributes have been deleted; + * The "LogicPair" class/complexType and set of XML attributes have been deleted; + * The "LogicSingle" class/complexType and set of XML attributes have been deleted; + * The "LookupOutcomeValue" class/complexType and set of XML attributes have been deleted; + * The "MapEntry" class/complexType and set of XML attributes have been deleted; + * The "Mapping" class/complexType and set of XML attributes have been deleted; + * The "MapResponse" class/complexType and set of XML attributes have been deleted; + * The "MatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "MatchTable" class/complexType and set of XML attributes have been deleted; + * The "MatchTableEntry" class/complexType and set of XML attributes have been deleted; + * The "MathConstant" class/complexType and set of XML attributes have been deleted; + * The "MathOperator" class/complexType and set of XML attributes have been deleted; + * The "MediaInteraction" class/complexType and set of XML attributes have been deleted; + * The "ModalFeedback" class/complexType and set of XML attributes have been deleted; + * The "Number" class/complexType and set of XML attributes have been deleted; + * The "NumericExpressionGroup" class/complexType and set of XML attributes have been deleted; + * The "NumericLogic1toMany" class/complexType and set of XML attributes have been deleted; + * The "Object" class/complexType and set of XML attributes have been deleted; + * The "ObjectFlowGroup" class/complexType and set of XML attributes have been deleted; + * The "OrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "OutcomeCondition" class/complexType and set of XML attributes have been deleted; + * The "OutcomeDeclaration" class/complexType and set of XML attributes have been deleted; + * The "OutcomeElse" class/complexType and set of XML attributes have been deleted; + * The "OutcomeIf" class/complexType and set of XML attributes have been deleted; + * The "OutcomeMinMax" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessing" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "OutcomeRule" class/complexType and set of XML attributes have been deleted; + * The "Param" class/complexType and set of XML attributes have been deleted; + * The "PatternMatch" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectInteraction" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectStage" class/complexType and set of XML attributes have been deleted; + * The "PrintedVariable" class/complexType and set of XML attributes have been deleted; + * The "Prompt" class/complexType and set of XML attributes have been deleted; + * The "RandomFloat" class/complexType and set of XML attributes have been deleted; + * The "RandomInteger" class/complexType and set of XML attributes have been deleted; + * The "Repeat" class/complexType and set of XML attributes have been deleted; + * The "ResponseCondition" class/complexType and set of XML attributes have been deleted; + * The "ResponseDeclaration" class/complexType and set of XML attributes have been deleted; + * The "ResponseElse" class/complexType and set of XML attributes have been deleted; + * The "ResponseIf" class/complexType and set of XML attributes have been deleted; + * The "ResponseProcessing" class/complexType and set of XML attributes have been deleted; + * The "ResponseProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "ResponseRuleGroup" class/complexType and set of XML attributes have been deleted; + * The "RoundTo" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateInline" class/complexType and set of XML attributes have been deleted; + * The "SelectPointInteraction" class/complexType and set of XML attributes have been deleted; + * The "SetValue" class/complexType and set of XML attributes have been deleted; + * The "SimpleAssociableChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleMatchSet" class/complexType and set of XML attributes have been deleted; + * The "SliderInteraction" class/complexType and set of XML attributes have been deleted; + * The "StatsOperator" class/complexType and set of XML attributes have been deleted; + * The "StringMatch" class/complexType and set of XML attributes have been deleted; + * The "Substring" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlockFeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateCondition" class/complexType and set of XML attributes have been deleted; + * The "TemplateConstraint" class/complexType and set of XML attributes have been deleted; + * The "TemplateDeclaration" class/complexType and set of XML attributes have been deleted; + * The "TemplateDefault" class/complexType and set of XML attributes have been deleted; + * The "TemplateElse" class/complexType and set of XML attributes have been deleted; + * The "TemplateIf" class/complexType and set of XML attributes have been deleted; + * The "TemplateInline" class/complexType and set of XML attributes have been deleted; + * The "TemplateProcessing" class/complexType and set of XML attributes have been deleted; + * The "TemplateRuleGroup" class/complexType and set of XML attributes have been deleted; + * The "TestFeedback" class/complexType and set of XML attributes have been deleted; + * The "TestPart" class/complexType and set of XML attributes have been deleted; + * The "TestVariables" class/complexType and set of XML attributes have been deleted; + * The "TextEntryInteraction" class/complexType and set of XML attributes have been deleted; + * The "UploadInteraction" class/complexType and set of XML attributes have been deleted; + * The "Value" class/complexType and set of XML attributes have been deleted; + * The "Variable" class/complexType and set of XML attributes have been deleted; + * The "VariableMapping" class/complexType and set of XML attributes have been deleted; + * The "VariableString" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSection" class/complexType has been modified by:- + - The "timeLimits" attribute has been prohibited; + * The "RubricBlock.Attr" class/complexType has been modified by:- + - The "use" attribute class type has been changed to the class "UseType"; + * The "SectionPart" class/complexType has been modified by:- + - The "include" attribute has been prohibited; + - The "assessmentSection" attribute has been prohibited; + + License: IPR, License and Distribution Notices + + This machine readable file is derived from IMS Global specification IMS Question and Test Interoperability (QTI) Version 2.1 + found at http://www.imsglobal.org/qti and the original IMS Global schema binding or code base + http://www.imsglobal.org/qti. + + Recipients of this document are requested to submit, with their comments, notification of any + relevant patent claims or other intellectual property rights of which they may be aware that might be + infringed by the schema binding contained in this document. + + IMS Global takes no position regarding the validity or scope of any intellectual property or other + rights that might be claimed to pertain to the implementation or use of the technology described in this + document or the extent to which any license under such rights might or might not be available; neither + does it represent that it has made any effort to identify any such rights. Information on IMS Global + procedures with respect to rights in IMS Global specifications can be found at the IMS Global Intellectual Property + Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. + + Copyright (c) IMS Global Learning Consortium 1999-2013. All Rights Reserved. + + License Notice for Users + + Users of products or services that include this document are hereby granted a worldwide, royalty-free, + non-exclusive license to use this document. + + Distribution Notice for Developers + + Developers of products or services that are not original incorporators of this document and + have not changed this document, that is, are distributing a software product that incorporates this + document as is from a third-party source other than IMS, are hereby granted permission to copy, + display and distribute the contents of this document in any medium for any purpose without fee or + royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL + copies, or portions thereof. + + Developers of products or services that are original incorporators of this document and wish + to provide distribution of this document as is or with modifications and developers of products and + services that are not original incorporators of this document and have changed this document, are + required to register with the IMS Global community on the IMS Global website as described in the following two + paragraphs:- + + * If you wish to distribute this document as is, with no modifications, you are hereby granted + permission to copy, display and distribute the contents of this document in any medium for any + purpose without fee or royalty provided that you include this IPR, License and Distribution notice in + its entirety on ALL copies, or portions thereof, that you make and you complete a valid license + registration with IMS and receive an email from IMS granting the license. To register, follow the + instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once + registered you are granted permission to transfer unlimited distribution rights of this document for the + purposes of third-party or other distribution of your product or service that incorporates this + document as long as this IPR, License and Distribution notice remains in place in its entirety; + + * If you wish to create and distribute a derived work from this document, you are hereby + granted permission to copy, display and distribute the contents of the derived work in any medium for + any purpose without fee or royalty provided that you include this IPR, License and Distribution + notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid + profile registration with IMS Global and receive an email from IMS Global granting the license. To register, follow + the instructions on the IMS Global website: http://www.imsglobal.org/profile/. Once registered you are + granted permission to transfer unlimited distribution rights of the derived work for the purposes of + third-party or other distribution of your product or service that incorporates the derived work as long + as this IPR, License and Distribution notice remains in place in its entirety. + + The limited permissions granted above are perpetual and will not be revoked by IMS Global or its + successors or assigns. + + THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS + EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM + NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF + ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. + + Source UML File Information + =========================== + The source file information must be supplied as an XMI file (without diagram layout information). + The supported UML authoring tools are: + (a) Poseidon - v6 (and later) + + Source XSLT File Information + ============================ + XSL Generator: Specificationv1p0_GenerationToolv1.xsl + XSLT Processor: Saxon-HE-9.4.0.4 + Release: 1.0 + Date: 31st March, 2013 + Autogen Engineer: Colin Smythe (IMS Global, UK) + Autogen Date: 2013-04-30 + + IMS Global Auto-generation Binding Tool-kit (I-BAT) + =================================================== + This file was auto-generated using the IMS Global Binding Auto-generation Tool-kit (I-BAT). While every + attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware + that this is an experimental tool. Permission is given to make use of this tool. IMS Global makes no + claim on the materials created by third party users of this tool. Details on how to use this tool + are contained in the IMS Global "I-BAT" documentation available at the IMS Global web-site: + http://www.imsglobal.org. + + Tool Copyright: 2012-2013 (c) IMS Global Learning Consortium Inc. All Rights Reserved. + + + + + + Definition of Schematron Validation Rules + ========================================= + Author: Colin Smythe (IMS Global) + Date: 31st October, 2012 + Version: 1.0 + Status: Final Release + + Description: This is the set of Schematron Rules to further enforce the QTIv2.1 Information Model. The rule sets that have been defined are: + + [RULE SET GENERAL 1] Ensure that certain expressions are NOT used for Response Processing. + [RULE SET GENERAL 2] Ensure that the Item, Section, Test and TestPart identifiers are unique. + [RULE SET GENERAL 3] Ensure that AssessmentItem Response Declarations are correct. + [RULE SET INTERACTION 1] Enforce the correct use the TextEntryInteraction attributes. + + RULE SET GENERAL 1: Ensure that certain expressions are NOT used for Response Processing. The set of rules are:- + * RULE GENERAL 1a-Assertion 1 :- The expression numberCorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 2 :- The expression numberIncorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 3 :- The expression numberPresented must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 4 :- The expression numberResponded must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 5 :- The expression numberSelected must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 6 :- The expression outcomeMinimum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 7 :- The expression outcomeMaximum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 8 :- The expression testVariables must NOT be used in Response Processing. + + RULE SET GENERAL 2: Ensure that the Item, Section, Test and TestPart identifiers are unique. The set of rules are:- + * RULE GENERAL 2a-Assertion 1 :- The AssessmentTest and a TestPart must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 2 :- The AssessmentTest and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 3 :- The AssessmentTest and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 4 :- The AssessmentTest and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 5 :- The AssessmentTest and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 1 :- Two TestParts must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 2 :- The TestPart and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 3 :- The TestPart and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 4 :- The TestPart and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 5 :- The TestPart and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 1 :- Two AssessmentSection children of a TestPart must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 2 :- The AssessmentSection and a descendant AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 3 :- The AssessmentSection and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 4 :- The AssessmentSection and a descendant AssessmentItemRef must not have the same unique identifier. + + RULE SET GENERAL 3: Ensure that AssessmentItem Response Declarations are correct. The set of rules are:- + * RULE GENERAL 3a-Assertion 1 :- ***To be completed***.. + + RULE SET INTERACTION 1: Enforce the correct use the TextEntryInteraction attributes. The set of rules are:- + * RULE INTERACTION 1a-Assertion 1 :- The StringIdentifier and ResponseIdentifier attribute values must not be the same. + + History: Version 1.0: The first set of schematron rules for the IMS Global QTIv2.1 specification. + + + + + Schematron Validation Rules for QTI Specification v2.1. + + + + Ensure that certain expressions are NOT used for Response Processing. + + + + + + + + + Ensure that the Item, Section, Test and TestPart identifiers are unique. + + + + + + + + + + + + + Ensure that AssessmentItem Response Declarations are correct. + + + + + + + + + Enforce the correct use the TextEntryInteraction attributes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any namespaced element from any namespace may be included within an "any" element. + The namespace for the imported element must be defined in the instance, and the schema must be imported. + The extension has a definition of "lax" i.e. they can reuse elements from the target namespace. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'A' complexType is the container for content that is equivalent to the HTML 'a' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the container for referential link to the externally stored AssessmentItem (each such Item is stored in its own XML instance file). The identifier attribute should be used to identify the actual Item. The details for the Item provided at this point enable the associated Test/Section to determine if the Item fulfills any prerequisites. + + + + + + + + + + + + + + + + + A Test consists of one or more Sections. An 'assessmentSection' is the binding form of a Section. More significantly, a Section is an aggregation of assessmentItems i.e. a set of Items that are used to achieve some co-ordnated assessment activity. An assessmentSection contains the rules that should be used to select and order the set of associated Sections and/or Items. Furthermore, the associated rubricBlock is used to present content that is relevant to all of the contained Sections and/or Items. + [APIP-Section (Core)] Profile - the changes to the XML element list are: + * The "timeLimits" element has been prohibited; + + + + + + + + + + + + + + + + + + + + + + + The 'BlockQuote' complexType is the container for content that is equivalent to the HTML 'blockquote' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Caption' complexType is the container for content that is equivalent to the HTML 'caption' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'ColGroup' complexType is the container for set of columns defined within a table. The content is the set of 'col' HTML markup. + + + + + + + + + + + + + + + + The 'DD' complexType is the container for term definitions as per the HTML 'dd' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Div' complexType is the container for content that is equivalent to the HTML 'div' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'DL' complexType is the container for list definitions as per the HTML 'dl' markup. This can contain any combination of 'dd' and 'dt' HTML elements. + + + + + + + + + + + + + + + + + + + The 'DT' complexType is the container for term definitions as per the HTML 'dt' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The complexType for the set of HTML text elements i.e. h1, h2, h3, h4, h5, h6, p, pre and address. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'LI' complexType is the container for the definition of lists as per the HTML 'li' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the container for the ordering rules to be applied when determining the order in which the selected AssessmentSections and AssessmentItems are to be presented. At present this is an open, namespaced, extension point. Feedback on what proprietary features are used is welcomed. + + + + + + + + + + + + + The 'OUL' complexType is the container for ordered and unordered lists as per the HTML 'ul' and 'ol' markup. + + + + + + + + + + + + + + + + The 'Q' complexType is the container for content that is equivalent to the HTML 'q' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A rubric block identifies instructions to one or more of the actors that view the item or set of items (as per a section). Although rubric blocks are defined as simpleBlocks they must not contain interactions. The visibility of nested bodyElements or rubricBlocks is determined by the outermost element. In other words, if an element is determined to be hidden then all of its content is hidden including conditionally visible elements for which the conditions are satisfied and that therefore would otherwise be visible. + [APIP-Section (Core)] Profile - the changes to the XML attribute list are: + * The "use" attribute class type has been changed to the class "UseType"; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the container for the selection rules to be applied when selecting the enclosed AssessmentSections and AssessmentItems. At present this is an open, namespaced, extension point. Feedback on what proprietary features are used is welcomed. + + + + + + + + + + + + + + The 'Table' complexType is the container for content that is equivalent to the HTML 'table' markup. + + + + + + + + + + + + + + + + + + + + + + The TablePart complexType is the container for set of table row content that is used to the support content within a table. + + + + + + + + + + + + + + + The 'TDH' complexType is the container for content that is equivalent to the HTML 'td' and 'th' markup within a table. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'TR' complexType is the container for content that is equivalent to the HTML 'tr' markup. + + + + + + + + + + + + + + + + + + + + + + This is the container for referential link to an externally stored AssessmentSection (each such Section is stored in its own XML instance file). The identifier attribute should be used to identify the actual Section. + + + + + + + + + + + + + + The 'BR' complexType is the container for content that is equivalent to the HTML 'br' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + The 'Col' complexType is the container for content that is equivalent to the HTML 'col' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + The 'HR' complexType is the container for content that is equivalent to the HTML 'hr' markup.This complexType is intentionally empty. + + + + + + + + + + + + + + + + + The 'Img' complexType is the container for content that is equivalent to the HTML 'img' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + This is used to associate an external stylesheet (it is assumed that this takes the form of a CSS file but other formats are permitted). + + + + + + + + + + + + + + + + In the context of a specific assessmentTest an item, or group of items, may be subject to a time constraint. The QTI specification supports both minimum and maximum time constraints. The controlled time for a single item is simply the duration of the item session as defined by the builtin response variable duration. For assessmentSections, testParts and whole assessmentTests the time limits relate to the durations of all the item sessions plus any other time spent navigating that part of the test. In other words, the time includes time spent in states where no item is being interacted with, such as dedicated navigation screens. This complexType is intentionally empty. + + + + + + + + + + + + + + + The Weight complexType stores the weighting information. The contribution of an individual item score to an overall test score typically varies from test to test. The score of the item is said to be weighted. Weights are defined as part of each reference to an item (assessmentItemRef) within a test. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtitestv2p1_v1p0.xsd b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtitestv2p1_v1p0.xsd new file mode 100644 index 000000000..19983055d --- /dev/null +++ b/qtiworks-jqtiplus/src/main/resources/uk/ac/ed/ph/jqtiplus/xml-catalog/www.imsglobal.org/xsd/apip/apipv1p0/apipv1p0_qtitestv2p1_v1p0.xsd @@ -0,0 +1,4927 @@ + + + + + + + + + + XSD Data File Information + ========================= + Author: Colin Smythe + Date: 31st July, 2012 + Version: Final 1.0 + Status: Final Release + Description: This is the Platform Specific Model of the APIPv1.0 profile of the IMS QTI v2.1 Information Model. + This is the Core Profile for APIPv1.0 QTIv2.1 Tests. + + History: This is the first version of the APIPv1.0 QTIv2.1 Test Profile. + + PROFILE: This is the "APIP-Test (Core)". THIS IS A PROFILE OF THE BASE SPECIFICATION. + The changes to the base specification are: + * The schema namespace has been changed to "http://www.imsglobal.org/xsd/apip/apipv1p0/qtitest/imsqti_v2p1". + * The schema version has been changed to "IMS APIP 1.0 QTI 2.1 TEST". + * The "AreaMapEntry" class/complexType and set of XML attributes have been deleted; + * The "AreaMapEntry" class/complexType and set of XML attributes have been deleted; + * The "AreaMapping" class/complexType and set of XML attributes have been deleted; + * The "AreaMapping" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItem" class/complexType and set of XML attributes have been deleted; + * The "AssessmentItemRef" class/complexType and set of XML attributes have been deleted; + * The "AssessmentSection" class/complexType and set of XML attributes have been deleted; + * The "AssociableHotspot" class/complexType and set of XML attributes have been deleted; + * The "AssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "BranchRule" class/complexType and set of XML attributes have been deleted; + * The "ChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "CorrectResponse" class/complexType and set of XML attributes have been deleted; + * The "CustomInteraction" class/complexType and set of XML attributes have been deleted; + * The "DrawingInteraction" class/complexType and set of XML attributes have been deleted; + * The "EndAttemptInteraction" class/complexType and set of XML attributes have been deleted; + * The "ExtendedTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "FeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "FeedbackInline" class/complexType and set of XML attributes have been deleted; + * The "Gap" class/complexType and set of XML attributes have been deleted; + * The "GapChoice" class/complexType and set of XML attributes have been deleted; + * The "GapImg" class/complexType and set of XML attributes have been deleted; + * The "GapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GapText" class/complexType and set of XML attributes have been deleted; + * The "GraphicAssociateInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicGapMatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "GraphicOrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotspotChoice" class/complexType and set of XML attributes have been deleted; + * The "HotspotInteraction" class/complexType and set of XML attributes have been deleted; + * The "HotText" class/complexType and set of XML attributes have been deleted; + * The "HotTextInteraction" class/complexType and set of XML attributes have been deleted; + * The "InlineChoice" class/complexType and set of XML attributes have been deleted; + * The "InlineChoiceInteraction" class/complexType and set of XML attributes have been deleted; + * The "ItemBody" class/complexType and set of XML attributes have been deleted; + * The "LookupOutcomeValue" class/complexType and set of XML attributes have been deleted; + * The "MatchInteraction" class/complexType and set of XML attributes have been deleted; + * The "MatchTable" class/complexType and set of XML attributes have been deleted; + * The "MatchTableEntry" class/complexType and set of XML attributes have been deleted; + * The "MediaInteraction" class/complexType and set of XML attributes have been deleted; + * The "ModalFeedback" class/complexType and set of XML attributes have been deleted; + * The "Object" class/complexType and set of XML attributes have been deleted; + * The "ObjectFlowGroup" class/complexType and set of XML attributes have been deleted; + * The "Ordering" class/complexType and set of XML attributes have been deleted; + * The "OrderInteraction" class/complexType and set of XML attributes have been deleted; + * The "OutcomeProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "Param" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectInteraction" class/complexType and set of XML attributes have been deleted; + * The "PositionObjectStage" class/complexType and set of XML attributes have been deleted; + * The "PrintedVariable" class/complexType and set of XML attributes have been deleted; + * The "Prompt" class/complexType and set of XML attributes have been deleted; + * The "ResponseCondition" class/complexType and set of XML attributes have been deleted; + * The "ResponseDeclaration" class/complexType and set of XML attributes have been deleted; + * The "ResponseElse" class/complexType and set of XML attributes have been deleted; + * The "ResponseIf" class/complexType and set of XML attributes have been deleted; + * The "ResponseProcessing" class/complexType and set of XML attributes have been deleted; + * The "ResponseProcessingFragment" class/complexType and set of XML attributes have been deleted; + * The "ResponseRuleGroup" class/complexType and set of XML attributes have been deleted; + * The "RubricBlock" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "RubricBlockTemplateInline" class/complexType and set of XML attributes have been deleted; + * The "SectionPart" class/complexType and set of XML attributes have been deleted; + * The "Selection" class/complexType and set of XML attributes have been deleted; + * The "SelectPointInteraction" class/complexType and set of XML attributes have been deleted; + * The "SimpleAssociableChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleChoice" class/complexType and set of XML attributes have been deleted; + * The "SimpleMatchSet" class/complexType and set of XML attributes have been deleted; + * The "SliderInteraction" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateBlockFeedbackBlock" class/complexType and set of XML attributes have been deleted; + * The "TemplateCondition" class/complexType and set of XML attributes have been deleted; + * The "TemplateConstraint" class/complexType and set of XML attributes have been deleted; + * The "TemplateDeclaration" class/complexType and set of XML attributes have been deleted; + * The "TemplateDefault" class/complexType and set of XML attributes have been deleted; + * The "TemplateElse" class/complexType and set of XML attributes have been deleted; + * The "TemplateIf" class/complexType and set of XML attributes have been deleted; + * The "TemplateInline" class/complexType and set of XML attributes have been deleted; + * The "TemplateProcessing" class/complexType and set of XML attributes have been deleted; + * The "TemplateRuleGroup" class/complexType and set of XML attributes have been deleted; + * The "TextEntryInteraction" class/complexType and set of XML attributes have been deleted; + * The "UploadInteraction" class/complexType and set of XML attributes have been deleted; + * The "VariableMapping" class/complexType and set of XML attributes have been deleted; + * The "Weight" class/complexType and set of XML attributes have been deleted; + * The "TestPart" class/complexType has been modified by:- + - The "preCondition" attribute has been prohibited; + + License: IPR, License and Distribution Notices + + This machine readable file is derived from IMS Global specification IMS Question and Test Interoperability (QTI) Version 2.1 + found at http://www.imsglobal.org/qti and the original IMS Global schema binding or code base + http://www.imsglobal.org/qti. + + Recipients of this document are requested to submit, with their comments, notification of any + relevant patent claims or other intellectual property rights of which they may be aware that might be + infringed by the schema binding contained in this document. + + IMS Global takes no position regarding the validity or scope of any intellectual property or other + rights that might be claimed to pertain to the implementation or use of the technology described in this + document or the extent to which any license under such rights might or might not be available; neither + does it represent that it has made any effort to identify any such rights. Information on IMS Global + procedures with respect to rights in IMS Global specifications can be found at the IMS Global Intellectual Property + Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. + + Copyright (c) IMS Global Learning Consortium 1999-2013. All Rights Reserved. + + License Notice for Users + + Users of products or services that include this document are hereby granted a worldwide, royalty-free, + non-exclusive license to use this document. + + Distribution Notice for Developers + + Developers of products or services that are not original incorporators of this document and + have not changed this document, that is, are distributing a software product that incorporates this + document as is from a third-party source other than IMS, are hereby granted permission to copy, + display and distribute the contents of this document in any medium for any purpose without fee or + royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL + copies, or portions thereof. + + Developers of products or services that are original incorporators of this document and wish + to provide distribution of this document as is or with modifications and developers of products and + services that are not original incorporators of this document and have changed this document, are + required to register with the IMS Global community on the IMS Global website as described in the following two + paragraphs:- + + * If you wish to distribute this document as is, with no modifications, you are hereby granted + permission to copy, display and distribute the contents of this document in any medium for any + purpose without fee or royalty provided that you include this IPR, License and Distribution notice in + its entirety on ALL copies, or portions thereof, that you make and you complete a valid license + registration with IMS and receive an email from IMS granting the license. To register, follow the + instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once + registered you are granted permission to transfer unlimited distribution rights of this document for the + purposes of third-party or other distribution of your product or service that incorporates this + document as long as this IPR, License and Distribution notice remains in place in its entirety; + + * If you wish to create and distribute a derived work from this document, you are hereby + granted permission to copy, display and distribute the contents of the derived work in any medium for + any purpose without fee or royalty provided that you include this IPR, License and Distribution + notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid + profile registration with IMS Global and receive an email from IMS Global granting the license. To register, follow + the instructions on the IMS Global website: http://www.imsglobal.org/profile/. Once registered you are + granted permission to transfer unlimited distribution rights of the derived work for the purposes of + third-party or other distribution of your product or service that incorporates the derived work as long + as this IPR, License and Distribution notice remains in place in its entirety. + + The limited permissions granted above are perpetual and will not be revoked by IMS Global or its + successors or assigns. + + THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS + EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM + NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF + ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. + + Source UML File Information + =========================== + The source file information must be supplied as an XMI file (without diagram layout information). + The supported UML authoring tools are: + (a) Poseidon - v6 (and later) + + Source XSLT File Information + ============================ + XSL Generator: Specificationv1p0_GenerationToolv1.xsl + XSLT Processor: Saxon-HE-9.4.0.4 + Release: 1.0 + Date: 31st March, 2013 + Autogen Engineer: Colin Smythe (IMS Global, UK) + Autogen Date: 2013-04-30 + + IMS Global Auto-generation Binding Tool-kit (I-BAT) + =================================================== + This file was auto-generated using the IMS Global Binding Auto-generation Tool-kit (I-BAT). While every + attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware + that this is an experimental tool. Permission is given to make use of this tool. IMS Global makes no + claim on the materials created by third party users of this tool. Details on how to use this tool + are contained in the IMS Global "I-BAT" documentation available at the IMS Global web-site: + http://www.imsglobal.org. + + Tool Copyright: 2012-2013 (c) IMS Global Learning Consortium Inc. All Rights Reserved. + + + + + + Definition of Schematron Validation Rules + ========================================= + Author: Colin Smythe (IMS Global) + Date: 31st October, 2012 + Version: 1.0 + Status: Final Release + + Description: This is the set of Schematron Rules to further enforce the QTIv2.1 Information Model. The rule sets that have been defined are: + + [RULE SET GENERAL 1] Ensure that certain expressions are NOT used for Response Processing. + [RULE SET GENERAL 2] Ensure that the Item, Section, Test and TestPart identifiers are unique. + [RULE SET GENERAL 3] Ensure that AssessmentItem Response Declarations are correct. + [RULE SET INTERACTION 1] Enforce the correct use the TextEntryInteraction attributes. + + RULE SET GENERAL 1: Ensure that certain expressions are NOT used for Response Processing. The set of rules are:- + * RULE GENERAL 1a-Assertion 1 :- The expression numberCorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 2 :- The expression numberIncorrect must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 3 :- The expression numberPresented must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 4 :- The expression numberResponded must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 5 :- The expression numberSelected must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 6 :- The expression outcomeMinimum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 7 :- The expression outcomeMaximum must NOT be used in Response Processing. + * RULE GENERAL 1a-Assertion 8 :- The expression testVariables must NOT be used in Response Processing. + + RULE SET GENERAL 2: Ensure that the Item, Section, Test and TestPart identifiers are unique. The set of rules are:- + * RULE GENERAL 2a-Assertion 1 :- The AssessmentTest and a TestPart must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 2 :- The AssessmentTest and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 3 :- The AssessmentTest and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 4 :- The AssessmentTest and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2a-Assertion 5 :- The AssessmentTest and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 1 :- Two TestParts must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 2 :- The TestPart and an AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 3 :- The TestPart and a direct child AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 4 :- The TestPart and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2b-Assertion 5 :- The TestPart and a descendant AssessmentItemRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 1 :- Two AssessmentSection children of a TestPart must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 2 :- The AssessmentSection and a descendant AssessmentSection must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 3 :- The AssessmentSection and a descendant AssessmentSectionRef must not have the same unique identifier. + * RULE GENERAL 2c-Assertion 4 :- The AssessmentSection and a descendant AssessmentItemRef must not have the same unique identifier. + + RULE SET GENERAL 3: Ensure that AssessmentItem Response Declarations are correct. The set of rules are:- + * RULE GENERAL 3a-Assertion 1 :- ***To be completed***.. + + RULE SET INTERACTION 1: Enforce the correct use the TextEntryInteraction attributes. The set of rules are:- + * RULE INTERACTION 1a-Assertion 1 :- The StringIdentifier and ResponseIdentifier attribute values must not be the same. + + History: Version 1.0: The first set of schematron rules for the IMS Global QTIv2.1 specification. + + + + + Schematron Validation Rules for QTI Specification v2.1. + + + + Ensure that certain expressions are NOT used for Response Processing. + + + + + + + + + Ensure that the Item, Section, Test and TestPart identifiers are unique. + + + + [RULE GENERAL 2a: Assertion 1] The AssessmentTest and a TestPart must not have the same unique identifier. + + + [RULE GENERAL 2a: Assertion 2] The AssessmentTest and an AssessmentSection must not have the same unique identifier. + + + [RULE GENERAL 2a: Assertion 3] The AssessmentTest and a direct child AssessmentSectionRef must not have the same unique identifier. + + + [RULE GENERAL 2a: Assertion 4] The AssessmentTest and a descendant AssessmentSectionRef must not have the same unique identifier. + + + [RULE GENERAL 2a: Assertion 5] The AssessmentTest and a descendant AssessmentItemRef must not have the same unique identifier. + + + + + + [RULE GENERAL 2b: Assertion 1] Two TestParts must not have the same unique identifier. + + + [RULE GENERAL 2b: Assertion 2] The TestPart and an AssessmentSection must not have the same unique identifier. + + + [RULE GENERAL 2b: Assertion 3] The TestPart and a direct child AssessmentSectionRef must not have the same unique identifier. + + + [RULE GENERAL 2b: Assertion 4] The TestPart and a descendant AssessmentSectionRef must not have the same unique identifier. + + + [RULE GENERAL 2b: Assertion 5] The TestPart and a descendant AssessmentItemRef must not have the same unique identifier. + + + + + + + + + + + Ensure that AssessmentItem Response Declarations are correct. + + + + + + + + + Enforce the correct use the TextEntryInteraction attributes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Any namespaced element from any namespace may be included within an "any" element. + The namespace for the imported element must be defined in the instance, and the schema must be imported. + The extension has a definition of "lax" i.e. they can reuse elements from the target namespace. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'A' complexType is the container for content that is equivalent to the HTML 'a' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The anyN operator takes one or more sub-expressions each with a base-type of boolean and single cardinality. The result is a single boolean which is true if at least min of the sub-expressions are true and at most max of the sub-expressions are true. If more than n - min sub-expressions are false (where n is the total number of sub-expressions) or more than max sub-expressions are true then the result is false. If one or more sub-expressions are NULL then it is possible that neither of these conditions is satisfied, in which case the operator results in NULL. For example, if min is 3 and max is 4 and the sub-expressions have values {true,true,false,NULL} then the operator results in NULL whereas {true,false,false,NULL} results in false and {true,true,true,NULL} results in true. The result NULL indicates that the correct value for the operator cannot be determined. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the container for the information about a Test. An 'assessmentTest' is the binding form of a Test. Each Test is composed of one or more TestParts (with each part consisting of at least one Section). Outcomes processing and feedback at the test level may be available. + + + + + + + + + + + + + + + + + + + + The 'BlockQuote' complexType is the container for content that is equivalent to the HTML 'blockquote' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Caption' complexType is the container for content that is equivalent to the HTML 'caption' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'ColGroup' complexType is the container for set of columns defined within a table. The content is the set of 'col' HTML markup. + + + + + + + + + + + + + + + + The custom operator provides a namespaced extension mechanism for defining operations not currently supported by this specification. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'DD' complexType is the container for term definitions as per the HTML 'dd' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the container for the permitted set of default values. A human readable interpretation of the default value is also supplied using the 'interpretation' attribute. + + + + + + + + + + + + The 'Div' complexType is the container for content that is equivalent to the HTML 'div' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'DL' complexType is the container for list definitions as per the HTML 'dl' markup. This can contain any combination of 'dd' and 'dt' HTML elements. + + + + + + + + + + + + + + + + + + + The 'DT' complexType is the container for term definitions as per the HTML 'dt' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The equal operator takes two sub-expressions which must both have single cardinality and have a numerical base-type. The result is a single boolean with a value of true if the two expressions are numerically equal and false if they are not. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The equalRounded operator takes two sub-expressions which must both have single cardinality and have a numerical base-type. The result is a single boolean with a value of true if the two expressions are numerically equal after rounding and false if they are not. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The field-value operator takes a sub-expression with a record container value. The result is the value of the field with the specified fieldIdentifier. If there is no field with that identifier then the result of the operator is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The complexType for the set of HTML text elements i.e. h1, h2, h3, h4, h5, h6, p, pre and address. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The index operator takes a sub-expression with an ordered container value and any base-type. The result is the nth value of the container. The result has the same base-type as the sub-expression but single cardinality. The first value of a container has index 1, the second 2 and so on. n must be a positive integer. If n exceeds the number of values in the container (or the sub-expression is NULL) then the result of the index operator is NULL. If n is an identifier, it is the value of n at runtime that is used. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'InfoControl' complexType is the container to provide the candidate with extra information about the item when s/he chooses to trigger the control. The extra information can be a hint, but could also be additional tools such as a ruler or a (javaScript) calculator. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The inside operator takes a single sub-expression which must have a baseType of point. The result is a single boolean with a value of true if the given point is inside the area defined by shape and coords. If the sub-expression is a container the result is true if any of the points are inside the area. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The InterpolationTable complexType is the container for interpolation information. An interpolationTable transforms a source float (or integer) by finding the first interpolationTableEntry with a sourceValue that is less than or equal to (subject to includeBoundary) the source value. For example, an interpolation table can be used to map a raw numeric score onto an identifier representing a grade. It may also be used to implement numeric transformations such as those from a simple raw score to a value on a calibrated scale. + + + + + + + + + + + + The 'LI' complexType is the container for the definition of lists as per the HTML 'li' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable operator e.g. an 'and' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable operator e.g. an 'and' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a two variable operator e.g. greater than. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a single variable operator e.g. a 'not'. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A special class used to create a mapping from a source set of any baseType (except file and duration) to a single float. Note that mappings from values of base type float should be avoided due to the difficulty of matching floating point values, see the match operator for more details. When mapping containers the result is the sum of the mapped values from the target set. See mapResponse for details. + + + + + + + + + + + + + + The mathOperator operator takes 1 or more sub-expressions which all have single cardinality and have numerical base-types. The trigonometric functions, sin, cos and tan, take one argument in radians, which evaluates to a single float. Other functions take one numerical argument. Further functions might take more than one numerical argument, e.g. atan2 (two argument arc tan). The result is a single float, except for the functions signum, floor and ceil, which return a single integer. If any of the sub-expressions is NULL, the result is NULL. If any of the sub-expressions falls outside the natural domain of the function called by mathOperator, e.g. log(0) or asin(2), then the result is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Provides the ability to use a multi variable numeric-based operator e.g. a 'sum' of the set of variables. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'OUL' complexType is the container for ordered and unordered lists as per the HTML 'ul' and 'ol' markup. + + + + + + + + + + + + + + + + The OutcomeCondition complexType is the container for the sequence of outcome conditions to be applied. The condition is structured as an 'If..ElseIf..ElseIf..Else' sequence. Each clause as its own outcome rule construct. + + + + + + + + + + + + + The OutcomeDeclaration complexType is the container for the declaration of outcome variables. Outcome variables are declared by outcome declarations. Their value is set either from a default given in the declaration itself or by a 'responseRule' during 'responseProcessing'. + + + + + + + + + + + + + + + + + + + + + + + The OutcomeElse complexType is the container for 'Else' processing. An outcomeElse part consists of an expression which must have an effective baseType of boolean and single cardinality. For more information about the runtime data model employed see Expressions. It also contains a set of sub-rules. If the expression is true then the sub-rules are processed. + + + + + + + + + + + + + + + + The OutcomeIf complexType is the container for 'If' processing. An outcomeIf part consists of an expression which must have an effective baseType of boolean and single cardinality. For more information about the runtime data model employed see Expressions. It also contains a set of sub-rules. If the expression is true then the sub-rules are processed, otherwise they are skipped (including if the expression is NULL) and the following outcomeElseIf or outcomeElse parts (if any) are considered instead. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The OutcomeProcessing complexType is the container for the outcome processing instructions. Outcome processing takes place each time the candidate submits the responses for an item (when in individual submission mode) or a group of items (when in simultaneous submission mode). It happens after any (item level) response processing triggered by the submission. The values of the test's outcome variables are always reset to their defaults prior to carrying out the instructions described by the outcomeRules. Because outcome processing happend each time the candidate submits responses the resulting values of the test-level outcomes may be used to activate test-level feedback during the test or to control the behaviour of subsequent parts through the use of preConditions and branchRules. + + + + + + + + + + + + + + + + The patternMatch operator takes a sub-expression which must have single cardinality and a base-type of string. The result is a single boolean with a value of true if the sub-expression matches the regular expression given by pattern and false if it doesn't. If the sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Q' complexType is the container for content that is equivalent to the HTML 'q' markup. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The repeat operator allows the filling of an ordered container. The result of a repeat operator is an ordered set of values calculated from the expressions. Values will be set in the associated container by a setTemplateValue expression. Each expression is calculated as many times as it is queried by numberRepeats. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The roundTo operator takes one sub-expression which must have single cardinality and a numerical base-type. The result is a single float with the value nearest to that of the expression's value such that when converted to a decimal string it represents the expression rounded by the specified rounding method to the specified precision. If the sub-expression is NULL, then the result is NULL. If the sub-expression is INF, then the result is INF. If the sub-expression is -INF, then the result is -INF. If the argument is NaN, then the result is NULL. When rounding to n significant figures, the deciding digit is the (n+1)th digit counting from the first non-zero digit from the left in the number. If the deciding digit is 5 or greater, the nth digit is increased by 1 and all digits to its right are discarded; if the deciding digit is less than 5, all digits to the right of the nth digit are discarded. When rounding to n decimal places, the deciding digit is the (n+1)th digit counting to the right from the decimal point. If the deciding digit is 5 or greater, the nth digit is increased by 1 and all digits to its right are discarded; if the deciding digit is less than 5, all digits to the right of the nth digit are discarded. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The SetValue complexType is the container for the value set for the associated element (the element is identified using the 'identifier' attribute). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The statsOperator operator takes 1 sub-expression which is a container of multiple or ordered cardinality and has a numerical base-type. The result is a single float. If the sub-expression or any value contained therein is NULL, the result is NULL. If any value contained in the sub-expression is not a numerical value, then the result is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The stringMatch operator takes two sub-expressions which must have single and a base-type of string. The result is a single boolean with a value of true if the two strings match according to the comparison rules defined by the attributes below and false if they don't. If either sub-expression is NULL then the operator results in NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The substring operator takes two sub-expressions which must both have an effective base-type of string and single cardinality. The result is a single boolean with a value of true if the first expression is a substring of the second expression and false if it isn't. If either sub-expression is NULL then the result of the operator is NULL. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'Table' complexType is the container for content that is equivalent to the HTML 'table' markup. + + + + + + + + + + + + + + + + + + + + + + The TablePart complexType is the container for set of table row content that is used to the support content within a table. + + + + + + + + + + + + + + + The 'TDH' complexType is the container for content that is equivalent to the HTML 'td' and 'th' markup within a table. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The TestFeedback complexType is the container for the test feedback to be presented to the candidate. Test feedback is shown to the candidate either directly following outcome processing (during the test) or at the end of the testPart or assessmentTest as appropriate (referred to as atEnd). The value of an outcome variable is used in conjunction with the showHide and identifier attributes to determine whether or not the feedback is actually shown. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A Test is composed of one or more Test Parts. Each Test Part is used to control the presentation of a part of the Test - this allows a Test to be undertaken in several related but separated stages. A TestPart conatins one or more assessmentSections (either included or through external reference). + [APIP-Test (Core)] Profile - the changes to the XML element list are: + * The "preCondition" element has been prohibited; + + + + + + + + + + + + + + + + + + + The 'TR' complexType is the container for content that is equivalent to the HTML 'tr' markup. + + + + + + + + + + + + + + + + + + + + + + This is the container for referential link to an externally stored AssessmentSection (each such Section is stored in its own XML instance file). The identifier attribute should be used to identify the actual Section. + + + + + + + + + + + + + + The simplest expression returns a single value from the set defined by the given baseType. + + + + + + + + + + + + + The 'BR' complexType is the container for content that is equivalent to the HTML 'br' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + The 'Col' complexType is the container for content that is equivalent to the HTML 'col' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + This expression looks up the declaration of a response variable and returns the associated correctResponse or NULL if no correct value was declared. When used in outcomes processing item identifier prefixing (see variable) may be used to obtain the correct response from an individual item. This is intentionally empty. + + + + + + + + + + + + + This expression looks up the declaration of an itemVariable and returns the associated defaultValue or NULL if no default value was declared. When used in outcomes processing item identifier prefixing (see variable) may be used to obtain the default value from an individual item. This is intentionally empty. + + + + + + + + + + + + + The 'HR' complexType is the container for content that is equivalent to the HTML 'hr' markup.This complexType is intentionally empty. + + + + + + + + + + + + + + + + + The 'Img' complexType is the container for content that is equivalent to the HTML 'img' markup.This ComplexType is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + The InterpolationTableEntry complexType is the container for an entry in the corresponding interpolationTable. This complexType is intentionally empty. + + + + + + + + + + + + + + + When items are referenced as part of a test, the test may impose constraints on how many attempts, and which states are allowed. These constraints can be specified for individual items, for whole sections or for an entire testPart. By default, a setting at testPart level affects all items in that part unless the setting is overridden at the assessmentSection level or ultimately at the individual assessmentItemRef. The defaults given below are used only in the absence of any applicable constraint. This complexType is intentionally empty. + + + + + + + + + + + + + + + + + + + The map is defined by a set of mapEntries, each of which maps a single value from the source set onto a single float. + + + + + + + + + + + + + + + This expression looks up the value of a response variable and then transforms it using the associated mapping, which must have been declared. The result is a single float. If the response variable has single cardinality then the value returned is simply the mapped target value from the map. If the response variable has multiple or ordered cardinality then the value returned is the sum of the mapped target values. This expression cannot be applied to variables of record cardinality. This is intentionally empty. + + + + + + + + + + + + + The result is a mathematical constant returned as a single float, e.g. pi and e. + + + + + + + + + + + + + Provides an operator that returns the number of values that confrm to the associated constraints e.g. 'numberCorrect'. + + + + + + + + + + + + + + + This expression, which can only be used in outcomes processing, simultaneously looks up the normal Maximum/Minimum value of an outcome variable in a sub-set of the items referred to in a test. Only variables with single cardinality are considered. If any of the items within the given subset have no declared maximum the result is NULL, otherwise the result has cardinality multiple and base-type float. This is intentionally empty. + + + + + + + + + + + + + + + + + Selects a random float from the specified range [min,max]. This is intentionally empty. + + + + + + + + + + + + + + Selects a random integer from the specified range [min,max] satisfying min + step * n for some integer n. For example, with min=2, max=11 and step=3 the values {2,5,8,11} are possible. + + + + + + + + + + + + + + + This is used to associate an external stylesheet (it is assumed that this takes the form of a CSS file but other formats are permitted). + + + + + + + + + + + + + + + + This expression, which can only be used in outcomes processing, simultaneously looks up the value of an itemVariable in a sub-set of the items referred to in a test. Only variables with single cardinality are considered, all NULL values are ignored. The result has cardinality multiple and base-type as specified below. This is intentionally empty. + + + + + + + + + + + + + + + + + + In the context of a specific assessmentTest an item, or group of items, may be subject to a time constraint. The QTI specification supports both minimum and maximum time constraints. The controlled time for a single item is simply the duration of the item session as defined by the builtin response variable duration. For assessmentSections, testParts and whole assessmentTests the time limits relate to the durations of all the item sessions plus any other time spent navigating that part of the test. In other words, the time includes time spent in states where no item is being interacted with, such as dedicated navigation screens. This complexType is intentionally empty. + + + + + + + + + + + + + + + A class that can represent a single value of any baseType in variable declarations and result reports. The base-type is defined by the baseType attribute of the declaration except in the case of variables with record cardinality. + + + + + + + + + + + + + + This expression looks up the value of an itemVariable that has been declared in a corresponding variableDeclaration or is one of the built-in variables. The result has the base-type and cardinality declared for the variable subject to the type promotion of weighted outcomes. This is intentionally empty. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java index 7439a9c6a..154085d93 100644 --- a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java +++ b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/reading/QtiObjectReaderTest.java @@ -89,8 +89,7 @@ import java.math.BigDecimal; import java.util.List; -import javax.xml.bind.DatatypeConverter; - +import org.joda.time.LocalTime; import org.junit.Test; /** @@ -100,7 +99,7 @@ public class QtiObjectReaderTest { @Test public void testLookupRootNodeSimpleItem() throws Exception { - final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/choice.xml"); + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/choice.xml"); assertNotNull(lookupRootNode); final AssessmentItem item = lookupRootNode.getRootNode(); assertNotNull(item); @@ -113,7 +112,7 @@ public void testLookupRootNodeSimpleItem() throws Exception { @Test public void testLookupRootNodeWithAccessibilityInclusionOrder() throws Exception { - final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); final AssessmentItem item = lookupRootNode.getRootNode(); final ApipAccessibility apipAccessibility = item.getApipAccessibility(); @@ -137,9 +136,39 @@ public void testLookupRootNodeWithAccessibilityInclusionOrder() throws Exception assertNull(inclusionOrder.getTextOnlyOnDemandOrder()); } + @Test + public void testLookupRootNodeWithAccessibilityInclusionOrderApipCore() throws Exception { + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/minimal-core-apip.xml"); + final AssessmentItem item = lookupRootNode.getRootNode(); + final ApipAccessibility apipAccessibility = item.getApipAccessibility(); + + final InclusionOrder inclusionOrder = apipAccessibility.getInclusionOrder(); + assertNotNull(inclusionOrder); + assertNull(inclusionOrder.getAslDefaultOrder()); + assertNull(inclusionOrder.getAslOnDemandOrder()); + assertNull(inclusionOrder.getGraphicsOnlyOnDemandOrder()); + assertNull(inclusionOrder.getSignedEnglishDefaultOrder()); + assertNull(inclusionOrder.getSignedEnglishOnDemandOrder()); + + final BrailleDefaultOrder brailleDefaultOrder = inclusionOrder.getBrailleDefaultOrder(); + assertNotNull(brailleDefaultOrder); + assertEquals(2, brailleDefaultOrder.getElementOrders().size()); + assertEquals(1, brailleDefaultOrder.getElementOrders().get(0).getOrder().intValue()); + assertEquals("ae01", brailleDefaultOrder.getElementOrders().get(0).getIdentifierRef().toString()); + assertEquals(2, brailleDefaultOrder.getElementOrders().get(1).getOrder().intValue()); + assertEquals("ae02", brailleDefaultOrder.getElementOrders().get(1).getIdentifierRef().toString()); + assertNull(inclusionOrder.getTextOnlyOnDemandOrder()); + + assertNotNull(inclusionOrder.getNonVisualDefaultOrder()); + assertNotNull(inclusionOrder.getTextGraphicsDefaultOrder()); + assertNotNull(inclusionOrder.getTextGraphicsOnDemandOrder()); + assertNotNull(inclusionOrder.getTextOnlyDefaultOrder()); + assertNull(inclusionOrder.getTextOnlyOnDemandOrder()); + } + @Test public void testLookupRootNodeWithAccessibilityCompanionMaterials() throws Exception { - final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); final AssessmentItem item = lookupRootNode.getRootNode(); final ApipAccessibility apipAccessibility = item.getApipAccessibility(); final CompanionMaterialsInfo cmi = apipAccessibility.getCompanionMaterialsInfo(); @@ -208,12 +237,29 @@ public void testLookupRootNodeWithAccessibilityCompanionMaterials() throws Excep assertEquals(LinearUnitUS.MILE, ruleSystemUS.getMajorIncrementLinearUS().getUnit()); assertEquals(new BigDecimal("1.0"), ruleSystemUS.getMajorIncrementLinearUS().getDecimal()); assertNull(ruleUS.getRuleSystemSI()); + } + + @Test + public void testLookupRootNodeWithAccessibilityCompanionMaterialsApipCore() throws Exception { + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/minimal-core-apip.xml"); + final AssessmentItem item = lookupRootNode.getRootNode(); + final ApipAccessibility apipAccessibility = item.getApipAccessibility(); + final CompanionMaterialsInfo cmi = apipAccessibility.getCompanionMaterialsInfo(); + assertNotNull(cmi); + assertEquals(0, cmi.findCalculators().size()); + assertEquals(1, cmi.findDigitalMaterials().size()); + assertEquals("refSheetA.txt", cmi.findDigitalMaterials().get(0).getFileHref()); + assertEquals("text/plain", cmi.findDigitalMaterials().get(0).getMimeType()); + assertEquals(0, cmi.findPhysicalMaterials().size()); + assertEquals(0, cmi.findProtractors().size()); + assertEquals(0, cmi.findReadingPassages().size()); + assertEquals(0, cmi.findRules().size()); } @Test public void testLookupRootNodeWithAccessibilityAccessElementsContentLinks() throws Exception { - final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); final List accessElements = lookupRootNode.getRootNode().getApipAccessibility().getAccessElements(); assertEquals(18, accessElements.size()); @@ -280,7 +326,7 @@ public void testLookupRootNodeWithAccessibilityAccessElementsContentLinks() thro @Test public void testLookupRootNodeWithAccessibilityCoreRelatedInfo() throws Exception { - final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); final List accessElements = lookupRootNode.getRootNode().getApipAccessibility().getAccessElements(); final AccessElement ae01 = accessElements.get(0); @@ -296,8 +342,8 @@ public void testLookupRootNodeWithAccessibilityCoreRelatedInfo() throws Exceptio assertEquals("afi01.mp3", afi01.getFileHref()); assertEquals(VoiceType.HUMAN, afi01.getVoiceType()); assertEquals(VoiceSpeed.FAST, afi01.getVoiceSpeed()); - assertEquals(DatatypeConverter.parseTime("00:00:10.5"), afi01.getStartTime()); - assertEquals(DatatypeConverter.parseTime("00:01:00"), afi01.getDuration()); + assertEquals(new LocalTime("00:00:10.5"), afi01.getStartTime()); + assertEquals(new LocalTime("00:01:00"), afi01.getDuration()); final AudioFileInfo afi02 = audioFileInfosA.get(1); assertEquals("audio/ogg", afi02.getMimeType()); @@ -334,7 +380,7 @@ public void testLookupRootNodeWithAccessibilityCoreRelatedInfo() throws Exceptio @Test public void testLookupRootNodeWithAccessibilityBeyondCore() throws Exception { - final QtiObjectReadResult lookupRootNode = readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest("reading/accessible-core-qti.xml"); final List accessElements = lookupRootNode.getRootNode().getApipAccessibility().getAccessElements(); final AccessElement ae01 = accessElements.get(0); assertFalse(ae01.getRelatedElementInfo().getChunk()); @@ -350,8 +396,8 @@ public void testLookupRootNodeWithAccessibilityBeyondCore() throws Exception { assertEquals("sfaslvfi01", aslVideo.getContentLinkIdentifier().toString()); assertEquals("video/mpeg", aslVideo.getMimeType()); assertEquals("doNotLeaveLuggage.mpeg", aslVideo.getFileHref()); - assertEquals(DatatypeConverter.parseTime("00:00:01"), aslVideo.getStartCue()); - assertEquals(DatatypeConverter.parseTime("00:00:20"), aslVideo.getEndCue()); + assertEquals(new LocalTime("00:00:01"), aslVideo.getStartCue()); + assertEquals(new LocalTime("00:00:20"), aslVideo.getEndCue()); final ObjectFileInfo bavf = asl.getBoneAnimationVideoFile(); assertEquals("sfaslbavf", bavf.getContentLinkIdentifier().toString()); @@ -454,16 +500,4 @@ public void testLookupRootNodeWithAccessibilityBeyondCore() throws Exception { assertEquals("simpleChoiceA", removeTagGroupA.getRemoveTagIdRefs().get(0).getTextContent()); } - private static QtiObjectReadResult readAssessmentItemQtiObjectTest(final String testFilePath) - throws Exception { - return createQtiObjectReader().lookupRootNode(UnitTestHelper.createTestResourceUri(testFilePath), - AssessmentItem.class); - - } - - private static QtiObjectReader createQtiObjectReader() { - return new QtiObjectReader(UnitTestHelper.createUnitTestQtiXmlReader(), - UnitTestHelper.createTestFileResourceLocator(), true); - } - } diff --git a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSerializerTest.java b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSerializerTest.java index cac17a436..08ee20987 100644 --- a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSerializerTest.java +++ b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSerializerTest.java @@ -35,6 +35,7 @@ import uk.ac.ed.ph.jqtiplus.JqtiExtensionManager; import uk.ac.ed.ph.jqtiplus.QtiConstants; +import uk.ac.ed.ph.jqtiplus.QtiProfile; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.block.ForeignElement; import uk.ac.ed.ph.jqtiplus.node.content.ItemBody; @@ -42,6 +43,8 @@ import uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P; import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; import uk.ac.ed.ph.jqtiplus.node.result.AssessmentResult; +import uk.ac.ed.ph.jqtiplus.reading.QtiObjectReadResult; +import uk.ac.ed.ph.jqtiplus.testutils.UnitTestHelper; import uk.ac.ed.ph.jqtiplus.xmlutils.xslt.XsltSerializationOptions; import java.io.IOException; @@ -57,6 +60,7 @@ * Tests the serialization package. * * @author David McKain + * @author Zack Pierce */ public class QtiSerializerTest { @@ -71,12 +75,22 @@ public void testEmptyItemSerialization() throws SAXException, IOException { serializeAndCompare(item, expectedXml, new SaxFiringOptions()); } + @Test + public void testEmptyItemSerializationApipCore() throws SAXException, IOException { + final AssessmentItem item = new AssessmentItem(); + final String expectedXml = ""; + + serializeAndCompare(item, expectedXml, new SaxFiringOptions(QtiProfile.APIP_CORE)); + } + @Test public void testEmptyItemSerializationWithoutSchemaLocation() throws SAXException, IOException { final AssessmentItem item = new AssessmentItem(); - final SaxFiringOptions saxFiringOptions = new SaxFiringOptions(); - saxFiringOptions.setOmitSchemaLocation(true); + final SaxFiringOptions saxFiringOptions = new SaxFiringOptions(true); final String expectedXml = ""; @@ -84,6 +98,20 @@ public void testEmptyItemSerializationWithoutSchemaLocation() throws SAXExceptio serializeAndCompare(item, expectedXml, saxFiringOptions); } + @Test + public void testEmptyItemSerializationWithoutSchemaLocationApipCore() throws SAXException, IOException { + final AssessmentItem item = new AssessmentItem(); + + final SaxFiringOptions saxFiringOptions = new SaxFiringOptions(true, QtiProfile.APIP_CORE); + + final String expectedXml = ""; + + serializeAndCompare(item, expectedXml, saxFiringOptions); + } + + + @Test public void testEmptyItemSerializationWithPrefix() throws SAXException, IOException { final AssessmentItem item = new AssessmentItem(); @@ -96,6 +124,20 @@ public void testEmptyItemSerializationWithPrefix() throws SAXException, IOExcept + " xsi:schemaLocation='http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/imsqti_v2p1.xsd'" + " identifier='' title='' adaptive='' timeDependent=''/>"; + serializeAndCompare(item, expectedXml, saxFiringOptions); + } + + @Test + public void testEmptyItemSerializationWithPrefixApipCore() throws SAXException, IOException { + final AssessmentItem item = new AssessmentItem(); + + final SaxFiringOptions saxFiringOptions = new SaxFiringOptions(QtiProfile.APIP_CORE); + saxFiringOptions.getPreferredPrefixMappings().registerStrict(QtiConstants.APIP_CORE_ITEM_URI, "q"); + + final String expectedXml = ""; serializeAndCompare(item, expectedXml, saxFiringOptions); } @@ -114,11 +156,8 @@ public void testItemWithBase() throws SAXException, IOException { final String expectedXml = "" - + "" - + "

" - + "" - + ""; + + " identifier='' title='' adaptive='' timeDependent=''>" + "" + "

" + + "" + ""; serializeAndCompare(item, expectedXml, saxFiringOptions); } @@ -137,10 +176,8 @@ public void testItemWithMathSerialization() throws SAXException, IOException { final String expectedXml = "" - + "" - + "" - + "" + + " identifier='' title='' adaptive='' timeDependent=''>" + "" + + "" + "" + ""; serializeAndCompare(item, expectedXml, saxFiringOptions); @@ -162,11 +199,8 @@ public void testItemWithMathSerializationPrefix() throws SAXException, IOExcepti + " xmlns='http://www.imsglobal.org/xsd/imsqti_v2p1'" + " xmlns:m='http://www.w3.org/1998/Math/MathML'" + " xsi:schemaLocation='http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/imsqti_v2p1.xsd'" - + " identifier='' title='' adaptive='' timeDependent=''>" - + "" - + "" - + "" - + ""; + + " identifier='' title='' adaptive='' timeDependent=''>" + "" + "" + + "" + ""; serializeAndCompare(item, expectedXml, saxFiringOptions); } @@ -181,18 +215,22 @@ public void testItemWithMathSerializationPrefixClash() throws SAXException, IOEx math.getContent().add(new ForeignElement(math, "mrow", QtiConstants.MATHML_NAMESPACE_URI)); final SaxFiringOptions saxFiringOptions = new SaxFiringOptions(); - saxFiringOptions.getPreferredPrefixMappings().registerLax(QtiConstants.QTI_21_NAMESPACE_URI, "m"); /* This prefix will win */ - saxFiringOptions.getPreferredPrefixMappings().registerLax(QtiConstants.MATHML_NAMESPACE_URI, "m"); /* Will become m0: */ + saxFiringOptions.getPreferredPrefixMappings().registerLax(QtiConstants.QTI_21_NAMESPACE_URI, "m"); /* + * This + * prefix + * will win + */ + saxFiringOptions.getPreferredPrefixMappings().registerLax(QtiConstants.MATHML_NAMESPACE_URI, "m"); /* + * Will + * become m0: + */ final String expectedXml = "" - + "" - + "" - + "" - + ""; + + " identifier='' title='' adaptive='' timeDependent=''>" + "" + + "" + "" + ""; serializeAndCompare(item, expectedXml, saxFiringOptions); } @@ -211,13 +249,9 @@ public void testItemWithMathAndForeign() throws SAXException, IOException { final String expectedXml = "" - + "" - + "" - + "" - + "" - + "" - + ""; + + " identifier='' title='' adaptive='' timeDependent=''>" + "" + + "" + "" + "" + + "" + ""; serializeAndCompare(item, expectedXml, saxFiringOptions); } @@ -233,7 +267,23 @@ public void testEmptyResultSerialization() throws SAXException, IOException { serializeAndCompare(result, expectedXml, new SaxFiringOptions()); } - //--------------------------------------------------------------------------- + // TODO - test AssessmentTest serialization for QTI and APIP profiles + // TODO - test AssessmentSection serialization for QTI and APIP profiles + // TODO - test read-as-QTI, write-as-APIP + // TODO - test read-as-APIP, write-as-QTI + + @Test + public void testRoundTripReadAndSerialization() throws SAXException, IOException, Exception { + final String resourcePath = "serialization/roundtrippable-core-apip.xml"; + final QtiObjectReadResult lookupRootNode = UnitTestHelper.readAssessmentItemQtiObjectTest(resourcePath); + final AssessmentItem item = lookupRootNode.getRootNode(); + final NamespacePrefixMappings prefixes = new NamespacePrefixMappings(); + prefixes.registerStrict(QtiProfile.APIP_CORE.getAccessibilityNamespace(), "apip"); + final SaxFiringOptions options = new SaxFiringOptions(false, QtiProfile.APIP_CORE, prefixes); + serializeAndCompare(item, UnitTestHelper.getResourceAsString(resourcePath), options); + } + + // --------------------------------------------------------------------------- private void serializeAndCompare(final QtiNode node, final String expectedXml, final SaxFiringOptions saxFiringOptions) throws SAXException, IOException { diff --git a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/testutils/UnitTestHelper.java b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/testutils/UnitTestHelper.java index aea3a76ba..bc4bc8bc6 100644 --- a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/testutils/UnitTestHelper.java +++ b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/testutils/UnitTestHelper.java @@ -35,7 +35,9 @@ import uk.ac.ed.ph.jqtiplus.JqtiExtensionManager; import uk.ac.ed.ph.jqtiplus.internal.util.ObjectDumper; +import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; import uk.ac.ed.ph.jqtiplus.reading.AssessmentObjectXmlLoader; +import uk.ac.ed.ph.jqtiplus.reading.QtiObjectReadResult; import uk.ac.ed.ph.jqtiplus.reading.QtiObjectReader; import uk.ac.ed.ph.jqtiplus.reading.QtiXmlReader; import uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem; @@ -60,6 +62,8 @@ import uk.ac.ed.ph.jqtiplus.xmlutils.locators.ClassPathResourceLocator; import uk.ac.ed.ph.jqtiplus.xmlutils.locators.ResourceLocator; +import java.io.BufferedReader; +import java.io.InputStreamReader; import java.net.URI; import java.util.List; @@ -125,7 +129,8 @@ public static ItemSessionController loadUnitTestAssessmentItemForControl(final S assertSuccessfulResolution(resolvedAssessmentItem); final ItemSessionControllerSettings itemSessionControllerSettings = new ItemSessionControllerSettings(); - final ItemProcessingMap itemProcessingMap = new ItemProcessingInitializer(resolvedAssessmentItem, isValid).initialize(); + final ItemProcessingMap itemProcessingMap = new ItemProcessingInitializer(resolvedAssessmentItem, isValid) + .initialize(); final ItemSessionState itemSessionState = new ItemSessionState(); return new ItemSessionController(createJqtiExtensionManager(), itemSessionControllerSettings, itemProcessingMap, itemSessionState); @@ -136,7 +141,8 @@ public static TestSessionController loadUnitTestAssessmentTestForControl(final S assertSuccessfulResolution(resolvedAssessmentTest); final TestSessionControllerSettings testSessionControllerSettings = new TestSessionControllerSettings(); - final TestProcessingMap testProcessingMap = new TestProcessingInitializer(resolvedAssessmentTest, isValid).initialize(); + final TestProcessingMap testProcessingMap = new TestProcessingInitializer(resolvedAssessmentTest, isValid) + .initialize(); final TestPlanner testPlanner = new TestPlanner(testProcessingMap); final TestPlan testPlan = testPlanner.generateTestPlan(); final TestSessionState testSessionState = new TestSessionState(testPlan); @@ -146,8 +152,10 @@ public static TestSessionController loadUnitTestAssessmentTestForControl(final S private static void assertSuccessfulResolution(final ResolvedAssessmentObject resolvedAssessmentObject) { if (!resolvedAssessmentObject.getRootNodeLookup().wasSuccessful()) { - logger.error(ObjectDumper.dumpObject(resolvedAssessmentObject.getRootNodeLookup().getBadResourceException())); - Assert.fail("Failed to load and resolve unit test resource " + resolvedAssessmentObject.getRootNodeLookup().getSystemId()); + logger.error(ObjectDumper + .dumpObject(resolvedAssessmentObject.getRootNodeLookup().getBadResourceException())); + Assert.fail("Failed to load and resolve unit test resource " + + resolvedAssessmentObject.getRootNodeLookup().getSystemId()); } } @@ -157,4 +165,24 @@ public static TestPlanNode assertSingleTestPlanNode(final TestPlan testPlan, fin Assert.assertEquals("Expected 1 match for identifier " + identifier, 1, nodes.size()); return nodes.get(0); } + + public static QtiObjectReadResult readAssessmentItemQtiObjectTest(final String testFilePath) + throws Exception { + return createQtiObjectReader().lookupRootNode(createTestResourceUri(testFilePath), AssessmentItem.class); + + } + + public static QtiObjectReader createQtiObjectReader() { + return createUnitTestQtiXmlReader().createQtiObjectReader(createTestFileResourceLocator(), true); + } + + public static String getResourceAsString(final String resourcePath) throws Exception { + // TODO : use more idiomatic approach to loading + final StringBuffer sb = new StringBuffer(); + final BufferedReader br = new BufferedReader(new InputStreamReader(new ClassPathResourceLocator().getClass() + .getClassLoader().getResourceAsStream(resourcePath), "UTF-8")); + for (int c = br.read(); c != -1; c = br.read()) + sb.append((char) c); + return sb.toString(); + } } diff --git a/qtiworks-jqtiplus/src/test/resources/reading/minimal-core-apip.xml b/qtiworks-jqtiplus/src/test/resources/reading/minimal-core-apip.xml new file mode 100644 index 000000000..46e9c2434 --- /dev/null +++ b/qtiworks-jqtiplus/src/test/resources/reading/minimal-core-apip.xml @@ -0,0 +1,147 @@ + + + + +

Look at the text in the picture

+
+ Bags are not to be unattended +
+ +
+ + + + refSheetA.txt + + + + + + 1 + + + 2 + + + + + 1 + + + 2 + + + + + 1 + + + + + 1 + + + + + 1 + + + + + + + + + + + + + + + afi01.mp3 + Human + Fast + 00:00:10.500 + 00:01:00.000 + + + afi02.ogg + + Look at the text in the picture. + Luhk at the text in the picture + + + Look at the text in the picture + + + + taf01.mp3 + + Look at the picture and consider how it feels on the physical map. + Look at the picture and consider how it feels on the physical map. + + + + + + + + + + + Never leave your bags alone. + + + nunca deje el equipaje desatendido + + + + + + + + 1 + + + + + + 13 + 15 + + + + + + 2 + + + + + + + + + + + + + + + +
diff --git a/qtiworks-jqtiplus/src/test/resources/serialization/roundtrippable-core-apip.xml b/qtiworks-jqtiplus/src/test/resources/serialization/roundtrippable-core-apip.xml new file mode 100644 index 000000000..cb0be96b7 --- /dev/null +++ b/qtiworks-jqtiplus/src/test/resources/serialization/roundtrippable-core-apip.xml @@ -0,0 +1,152 @@ + + + + +

Look at the text in the picture

+
+ Bags are not to be unattended +
+ +
+ + + + refSheetA.txt + + + + + + 1 + + + 2 + + + + + 1 + + + 2 + + + + + 1 + + + + + 1 + + + + + 1 + + + + + + + + + + + + + + + afi01.mp3 + Human + Fast + 00:00:10.500 + 00:01:00.000 + + + afi02.ogg + + Synthetic + Slow + + Look at the text in the picture. + Luhk at the text in the picture + + + Look at the text in the picture + + + + taf01.mp3 + Human + Standard + + Look at the picture and consider how it feels on the physical map. + Look at the picture and consider how it feels on the physical map. + + + + + + + + + + + Never leave your bags alone. + + + nunca deje el equipaje desatendido + + + + + + + + 1 + + + + + + 13 + 15 + + + + + + 2 + + + + + + + + + + + + + + + +
From e419c05953d08531e79c43463f5738c5edb81e4d Mon Sep 17 00:00:00 2001 From: Zachary Pierce Date: Tue, 17 Sep 2013 11:55:53 -0700 Subject: [PATCH 3/5] Improving validation of content links. Firming up parent/child relationship typing for accessibility elements. --- .../accessibility/AccessElementGroup.java | 6 +- .../companion/MinimumLengthGroup.java | 8 +- .../group/accessibility/link/LinkGroup.java | 28 ++- .../accessibility/link/StringLinkGroup.java | 2 +- .../ed/ph/jqtiplus/node/ContentContainer.java | 60 ++++++ .../node/accessibility/AccessElement.java | 3 +- .../node/accessibility/AccessibilityInfo.java | 7 +- .../node/accessibility/ApipAccessibility.java | 29 ++- .../companion/CalculatorInfo.java | 3 +- .../companion/CalculatorType.java | 3 +- .../companion/DigitalMaterial.java | 3 +- .../companion/MajorIncrementLinearUS.java | 3 +- .../companion/MinimumLength.java | 3 +- .../accessibility/companion/Protractor.java | 3 +- .../companion/RadialIncrementSystemSI.java | 3 +- .../companion/RadialIncrementSystemUS.java | 3 +- .../companion/ReadingPassage.java | 3 +- .../node/accessibility/companion/Rule.java | 3 +- .../accessibility/companion/RuleSystemSI.java | 3 +- .../accessibility/companion/RuleSystemUS.java | 3 +- .../inclusion/AslDefaultOrder.java | 3 +- .../inclusion/AslOnDemandOrder.java | 3 +- .../inclusion/BrailleDefaultOrder.java | 3 +- .../inclusion/ElementOrderList.java | 3 +- .../inclusion/GraphicsOnlyOnDemandOrder.java | 3 +- .../inclusion/InclusionOrder.java | 4 +- .../inclusion/NonVisualDefaultOrder.java | 3 +- .../inclusion/SignedEnglishDefaultOrder.java | 3 +- .../inclusion/SignedEnglishOnDemandOrder.java | 3 +- .../inclusion/TextGraphicsDefaultOrder.java | 3 +- .../inclusion/TextGraphicsOnDemandOrder.java | 3 +- .../inclusion/TextOnlyDefaultOrder.java | 3 +- .../inclusion/TextOnlyOnDemandOrder.java | 3 +- .../accessibility/link/CharacterLink.java | 3 +- .../link/CharacterStringLink.java | 3 +- .../accessibility/link/ContentLinkInfo.java | 65 ++++++- .../node/accessibility/link/FullString.java | 3 +- .../node/accessibility/link/ObjectLink.java | 3 +- .../node/accessibility/link/TextLink.java | 3 +- .../node/accessibility/link/WordLink.java | 3 +- .../related/AnswerReduction.java | 3 +- .../accessibility/related/BrailleText.java | 3 +- .../node/accessibility/related/Guidance.java | 3 +- .../related/KeyWordTranslation.java | 3 +- .../related/RelatedElementInfo.java | 4 +- .../RevealAlternativeRepresentation.java | 3 +- .../node/accessibility/related/Scaffold.java | 3 +- .../node/accessibility/related/Spoken.java | 3 +- .../accessibility/related/StructuredMask.java | 3 +- .../accessibility/related/TactileFile.java | 3 +- .../ed/ph/jqtiplus/node/content/ItemBody.java | 5 +- .../node/content/variable/RubricBlock.java | 3 +- .../ph/jqtiplus/node/item/ModalFeedback.java | 3 +- .../ph/jqtiplus/node/test/TestFeedback.java | 3 +- .../serialization/QtiSaxDocumentFirer.java | 5 +- .../ac/ed/ph/jqtiplus/utils/QueryUtils.java | 99 +++++++++- .../link/ContentLinkInfoTest.java | 173 ++++++++++++++++++ .../validation/DummyValidationContext.java | 108 +++++++++++ 58 files changed, 614 insertions(+), 118 deletions(-) create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java create mode 100644 qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java create mode 100644 qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/validation/DummyValidationContext.java diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java index 00f99478a..7b079fe76 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/AccessElementGroup.java @@ -34,19 +34,19 @@ package uk.ac.ed.ph.jqtiplus.group.accessibility; import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessibilityInfo; import java.util.List; /** * @author Zack Pierce */ -public class AccessElementGroup extends SimpleMultipleNodeGroup { +public class AccessElementGroup extends SimpleMultipleNodeGroup { private static final long serialVersionUID = 8777385626698804683L; - public AccessElementGroup(final QtiNode parent, final int minimum, final Integer maximum) { + public AccessElementGroup(final AccessibilityInfo parent, final int minimum, final Integer maximum) { super(parent, AccessElement.QTI_CLASS_NAME, minimum, maximum); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java index f1672af31..5743c2cb6 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/companion/MinimumLengthGroup.java @@ -34,7 +34,7 @@ package uk.ac.ed.ph.jqtiplus.group.accessibility.companion; import uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.LinearRuleSystem; import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.MinimumLength; import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemSI; import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.RuleSystemUS; @@ -45,17 +45,17 @@ * * @author Zack Pierce */ -public class MinimumLengthGroup extends SimpleSingleNodeGroup { +public class MinimumLengthGroup extends SimpleSingleNodeGroup { private static final long serialVersionUID = 8992512545348461072L; - public MinimumLengthGroup(final QtiNode parent) { + public MinimumLengthGroup(final LinearRuleSystem parent) { super(parent, MinimumLength.QTI_CLASS_NAME, true); } /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.group.SimpleSingleNodeGroup#create() */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java index b08a3f8fd..7c57257b7 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/LinkGroup.java @@ -69,7 +69,7 @@ public LinkGroup(final ContentLinkInfo parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.group.NodeGroup#create(java.lang.String) */ @Override @@ -90,6 +90,19 @@ public ObjectLink getObjectLink() { return QueryUtils.findFirstShallowInstance(ObjectLink.class, children); } + /** + * Sets the Link child to be an ObjectLink, deleting or replacing any existent child. + * + * If the supplied objectLink is null, any existing child will simply be deleted. + * @param objectLink + */ + public void setObjectLink(final ObjectLink objectLink) { + children.clear(); + if (objectLink != null) { + children.add(objectLink); + } + } + /** * @return {@link TextLink} child, or null if it does not exist. */ @@ -97,4 +110,17 @@ public TextLink getTextLink() { return QueryUtils.findFirstShallowInstance(TextLink.class, children); } + /** + * Sets the Link child to be a TextLink, deleting or replacing any existent child. + * + * If the supplied textLink is null, any existing child will simply be deleted. + * @param textLink + */ + public void setTextLink(final TextLink textLink) { + children.clear(); + if (textLink != null) { + children.add(textLink); + } + } + } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java index 4bada2f68..d00a3beb5 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/accessibility/link/StringLinkGroup.java @@ -74,7 +74,7 @@ public StringLinkGroup(final TextLink parent) { /* * (non-Javadoc) - * + * * @see uk.ac.ed.ph.jqtiplus.group.NodeGroup#create(java.lang.String) */ @Override diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java new file mode 100644 index 000000000..5e684ee18 --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java @@ -0,0 +1,60 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node; + +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.content.ItemBody; +import uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock; +import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; +import uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest; +import uk.ac.ed.ph.jqtiplus.node.test.TestFeedback; + +/** + * A marker interface for the top-level elements that can contain presentation content. + * + *

Every top-level content container is associated with one possible {@link ApipAccessibility} node.

+ * + *
    + *
  • In {@link AssessmentItem} , the ContentContainers are {@link ItemBody} and {@link ModalFeedback}
  • + *
  • In {@link AssessmentSection} , the only ContentContainer is {@link RubricBlock}
  • + *
  • In {@link AssessmentTest}, the only ContentContainer is {@link TestFeedback}
  • + *
+ * + * @author Zack Pierce + */ +public interface ContentContainer extends QtiNode { + +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java index c65f82ea4..36f0e3cbb 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessElement.java @@ -38,7 +38,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.link.ContentLinkInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RelatedElementInfoGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.link.ContentLinkInfo; import uk.ac.ed.ph.jqtiplus.node.accessibility.related.RelatedElementInfo; import uk.ac.ed.ph.jqtiplus.types.Identifier; @@ -58,7 +57,7 @@ public class AccessElement extends AbstractNode implements AccessibilityNode { public static final String ATTR_IDENTIFIER_NAME = "identifier"; - public AccessElement(final QtiNode parent) { + public AccessElement(final AccessibilityInfo parent) { super(parent, QTI_CLASS_NAME); getAttributes().add(new IdentifierAttribute(this, ATTR_IDENTIFIER_NAME, true)); getNodeGroups().add(new ContentLinkInfoGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java index f3add7f44..3e9c9d1ab 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/AccessibilityInfo.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessElementGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.util.List; @@ -51,11 +50,15 @@ public class AccessibilityInfo extends AbstractNode implements AccessibilityNode public static final String QTI_CLASS_NAME = "accessibilityInfo"; - public AccessibilityInfo(final QtiNode parent) { + public AccessibilityInfo(final ApipAccessibility parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new AccessElementGroup(this, 1, null)); } + /** + * + * @return A mutable list of {@link AccessElement}s. + */ public List getAccessElements() { return getNodeGroups().getAccessElementGroup().getAccessElements(); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java index 216f8d0ab..feebac6cf 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibility.java @@ -38,14 +38,28 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.CompanionMaterialsInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.InclusionOrderGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.companion.CompanionMaterialsInfo; import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; +import uk.ac.ed.ph.jqtiplus.node.content.ItemBody; +import uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock; +import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; +import uk.ac.ed.ph.jqtiplus.node.item.ModalFeedback; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection; +import uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest; +import uk.ac.ed.ph.jqtiplus.node.test.TestFeedback; +import uk.ac.ed.ph.jqtiplus.node.test.TestPart; +import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; import java.util.List; /** - * FIXME: Document this type + * Holds all of the accessibility metadata related to a given top-level {@link ContentContainer} + * + *

A given ApipAccessibility may be related to an {@link AssessmentItem}'s {@link ItemBody}, + * {@link ModalFeedback}, one of an {@link AssessmentSection}'s {@link RubricBlock}s, or a + * {@link TestFeedback} element found within an {@link AssessmentTest} or its {@link TestPart}s.

* * @author Zack Pierce */ @@ -60,8 +74,6 @@ public ApipAccessibility(final QtiNode parent) { getNodeGroups().add(new CompanionMaterialsInfoGroup(this)); getNodeGroups().add(new InclusionOrderGroup(this)); getNodeGroups().add(new AccessibilityInfoGroup(this)); - - // TODO - XML namespace related serialization handling } public CompanionMaterialsInfo getCompanionMaterialsInfo() { @@ -89,4 +101,15 @@ public List getAccessElements() { final AccessibilityInfo accessibilityInfo = getAccessibilityInfo(); return accessibilityInfo != null ? accessibilityInfo.getAccessElements() : null; } + + /** + * Searches through its ancestors and the root document to find the content container element + * which this accessibility data is intended to assist. + * + * @see ContentContainer + * @return + */ + public ContentContainer getRelatedContentContainer() { + return QueryUtils.findRelatedTopLevelContentContainer(this); + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java index 25df34ebb..320fc9a50 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorInfo.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; /** @@ -48,7 +47,7 @@ public class CalculatorInfo extends FileInfo implements AccessibilityNode { public static final String QTI_CLASS_NAME = "calculatorInfo"; - public CalculatorInfo(final QtiNode parent) { + public CalculatorInfo(final Calculator parent) { super(parent, QTI_CLASS_NAME, false); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java index 754a075f2..9ec6a3a43 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/CalculatorType.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleEnumerateElement; /** @@ -48,7 +47,7 @@ public class CalculatorType extends SingleEnumerateElement i public static final String QTI_CLASS_NAME = "calculatorType"; - public CalculatorType(final QtiNode parent) { + public CalculatorType(final Calculator parent) { super(parent, QTI_CLASS_NAME, null); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java index 2bf4c8ee4..3bc12e7d3 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/DigitalMaterial.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; /** @@ -48,7 +47,7 @@ public class DigitalMaterial extends FileInfo implements CompanionMaterial, Acce public static final String QTI_CLASS_NAME = "digitalMaterial"; - public DigitalMaterial(final QtiNode parent) { + public DigitalMaterial(final CompanionMaterialsInfo parent) { super(parent, QTI_CLASS_NAME, false); } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java index c3c2afaba..bfd9da444 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MajorIncrementLinearUS.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class MajorIncrementLinearUS extends DecimalUnitElement imp public static final String QTI_CLASS_NAME = "majorIncrement"; - public MajorIncrementLinearUS(final QtiNode parent) { + public MajorIncrementLinearUS(final RuleSystemUS parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java index d2783ac12..391a0c198 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/MinimumLength.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; /** @@ -48,7 +47,7 @@ public class MinimumLength extends SingleIntegerElement implements Accessibility public static final String QTI_CLASS_NAME = "minimumLength"; - public MinimumLength(final QtiNode parent) { + public MinimumLength(final LinearRuleSystem parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java index 3bfe8acbb..18dcc0b44 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Protractor.java @@ -37,7 +37,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.RadialIncrementSystemGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -50,7 +49,7 @@ public class Protractor extends AbstractNode implements CompanionMaterial, Acces public static final String QTI_CLASS_NAME = "protractor"; - public Protractor(final QtiNode parent) { + public Protractor(final CompanionMaterialsInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new DescriptionGroup(this, true)); getNodeGroups().add(new RadialIncrementSystemGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java index be57b5cef..929fce704 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemSI.java @@ -37,7 +37,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialSIGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialSIGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -50,7 +49,7 @@ public class RadialIncrementSystemSI extends AbstractNode implements RadialIncre public static final String QTI_CLASS_NAME = "incrementSI"; - public RadialIncrementSystemSI(final QtiNode parent) { + public RadialIncrementSystemSI(final Protractor parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new MinorIncrementRadialSIGroup(this)); getNodeGroups().add(new MajorIncrementRadialSIGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java index d595ff8bb..92823ee8e 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RadialIncrementSystemUS.java @@ -37,7 +37,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MajorIncrementRadialUSGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementRadialUSGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -50,7 +49,7 @@ public class RadialIncrementSystemUS extends AbstractNode implements RadialIncre public static final String QTI_CLASS_NAME = "incrementUS"; - public RadialIncrementSystemUS(final QtiNode parent) { + public RadialIncrementSystemUS(final Protractor parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new MinorIncrementRadialUSGroup(this)); getNodeGroups().add(new MajorIncrementRadialUSGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java index 476d5892a..4498dfb43 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/ReadingPassage.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.companion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.FileInfo; /** @@ -48,7 +47,7 @@ public class ReadingPassage extends FileInfo implements CompanionMaterial, Acces public static final String QTI_CLASS_NAME = "readingPassage"; - public ReadingPassage(final QtiNode parent) { + public ReadingPassage(final CompanionMaterialsInfo parent) { super(parent, QTI_CLASS_NAME, false); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java index bf69e50c7..70713977c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/Rule.java @@ -37,7 +37,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.DescriptionGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.LinearRuleSystemGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -50,7 +49,7 @@ public class Rule extends AbstractNode implements CompanionMaterial, Accessibili public static final String QTI_CLASS_NAME = "rule"; - public Rule(final QtiNode parent) { + public Rule(final CompanionMaterialsInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new DescriptionGroup(this, true)); getNodeGroups().add(new LinearRuleSystemGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java index d150a5f50..8ddeba801 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemSI.java @@ -38,7 +38,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinimumLengthGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearSIGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * Linear measurement system using SI standards for a Rule material. @@ -51,7 +50,7 @@ public class RuleSystemSI extends AbstractNode implements LinearRuleSystem, Acce public static final String QTI_CLASS_NAME = "ruleSystemSI"; - public RuleSystemSI(final QtiNode parent) { + public RuleSystemSI(final Rule parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new MinimumLengthGroup(this)); getNodeGroups().add(new MinorIncrementLinearSIGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java index dd678389c..8c09aab04 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/companion/RuleSystemUS.java @@ -38,7 +38,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinimumLengthGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.companion.MinorIncrementLinearUSGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -51,7 +50,7 @@ public class RuleSystemUS extends AbstractNode implements LinearRuleSystem, Acce public static final String QTI_CLASS_NAME = "ruleSystemUS"; - public RuleSystemUS(final QtiNode parent) { + public RuleSystemUS(final Rule parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new MinimumLengthGroup(this)); getNodeGroups().add(new MinorIncrementLinearUSGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java index 2f8c90f29..61d49b0ea 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslDefaultOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class AslDefaultOrder extends ElementOrderList implements AccessibilityNo public static final String QTI_CLASS_NAME = "aslDefaultOrder"; - public AslDefaultOrder(final QtiNode parent) { + public AslDefaultOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java index e70a99986..9dcdf0f14 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/AslOnDemandOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class AslOnDemandOrder extends ElementOrderList implements AccessibilityN public static final String QTI_CLASS_NAME = "aslOnDemandOrder"; - public AslOnDemandOrder(final QtiNode parent) { + public AslOnDemandOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java index b47fcbcb5..6ec2964ef 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/BrailleDefaultOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class BrailleDefaultOrder extends ElementOrderList implements Accessibili public static final String QTI_CLASS_NAME = "brailleDefaultOrder"; - public BrailleDefaultOrder(final QtiNode parent) { + public BrailleDefaultOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java index 0bb966713..f71d8fdd5 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/ElementOrderList.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.ElementOrderGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.util.List; @@ -49,7 +48,7 @@ public abstract class ElementOrderList extends AbstractNode implements Accessibi private static final long serialVersionUID = 4302185581837683599L; - public ElementOrderList(final QtiNode parent, final String qtiClassName) { + public ElementOrderList(final InclusionOrder parent, final String qtiClassName) { super(parent, qtiClassName); getNodeGroups().add(new ElementOrderGroup(this)); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java index e0a173b7e..b4fabfdbf 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/GraphicsOnlyOnDemandOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class GraphicsOnlyOnDemandOrder extends ElementOrderList implements Acces public static final String QTI_CLASS_NAME = "graphicsOnlyOnDemandOrder"; - public GraphicsOnlyOnDemandOrder(final QtiNode parent) { + public GraphicsOnlyOnDemandOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java index ad3389dfb..62b107e74 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/InclusionOrder.java @@ -36,7 +36,7 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.inclusion.StandardElementOrderListGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; /** * FIXME: Document this type @@ -49,7 +49,7 @@ public class InclusionOrder extends AbstractNode implements AccessibilityNode { public static final String QTI_CLASS_NAME = "inclusionOrder"; - public InclusionOrder(final QtiNode parent) { + public InclusionOrder(final ApipAccessibility parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new StandardElementOrderListGroup(this)); // TODO : extension point for 3rd party lists... diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java index 053e90841..e7a34ba7c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/NonVisualDefaultOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class NonVisualDefaultOrder extends ElementOrderList implements Accessibi public static final String QTI_CLASS_NAME = "nonVisualDefaultOrder"; - public NonVisualDefaultOrder(final QtiNode parent) { + public NonVisualDefaultOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java index 23037f6d2..a918b99ac 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishDefaultOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class SignedEnglishDefaultOrder extends ElementOrderList implements Acces public static final String QTI_CLASS_NAME = "signedEnglishDefaultOrder"; - public SignedEnglishDefaultOrder(final QtiNode parent) { + public SignedEnglishDefaultOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java index 270ccac98..991100773 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/SignedEnglishOnDemandOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class SignedEnglishOnDemandOrder extends ElementOrderList implements Acce public static final String QTI_CLASS_NAME = "signedEnglishOnDemandOrder"; - public SignedEnglishOnDemandOrder(final QtiNode parent) { + public SignedEnglishOnDemandOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java index b3699a5b0..bdadb2ce0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsDefaultOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class TextGraphicsDefaultOrder extends ElementOrderList implements Access public static final String QTI_CLASS_NAME = "textGraphicsDefaultOrder"; - public TextGraphicsDefaultOrder(final QtiNode parent) { + public TextGraphicsDefaultOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java index 37fe37586..448bfb383 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextGraphicsOnDemandOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class TextGraphicsOnDemandOrder extends ElementOrderList implements Acces public static final String QTI_CLASS_NAME = "textGraphicsOnDemandOrder"; - public TextGraphicsOnDemandOrder(final QtiNode parent) { + public TextGraphicsOnDemandOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java index f8155ef16..e89908093 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyDefaultOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class TextOnlyDefaultOrder extends ElementOrderList implements Accessibil public static final String QTI_CLASS_NAME = "textOnlyDefaultOrder"; - public TextOnlyDefaultOrder(final QtiNode parent) { + public TextOnlyDefaultOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java index 263d9580b..6f4cfef8d 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/inclusion/TextOnlyOnDemandOrder.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * FIXME: Document this type @@ -47,7 +46,7 @@ public class TextOnlyOnDemandOrder extends ElementOrderList implements Accessibi public static final String QTI_CLASS_NAME = "textOnlyOnDemandOrder"; - public TextOnlyOnDemandOrder(final QtiNode parent) { + public TextOnlyOnDemandOrder(final InclusionOrder parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java index c4ea3f477..29998f169 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterLink.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; /** @@ -48,7 +47,7 @@ public class CharacterLink extends SingleIntegerElement implements StringLink, A public static final String QTI_CLASS_NAME = "characterLink"; - public CharacterLink(final QtiNode parent) { + public CharacterLink(final TextLink parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java index 55e3a29f6..372eef311 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/CharacterStringLink.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; @@ -58,7 +57,7 @@ public class CharacterStringLink extends AbstractNode implements StringLink, Acc private Integer stopCharacter; - public CharacterStringLink(final QtiNode parent) { + public CharacterStringLink(final TextLink parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java index 2d00af690..f479ba3d9 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfo.java @@ -34,11 +34,14 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierReferenceAttribute; +import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.link.LinkGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; import uk.ac.ed.ph.jqtiplus.types.Identifier; +import uk.ac.ed.ph.jqtiplus.utils.QueryUtils; import uk.ac.ed.ph.jqtiplus.validation.ValidationContext; /** @@ -56,21 +59,29 @@ public class ContentLinkInfo extends AbstractNode implements AccessibilityNode { private static final String ATTR_QTI_LINK_IDENTIFIER_REF = "qtiLinkIdentifierRef"; - public ContentLinkInfo(final QtiNode parent) { + public ContentLinkInfo(final AccessElement parent) { super(parent, QTI_CLASS_NAME); - getAttributes().add(new IdentifierReferenceAttribute(this, ATTR_QTI_LINK_IDENTIFIER_REF, false)); + getAttributes().add(new StringAttribute(this, ATTR_QTI_LINK_IDENTIFIER_REF, false)); getAttributes().add(new IdentifierReferenceAttribute(this, ATTR_APIP_LINK_IDENTIFIER_REF, false)); getNodeGroups().add(new LinkGroup(this)); } - public Identifier getQtiLinkIdentifierRef() { - return getAttributes().getIdentifierRefAttribute(ATTR_QTI_LINK_IDENTIFIER_REF).getValue(); + public String getQtiLinkIdentifierRef() { + return getAttributes().getStringAttribute(ATTR_QTI_LINK_IDENTIFIER_REF).getValue(); + } + + public void setQtiLinkIdentifierRef(final String identifier) { + getAttributes().getStringAttribute(ATTR_QTI_LINK_IDENTIFIER_REF).setValue(identifier); } public Identifier getApipLinkIdentifierRef() { return getAttributes().getIdentifierRefAttribute(ATTR_APIP_LINK_IDENTIFIER_REF).getValue(); } + public void setApipLinkIdentifierRef(final Identifier identifier) { + getAttributes().getIdentifierRefAttribute(ATTR_APIP_LINK_IDENTIFIER_REF).setValue(identifier); + } + /** * @return the optional {@link ObjectLink} child, or null if it does not exist. */ @@ -78,6 +89,16 @@ public ObjectLink getObjectLink() { return getNodeGroups().getLinkGroup().getObjectLink(); } + /** + * Sets this ContentLink to have an ObjectLink, deleting or replacing any existent ObjectLink or TextLink child. + * + * If the supplied objectLink is null, any existing child will simply be deleted. + * @param objectLink + */ + public void setObjectLink(final ObjectLink objectLink) { + getNodeGroups().getLinkGroup().setObjectLink(objectLink); + } + /** * @return the optional {@link TextLink} child, or null if it does not exist. */ @@ -85,6 +106,16 @@ public TextLink getTextLink() { return getNodeGroups().getLinkGroup().getTextLink(); } + /** + * Sets this ContentLink to have an TextLink, deleting or replacing any existent ObjectLink or TextLink child. + * + * If the supplied textLink is null, any existing child will simply be deleted. + * @param textLink + */ + public void setTextLink(final TextLink textLink) { + getNodeGroups().getLinkGroup().setTextLink(textLink); + } + /* * (non-Javadoc) * @@ -92,7 +123,29 @@ public TextLink getTextLink() { */ @Override protected void validateThis(final ValidationContext context) { - // TODO : validate that either the qtiLinkIdentifierRef or the apipLinkIdentifierRef attribute has a value super.validateThis(context); + final String qtiIdRef = getQtiLinkIdentifierRef(); + if (qtiIdRef == null && getApipLinkIdentifierRef() == null) { + context.fireValidationError( + this, + QTI_CLASS_NAME + + " must have either the qtiLinkIdentifierRef or apipLinkIdentifierRef specified, but both are null."); + } + else if (qtiIdRef != null) { + if (getApipLinkIdentifierRef() != null) { + context.fireValidationError( + this, + QTI_CLASS_NAME + + " must only have either qtiLinkIdentifierRef or apipLinkIdentifierRef specified, but not both."); + } + final ContentContainer container = QueryUtils.findRelatedTopLevelContentContainer(this); + if (container == null) { + context.fireValidationError(this, "No QTI content container found associated with this accessibility metadata"); + } + else if (QueryUtils.findQtiDescendantOrSelf(container, qtiIdRef) == null) { + context.fireValidationError(this, QTI_CLASS_NAME + " with " + ATTR_QTI_LINK_IDENTIFIER_REF + " of '" + + qtiIdRef + "' does not point to an extant Qti content element."); + } + } } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java index 09a13d29f..f2209a148 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/FullString.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; /** @@ -48,7 +47,7 @@ public class FullString extends EmptyElement implements StringLink, Accessibilit public static final String QTI_CLASS_NAME = "fullString"; - public FullString(final QtiNode parent) { + public FullString(final TextLink parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java index c12d35433..16e5f5aac 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ObjectLink.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.EmptyElement; /** @@ -48,7 +47,7 @@ public class ObjectLink extends EmptyElement implements Link, AccessibilityNode public static final String QTI_CLASS_NAME = "objectLink"; - public ObjectLink(final QtiNode parent) { + public ObjectLink(final ContentLinkInfo parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java index d7a68f45a..a5a1ecdbc 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/TextLink.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.link.StringLinkGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * A link to the textual portion of the identifier-referenced content element. @@ -55,7 +54,7 @@ public class TextLink extends AbstractNode implements Link, AccessibilityNode { public static final String QTI_CLASS_NAME = "textLink"; - public TextLink(final QtiNode parent) { + public TextLink(final ContentLinkInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new StringLinkGroup(this)); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java index 250fc665f..989b69f44 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/WordLink.java @@ -34,7 +34,6 @@ package uk.ac.ed.ph.jqtiplus.node.accessibility.link; import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.SingleIntegerElement; /** @@ -48,7 +47,7 @@ public class WordLink extends SingleIntegerElement implements StringLink, Access public static final String QTI_CLASS_NAME = "wordLink"; - public WordLink(final QtiNode parent) { + public WordLink(final TextLink parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java index 7ba5bfeda..fe9d5796e 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/AnswerReduction.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.RemoveTagGroupGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.util.List; @@ -55,7 +54,7 @@ public class AnswerReduction extends AbstractNode implements AccessibilityNode { private static final long serialVersionUID = 1659866116384977816L; public static final String QTI_CLASS_NAME = "answerReduction"; - public AnswerReduction(final QtiNode parent) { + public AnswerReduction(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new RemoveTagGroupGroup(this)); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java index a8f341c41..cdae629ad 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/BrailleText.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * Container for content relevant to the presentation of braille. @@ -55,7 +54,7 @@ public class BrailleText extends AbstractNode implements AccessibilityNode { public static final String ELEM_BRAILLE_TEXT_STRING = "brailleTextString"; - public BrailleText(final QtiNode parent) { + public BrailleText(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new LabelledStringGroup(this, ELEM_BRAILLE_TEXT_STRING, true)); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java index fe89cabd8..8bcef23c0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Guidance.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.GuidanceSupportGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; /** * Container for the content to provide guidance through the original material. @@ -54,7 +53,7 @@ public class Guidance extends AbstractNode implements AccessibilityNode { public static final String QTI_CLASS_NAME = "guidance"; - public Guidance(final QtiNode parent) { + public Guidance(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new GuidanceSupportGroup(this, ELEM_LANGUAGE_LEARNER_SUPPORT)); getNodeGroups().add(new GuidanceSupportGroup(this, ELEM_COGNITIVE_GUIDANCE_SUPPORT)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java index 0df5a0e0e..d3cd1cdf7 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/KeyWordTranslation.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.DefinitionIdGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.util.List; @@ -54,7 +53,7 @@ public class KeyWordTranslation extends AbstractNode implements AccessibilityNod private static final long serialVersionUID = -5539729363209564169L; public static final String QTI_CLASS_NAME = "keyWordTranslation"; - public KeyWordTranslation(final QtiNode parent) { + public KeyWordTranslation(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new DefinitionIdGroup(this)); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java index 832ac2d9a..6c0e14610 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RelatedElementInfo.java @@ -47,7 +47,7 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.related.StructuredMaskGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.TactileFileGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; /** * Container for all actual accessibility metacontent within a given accessElement @@ -60,7 +60,7 @@ public class RelatedElementInfo extends AbstractNode implements AccessibilityNod public static final String QTI_CLASS_NAME = "relatedElementInfo"; - public RelatedElementInfo(final QtiNode parent) { + public RelatedElementInfo(final AccessElement parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new SpokenGroup(this)); getNodeGroups().add(new BrailleTextGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java index 105d87ca0..75564cb70 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/RevealAlternativeRepresentation.java @@ -40,7 +40,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ObjectFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.VideoFileInfoGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.util.List; @@ -59,7 +58,7 @@ public class RevealAlternativeRepresentation extends AbstractNode implements Acc private static final long serialVersionUID = -9063030312836472390L; public static final String QTI_CLASS_NAME = "revealAlternativeRepresentation"; - public RevealAlternativeRepresentation(final QtiNode parent) { + public RevealAlternativeRepresentation(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new AudioFileInfoGroup(this, 1)); getNodeGroups().add(new VideoFileInfoGroup(this, false)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java index ec59ac93f..04dbd05bb 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Scaffold.java @@ -37,7 +37,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.related.ScaffoldBehaviorGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.SingleIntegerElementGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.inclusion.InclusionOrder; /** @@ -53,7 +52,7 @@ public class Scaffold extends AbstractNode implements AccessibilityNode { private static final String ELEM_REVEAL_ORDER = "revealOrder"; - public Scaffold(final QtiNode parent) { + public Scaffold(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new SingleIntegerElementGroup(this, ELEM_REVEAL_ORDER, true)); getNodeGroups().add(new ScaffoldBehaviorGroup(this)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java index 8a028c5ca..ae15f62c8 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/Spoken.java @@ -37,7 +37,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.util.List; @@ -54,7 +53,7 @@ public class Spoken extends AbstractNode implements AccessibilityNode { public static final String ELEM_SPOKEN_TEXT = "spokenText"; public static final String ELEM_TEXT_TO_SPEECH_PRONUNCIATION = "textToSpeechPronunciation"; - public Spoken(final QtiNode parent) { + public Spoken(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new AudioFileInfoGroup(this, null)); getNodeGroups().add(new LabelledStringGroup(this, ELEM_SPOKEN_TEXT, false)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java index 9de7796ed..95e8462d0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/StructuredMask.java @@ -36,7 +36,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.LoadingContext; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.serialization.QtiSaxDocumentFirer; import uk.ac.ed.ph.jqtiplus.types.DataTypeBinder; import uk.ac.ed.ph.jqtiplus.xmlutils.XmlParseUtils; @@ -63,7 +62,7 @@ public class StructuredMask extends AbstractNode implements AccessibilityNode { private Boolean answerOption; - public StructuredMask(final QtiNode parent) { + public StructuredMask(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java index 9f66f3d1f..434d632f5 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/related/TactileFile.java @@ -37,7 +37,6 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.related.AudioFileInfoGroup; import uk.ac.ed.ph.jqtiplus.group.accessibility.related.LabelledStringGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; -import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.util.List; @@ -56,7 +55,7 @@ public class TactileFile extends AbstractNode implements AccessibilityNode { public static final String ELEM_TACTILE_BRAILLE_TEXT = "tactileBrailleText"; - public TactileFile(final QtiNode parent) { + public TactileFile(final RelatedElementInfo parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new AudioFileInfoGroup(this, ELEM_TACTILE_AUDIO_FILE, 1)); getNodeGroups().add(new LabelledStringGroup(this, ELEM_TACTILE_AUDIO_TEXT, true)); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/ItemBody.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/ItemBody.java index 4e386bc97..c4190259b 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/ItemBody.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/ItemBody.java @@ -34,6 +34,7 @@ package uk.ac.ed.ph.jqtiplus.node.content; import uk.ac.ed.ph.jqtiplus.group.content.BlockGroup; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.content.basic.Block; import uk.ac.ed.ph.jqtiplus.node.content.template.TemplateElement; @@ -76,7 +77,7 @@ * @author Jonathon Hare * @author Jiri Kajaba */ -public final class ItemBody extends BodyElement { +public final class ItemBody extends BodyElement implements ContentContainer { private static final long serialVersionUID = 5141415636417548133L; @@ -131,7 +132,7 @@ public List findTemplateElements(final Identifier templateIdent templates.add(template); } } - + return Collections.unmodifiableList(templates); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java index 1c13a71e9..35c480dbc 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java @@ -35,6 +35,7 @@ import uk.ac.ed.ph.jqtiplus.attribute.enumerate.ViewMultipleAttribute; import uk.ac.ed.ph.jqtiplus.group.content.BlockGroup; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.content.basic.AbstractFlowBodyElement; import uk.ac.ed.ph.jqtiplus.node.content.basic.Block; @@ -49,7 +50,7 @@ * @author Jonathon Hare * @author Jiri Kajaba */ -public final class RubricBlock extends AbstractFlowBodyElement implements SimpleBlock { +public final class RubricBlock extends AbstractFlowBodyElement implements SimpleBlock, ContentContainer { private static final long serialVersionUID = -531414949035924206L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java index 58b308464..473e70c5c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java @@ -38,6 +38,7 @@ import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; import uk.ac.ed.ph.jqtiplus.group.content.FlowStaticGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic; import uk.ac.ed.ph.jqtiplus.node.shared.VariableDeclaration; import uk.ac.ed.ph.jqtiplus.node.shared.VariableType; @@ -60,7 +61,7 @@ * * @author Jonathon Hare */ -public class ModalFeedback extends AbstractNode { +public class ModalFeedback extends AbstractNode implements ContentContainer { private static final long serialVersionUID = -3911613199124971014L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java index 42e8d4a8a..cfa95cba0 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java @@ -40,6 +40,7 @@ import uk.ac.ed.ph.jqtiplus.exception.QtiLogicException; import uk.ac.ed.ph.jqtiplus.group.content.FlowStaticGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic; import uk.ac.ed.ph.jqtiplus.node.shared.VariableDeclaration; import uk.ac.ed.ph.jqtiplus.node.shared.VariableType; @@ -60,7 +61,7 @@ * @see VisibilityMode * @author Jiri Kajaba */ -public final class TestFeedback extends AbstractNode { +public final class TestFeedback extends AbstractNode implements ContentContainer { private static final long serialVersionUID = 6567681516055125776L; diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java index e1ea7f59a..872207fee 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/serialization/QtiSaxDocumentFirer.java @@ -366,9 +366,10 @@ public void fireText(final String string) throws SAXException { * @param content */ public void fireSimpleElement(final String localName, final String content) throws SAXException { - this.fireStartElement(content, localName, lastOpenedNamespaceUri, null); + final String namespaceUri = lastOpenedNamespaceUri != null ? lastOpenedNamespaceUri : ""; + this.fireStartElement(content, localName, namespaceUri, null); this.fireText(content); - this.fireEndElement(content, localName, lastOpenedNamespaceUri); + this.fireEndElement(content, localName, namespaceUri); } //----------------------------------------------- diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java index e8ed1a2b4..8b4a8887a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/utils/QueryUtils.java @@ -38,16 +38,23 @@ import uk.ac.ed.ph.jqtiplus.QtiConstants; import uk.ac.ed.ph.jqtiplus.attribute.Attribute; import uk.ac.ed.ph.jqtiplus.attribute.ForeignAttribute; +import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; +import uk.ac.ed.ph.jqtiplus.exception.QtiAttributeException; import uk.ac.ed.ph.jqtiplus.group.NodeGroup; +import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.internal.util.Assert; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.block.ForeignElement; import uk.ac.ed.ph.jqtiplus.node.content.BodyElement; +import uk.ac.ed.ph.jqtiplus.node.content.basic.Content; import uk.ac.ed.ph.jqtiplus.node.expression.operator.CustomOperator; +import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; import uk.ac.ed.ph.jqtiplus.node.item.interaction.CustomInteraction; import uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing; import uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem; import uk.ac.ed.ph.jqtiplus.resolution.RootNodeLookup; +import uk.ac.ed.ph.jqtiplus.types.Identifier; import java.util.ArrayList; import java.util.HashSet; @@ -59,6 +66,7 @@ * searches of a {@link QtiNode} tree. * * @author David McKain + * @author Zack Pierce */ public final class QueryUtils { @@ -210,7 +218,18 @@ public static void walkChildNodes(final TreeWalkNodeHandler handler, final Itera Assert.notNull(startNodes); Assert.notNull(handler); for (final QtiNode startNode : startNodes) { - for (final NodeGroup nodeGroup : startNode.getNodeGroups()) { + for (final NodeGroup nodeGroup : startNode.getNodeGroups()) { + for (final QtiNode childNode : nodeGroup.getChildren()) { + doWalkTree(handler, childNode); + } + } + } + } + + private static void doWalkTree(final TreeWalkNodeHandler handler, final QtiNode currentNode) { + final boolean descend = handler.handleNode(currentNode); + if (descend) { + for (final NodeGroup nodeGroup : currentNode.getNodeGroups()) { for (final QtiNode childNode : nodeGroup.getChildren()) { doWalkTree(handler, childNode); } @@ -259,14 +278,80 @@ public static E findFirstShallowInstance(final Class sear return null; } - private static void doWalkTree(final TreeWalkNodeHandler handler, final QtiNode currentNode) { - final boolean descend = handler.handleNode(currentNode); - if (descend) { - for (final NodeGroup nodeGroup : currentNode.getNodeGroups()) { - for (final QtiNode childNode : nodeGroup.getChildren()) { - doWalkTree(handler, childNode); + /** + * Finds the content container associated with the AccessibilityNode's ApipAccessibility data. + * + * @see ContentContainer + */ + public static ContentContainer findRelatedTopLevelContentContainer(final A accessibilityNode) { + Assert.notNull(accessibilityNode); + QtiNode parent = accessibilityNode.getParent(); + while (parent != null) { + if (parent instanceof ContentContainer) { + return (ContentContainer) parent; + } + else if (parent instanceof AssessmentItem) { + return ((AssessmentItem) parent).getItemBody(); + } + parent = parent.getParent(); + } + return null; + } + + /** + * Finds the QTI {@link Content} node with an "id" attribute that matches the supplied id. + * @param node + * @param id + * @return null if no matching element found. + */ + public static Content findQtiDescendantOrSelf(final QtiNode node, final String id) { + Assert.notNull(node); + Assert.notNull(id); + final QtiContentIdDescendentSearchHandler handler = new QtiContentIdDescendentSearchHandler(id); + doWalkTree(handler, node); + return handler.getFoundNode(); + } + + private static final class QtiContentIdDescendentSearchHandler implements TreeWalkNodeHandler { + + public QtiContentIdDescendentSearchHandler(final String searchId) { + this.searchId = searchId; + } + + private final String searchId; + private Content found; + + @Override + public boolean handleNode(final QtiNode node) { + if (found != null) { + // Target found elsewhere in tree already + return false; + } + if (node instanceof AccessibilityNode) { + // ZP : No need to search deeper within accessibility nodes, since we're looking for QTI content nodes + return false; + } + if (!(node instanceof Content)) { + return false; + } + final Content contentNode = (Content) node; + try { + final IdentifierAttribute idAttribute = contentNode.getAttributes().getIdentifierAttribute("id"); + final Identifier identifier = idAttribute.getValue(); + if (identifier != null && searchId.equals(identifier.toString())) { + found = contentNode; + return false; } } + catch (final QtiAttributeException e) { + return true; + } + /* Keep searching deeper */ + return true; + } + + public Content getFoundNode() { + return found; } } diff --git a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java new file mode 100644 index 000000000..f9f3f1d77 --- /dev/null +++ b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java @@ -0,0 +1,173 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility.link; + +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessElement; +import uk.ac.ed.ph.jqtiplus.node.accessibility.AccessibilityInfo; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.content.ItemBody; +import uk.ac.ed.ph.jqtiplus.node.content.xhtml.text.P; +import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; +import uk.ac.ed.ph.jqtiplus.notification.NotificationLevel; +import uk.ac.ed.ph.jqtiplus.notification.NotificationRecorder; +import uk.ac.ed.ph.jqtiplus.notification.NotificationType; +import uk.ac.ed.ph.jqtiplus.types.Identifier; +import uk.ac.ed.ph.jqtiplus.validation.DummyValidationContext; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * FIXME: Document this type + * + * @author Zack Pierce + */ +public class ContentLinkInfoTest { + + DummyValidationContext context; + NotificationRecorder recorder; + AssessmentItem item; + ItemBody itemBody; + P paragraph; + ApipAccessibility apipAccessibility; + AccessibilityInfo accessibilityInfo; + AccessElement accessElement; + + @Before + public void before() { + context = new DummyValidationContext(); + recorder = new NotificationRecorder(NotificationLevel.WARNING); + context.addNotificationListener(recorder); + item = new AssessmentItem(); + itemBody = new ItemBody(item); + item.setItemBody(itemBody); + paragraph = new P(itemBody); + itemBody.getNodeGroups().getBlockGroup().getChildren().add(paragraph); + apipAccessibility = new ApipAccessibility(item); + accessibilityInfo = new AccessibilityInfo(apipAccessibility); + apipAccessibility.setAccessibilityInfo(accessibilityInfo); + accessElement = new AccessElement(accessibilityInfo); + accessibilityInfo.getAccessElements().add(accessElement); + } + + public void assertNoNotificationsRecorded() { + Assert.assertEquals(0, recorder.getNotifications().size()); + } + + @Test + public void testValidateCorrectObjectLinkToApipProducesNoErrors() { + final ContentLinkInfo cli = new ContentLinkInfo(accessElement); + cli.setObjectLink(new ObjectLink(null)); + cli.setApipLinkIdentifierRef(Identifier.parseString("hello")); + cli.validate(context); + assertNoNotificationsRecorded(); + } + + @Test + public void testValidateCorrectObjectLinkToQtiProducesNoErrors() { + final String targetId = "hello"; + paragraph.setId(Identifier.parseString(targetId)); + final ContentLinkInfo cli = new ContentLinkInfo(accessElement); + cli.setObjectLink(new ObjectLink(null)); + cli.setQtiLinkIdentifierRef(targetId); + cli.validate(context); + assertNoNotificationsRecorded(); + } + + @Test + public void testValidateMissingObjectLinkAndTextLinkProducesError() { + final ContentLinkInfo cli = new ContentLinkInfo(accessElement); + cli.setApipLinkIdentifierRef(Identifier.parseString("hello")); + cli.validate(context); + Assert.assertEquals(1, recorder.getNotifications().size()); + Assert.assertEquals(NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel()); + Assert.assertEquals(NotificationType.MODEL_VALIDATION, recorder.getNotifications().get(0).getNotificationType()); + Assert.assertEquals("Not enough children: objectLinkOrTextLink. Expected at least: 1, but found: 0", recorder.getNotifications().get(0).getMessage()); + } + + @Test + public void testValidateHavingNeitherIdRefProducesError() { + final ContentLinkInfo cli = new ContentLinkInfo(null); + cli.setObjectLink(new ObjectLink(null)); + cli.setQtiLinkIdentifierRef(null); + cli.setApipLinkIdentifierRef(null); + cli.validate(context); + Assert.assertEquals(1, recorder.getNotifications().size()); + Assert.assertEquals(NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel()); + Assert.assertEquals(NotificationType.MODEL_VALIDATION, recorder.getNotifications().get(0).getNotificationType()); + Assert.assertTrue(recorder.getNotifications().get(0).getMessage().startsWith("contentLinkInfo must have either the qtiLinkIdentifierRef or apipLinkIdentifierRef specified, but both are null.")); + } + + @Test + public void testValidateHavingBothIdRefsProducesError() { + final String targetId = "hello"; + paragraph.setId(Identifier.parseString(targetId)); + final ContentLinkInfo cli = new ContentLinkInfo(accessElement); + cli.setObjectLink(new ObjectLink(cli)); + cli.setQtiLinkIdentifierRef(targetId); + cli.setApipLinkIdentifierRef(Identifier.parseString("helloAgain")); + cli.validate(context); + Assert.assertEquals(1, recorder.getNotifications().size()); + Assert.assertEquals(NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel()); + Assert.assertEquals(NotificationType.MODEL_VALIDATION, recorder.getNotifications().get(0).getNotificationType()); + Assert.assertEquals("contentLinkInfo must only have either qtiLinkIdentifierRef or apipLinkIdentifierRef specified, but not both.", recorder.getNotifications().get(0).getMessage()); + } + + @Test + public void testValidateQtiReferencesNoMatchingIdElementProducesError() { + paragraph.setId(Identifier.parseString("wrongId")); + final ContentLinkInfo cli = new ContentLinkInfo(accessElement); + cli.setObjectLink(new ObjectLink(cli)); + cli.setQtiLinkIdentifierRef("targetId"); + cli.validate(context); + Assert.assertEquals(1, recorder.getNotifications().size()); + Assert.assertEquals(NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel()); + Assert.assertEquals(NotificationType.MODEL_VALIDATION, recorder.getNotifications().get(0).getNotificationType()); + Assert.assertEquals("contentLinkInfo with qtiLinkIdentifierRef of 'targetId' does not point to an extant Qti content element.", recorder.getNotifications().get(0).getMessage()); + } + + @Test + public void testValidateQtiRefButNoAssociatedQtiContentProducesError() { + final ContentLinkInfo cli = new ContentLinkInfo(null); + cli.setObjectLink(new ObjectLink(cli)); + cli.setQtiLinkIdentifierRef("targetId"); + cli.validate(context); + Assert.assertEquals(1, recorder.getNotifications().size()); + Assert.assertEquals(NotificationLevel.ERROR, recorder.getNotifications().get(0).getNotificationLevel()); + Assert.assertEquals(NotificationType.MODEL_VALIDATION, recorder.getNotifications().get(0).getNotificationType()); + Assert.assertEquals("No QTI content container found associated with this accessibility metadata", recorder.getNotifications().get(0).getMessage()); + } + +} diff --git a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/validation/DummyValidationContext.java b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/validation/DummyValidationContext.java new file mode 100644 index 000000000..421f2d18c --- /dev/null +++ b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/validation/DummyValidationContext.java @@ -0,0 +1,108 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.validation; + +import uk.ac.ed.ph.jqtiplus.JqtiExtensionManager; +import uk.ac.ed.ph.jqtiplus.node.AssessmentObject; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.shared.VariableDeclaration; +import uk.ac.ed.ph.jqtiplus.node.shared.VariableType; +import uk.ac.ed.ph.jqtiplus.notification.ListenerNotificationFirer; +import uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier; +import uk.ac.ed.ph.jqtiplus.types.Identifier; +import uk.ac.ed.ph.jqtiplus.value.Signature; + +/** + * Incomplete implementation of ValidationContext intended primarily to ease + * the rapid testing of validation for the specific concerns of potentially deeply-nested classes. + * + * @author Zack Pierce + */ +public class DummyValidationContext extends ListenerNotificationFirer implements ValidationContext { + + JqtiExtensionManager emptyExtensionManager = new JqtiExtensionManager(); + + @Override + public JqtiExtensionManager getJqtiExtensionManager() { + return emptyExtensionManager; + } + + @Override + public boolean isSubjectItem() { + return false; + } + + @Override + public boolean isSubjectTest() { + return false; + } + + @Override + public AssessmentObject getSubject() { + return null; + } + + @Override + public VariableDeclaration isValidLocalVariableReference(final Identifier variableReferenceIdentifier) { + return null; + } + + @Override + public VariableDeclaration isValidLocalVariableReference(final ComplexReferenceIdentifier variableReferenceIdentifier) { + return null; + } + + @Override + public VariableDeclaration checkLocalVariableReference(final QtiNode owner, final Identifier variableReferenceIdentifier) { + return null; + } + + @Override + public VariableDeclaration checkLocalVariableReference(final QtiNode owner, final ComplexReferenceIdentifier variableReferenceIdentifier) { + return null; + } + + @Override + public boolean checkVariableType(final QtiNode owner, final VariableDeclaration variableDeclaration, final VariableType... allowedTypes) { + return false; + } + + @Override + public boolean checkSignature(final QtiNode owner, final VariableDeclaration variableDeclaration, final Signature... allowedSignatures) { + return false; + } + + + +} From 5f657b59759cf0c213bb8e7c134e5fd55abd2d85 Mon Sep 17 00:00:00 2001 From: Zachary Pierce Date: Tue, 17 Sep 2013 15:09:15 -0700 Subject: [PATCH 4/5] Adding stylesheet and apipAccessibility to the elements which now can contain these in QTI 2.1 Final: rubricBlock, templateBlock, feedbackBlock, and modalFeedback. --- .../jqtiplus/group/item/StylesheetGroup.java | 6 +-- .../ed/ph/jqtiplus/node/ContentContainer.java | 8 ++-- .../ApipAccessibilityBearer.java | 45 +++++++++++++++++++ .../node/content/template/TemplateBlock.java | 39 +++++++++++++++- .../node/content/variable/FeedbackBlock.java | 38 +++++++++++++++- .../node/content/variable/RubricBlock.java | 38 +++++++++++++++- .../ph/jqtiplus/node/item/AssessmentItem.java | 11 +++-- .../ph/jqtiplus/node/item/ModalFeedback.java | 36 ++++++++++++++- .../ed/ph/jqtiplus/node/item/Stylesheet.java | 31 ++++++------- .../ph/jqtiplus/node/test/TestFeedback.java | 37 ++++++++++++++- .../link/ContentLinkInfoTest.java | 1 + 11 files changed, 260 insertions(+), 30 deletions(-) create mode 100644 qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibilityBearer.java diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/item/StylesheetGroup.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/item/StylesheetGroup.java index bad90734f..2c89fae2a 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/item/StylesheetGroup.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/group/item/StylesheetGroup.java @@ -34,7 +34,7 @@ package uk.ac.ed.ph.jqtiplus.group.item; import uk.ac.ed.ph.jqtiplus.group.SimpleMultipleNodeGroup; -import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.item.Stylesheet; import java.util.List; @@ -44,11 +44,11 @@ * * @author Jonathon Hare */ -public final class StylesheetGroup extends SimpleMultipleNodeGroup { +public final class StylesheetGroup extends SimpleMultipleNodeGroup { private static final long serialVersionUID = 5034925521089538183L; - public StylesheetGroup(final AssessmentItem parent) { + public StylesheetGroup(final QtiNode parent) { super(parent, Stylesheet.QTI_CLASS_NAME); } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java index 5e684ee18..f49b94c97 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/ContentContainer.java @@ -43,16 +43,18 @@ import uk.ac.ed.ph.jqtiplus.node.test.TestFeedback; /** - * A marker interface for the top-level elements that can contain presentation content. + * A marker interface for high-level elements that can contain presentation content. * *

Every top-level content container is associated with one possible {@link ApipAccessibility} node.

* *
    *
  • In {@link AssessmentItem} , the ContentContainers are {@link ItemBody} and {@link ModalFeedback}
  • - *
  • In {@link AssessmentSection} , the only ContentContainer is {@link RubricBlock}
  • - *
  • In {@link AssessmentTest}, the only ContentContainer is {@link TestFeedback}
  • + *
  • In {@link AssessmentSection}, each {@link RubricBlock} is a ContentContainer
  • + *
  • In {@link AssessmentTest}, each {@link TestFeedback} is a ContentContainer
  • *
* + *

Since they may be treated as containers for content that may or may not be included in the main presentational flow, + * TemplateBlock and FeedbackBlock are also considered ContentContainers.

* @author Zack Pierce */ public interface ContentContainer extends QtiNode { diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibilityBearer.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibilityBearer.java new file mode 100644 index 000000000..2b9b61f5d --- /dev/null +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/accessibility/ApipAccessibilityBearer.java @@ -0,0 +1,45 @@ +/* Copyright (c) 2012-2013, University of Edinburgh. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the University of Edinburgh nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * This software is derived from (and contains code from) QTITools and MathAssessEngine. + * QTITools is (c) 2008, University of Southampton. + * MathAssessEngine is (c) 2010, University of Edinburgh. + */ +package uk.ac.ed.ph.jqtiplus.node.accessibility; + +/** + * Interface for elements that may contain an ApipAccessibility child + * + * @author Zack Pierce + */ +public interface ApipAccessibilityBearer { + ApipAccessibility getApipAccessibility(); + + void setApipAccessibility(ApipAccessibility apipAccessibility); +} diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/template/TemplateBlock.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/template/TemplateBlock.java index 316c5cab8..8caddcf2c 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/template/TemplateBlock.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/template/TemplateBlock.java @@ -33,10 +33,16 @@ */ package uk.ac.ed.ph.jqtiplus.node.content.template; +import uk.ac.ed.ph.jqtiplus.group.accessibility.ApipAccessibilityGroup; import uk.ac.ed.ph.jqtiplus.group.content.BlockStaticGroup; +import uk.ac.ed.ph.jqtiplus.group.item.StylesheetGroup; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibilityBearer; import uk.ac.ed.ph.jqtiplus.node.content.basic.BlockStatic; import uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic; +import uk.ac.ed.ph.jqtiplus.node.item.Stylesheet; import java.util.List; @@ -45,7 +51,7 @@ * * @author Jonathon Hare */ -public final class TemplateBlock extends TemplateElement implements FlowStatic, BlockStatic { +public final class TemplateBlock extends TemplateElement implements FlowStatic, BlockStatic, ContentContainer, ApipAccessibilityBearer { private static final long serialVersionUID = -7030953780473751904L; @@ -55,9 +61,38 @@ public final class TemplateBlock extends TemplateElement implements FlowStatic, public TemplateBlock(final QtiNode parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new BlockStaticGroup(this)); + getNodeGroups().add(new StylesheetGroup(this)); + getNodeGroups().add(new ApipAccessibilityGroup(this, false)); } - public List getChildren() { + public List getBlocks() { return getNodeGroups().getBlockStaticGroup().getBlockStatics(); } + + /** + * Gets mutable list of stylesheet children. + * + * @return stylesheet children + */ + public List getStylesheets() { + return getNodeGroups().getStylesheetGroup().getStylesheets(); + } + + /** + * Gets apipAccessibility child + * + * @return apipAccessibility child + * @see #setApipAccessibility + */ + public ApipAccessibility getApipAccessibility() { + return getNodeGroups().getApipAccessibilityGroup().getApipAccessibility(); + } + + /** + * Sets apipAccessibility child + * @param apipAccessibility + */ + public void setApipAccessibility(final ApipAccessibility apipAccessibility) { + getNodeGroups().getApipAccessibilityGroup().setApipAccessibility(apipAccessibility); + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/FeedbackBlock.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/FeedbackBlock.java index 15fdedf12..0a630d014 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/FeedbackBlock.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/FeedbackBlock.java @@ -33,10 +33,16 @@ */ package uk.ac.ed.ph.jqtiplus.node.content.variable; +import uk.ac.ed.ph.jqtiplus.group.accessibility.ApipAccessibilityGroup; import uk.ac.ed.ph.jqtiplus.group.content.BlockGroup; +import uk.ac.ed.ph.jqtiplus.group.item.StylesheetGroup; +import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibilityBearer; import uk.ac.ed.ph.jqtiplus.node.content.basic.Block; import uk.ac.ed.ph.jqtiplus.node.content.basic.SimpleBlock; +import uk.ac.ed.ph.jqtiplus.node.item.Stylesheet; import java.util.List; @@ -45,7 +51,7 @@ * * @author Jonathon Hare */ -public class FeedbackBlock extends FeedbackElement implements SimpleBlock { +public class FeedbackBlock extends FeedbackElement implements SimpleBlock, ContentContainer, ApipAccessibilityBearer { private static final long serialVersionUID = 456106105509332955L; @@ -56,10 +62,40 @@ public FeedbackBlock(final QtiNode parent) { super(parent, QTI_CLASS_NAME); getNodeGroups().add(new BlockGroup(this)); + getNodeGroups().add(new StylesheetGroup(this)); + getNodeGroups().add(new ApipAccessibilityGroup(this, false)); } @Override public List getBlocks() { return getNodeGroups().getBlockGroup().getBlocks(); } + + /** + * Gets mutable list of stylesheet children. + * + * @return stylesheet children + */ + public List getStylesheets() { + return getNodeGroups().getStylesheetGroup().getStylesheets(); + } + + /** + * Gets apipAccessibility child + * + * @return apipAccessibility child + * @see #setApipAccessibility + */ + @Override + public ApipAccessibility getApipAccessibility() { + return getNodeGroups().getApipAccessibilityGroup().getApipAccessibility(); + } + + /** + * Sets apipAccessibility child + * @param apipAccessibility + */ + public void setApipAccessibility(final ApipAccessibility apipAccessibility) { + getNodeGroups().getApipAccessibilityGroup().setApipAccessibility(apipAccessibility); + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java index 35c480dbc..e07360809 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/content/variable/RubricBlock.java @@ -34,12 +34,17 @@ package uk.ac.ed.ph.jqtiplus.node.content.variable; import uk.ac.ed.ph.jqtiplus.attribute.enumerate.ViewMultipleAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.ApipAccessibilityGroup; import uk.ac.ed.ph.jqtiplus.group.content.BlockGroup; +import uk.ac.ed.ph.jqtiplus.group.item.StylesheetGroup; import uk.ac.ed.ph.jqtiplus.node.ContentContainer; import uk.ac.ed.ph.jqtiplus.node.QtiNode; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibilityBearer; import uk.ac.ed.ph.jqtiplus.node.content.basic.AbstractFlowBodyElement; import uk.ac.ed.ph.jqtiplus.node.content.basic.Block; import uk.ac.ed.ph.jqtiplus.node.content.basic.SimpleBlock; +import uk.ac.ed.ph.jqtiplus.node.item.Stylesheet; import uk.ac.ed.ph.jqtiplus.node.test.View; import java.util.List; @@ -49,8 +54,9 @@ * * @author Jonathon Hare * @author Jiri Kajaba + * @author Zack Pierce */ -public final class RubricBlock extends AbstractFlowBodyElement implements SimpleBlock, ContentContainer { +public final class RubricBlock extends AbstractFlowBodyElement implements SimpleBlock, ContentContainer, ApipAccessibilityBearer { private static final long serialVersionUID = -531414949035924206L; @@ -66,6 +72,9 @@ public RubricBlock(final QtiNode parent) { getAttributes().add(new ViewMultipleAttribute(this, ATTR_VIEWS_NAME, true)); getNodeGroups().add(new BlockGroup(this)); + + getNodeGroups().add(new StylesheetGroup(this)); + getNodeGroups().add(new ApipAccessibilityGroup(this, false)); } public List getViews() { @@ -81,4 +90,31 @@ public List getBlocks() { return getNodeGroups().getBlockGroup().getBlocks(); } + /** + * Gets mutable list of stylesheet children. + * + * @return stylesheet children + */ + public List getStylesheets() { + return getNodeGroups().getStylesheetGroup().getStylesheets(); + } + + /** + * Gets apipAccessibility child + * + * @return apipAccessibility child + * @see #setApipAccessibility + */ + public ApipAccessibility getApipAccessibility() { + return getNodeGroups().getApipAccessibilityGroup().getApipAccessibility(); + } + + /** + * Sets apipAccessibility child + * @param apipAccessibility + */ + public void setApipAccessibility(final ApipAccessibility apipAccessibility) { + getNodeGroups().getApipAccessibilityGroup().setApipAccessibility(apipAccessibility); + } + } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java index dca75e478..aeb3fe3d8 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/AssessmentItem.java @@ -51,6 +51,7 @@ import uk.ac.ed.ph.jqtiplus.node.AssessmentObjectType; import uk.ac.ed.ph.jqtiplus.node.IdentifiableNode; import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibilityBearer; import uk.ac.ed.ph.jqtiplus.node.content.ItemBody; import uk.ac.ed.ph.jqtiplus.node.item.response.declaration.ResponseDeclaration; import uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing; @@ -77,7 +78,7 @@ * @author David McKain * @author Zack Pierce */ -public class AssessmentItem extends AbstractNode implements AssessmentObject { +public class AssessmentItem extends AbstractNode implements AssessmentObject, ApipAccessibilityBearer { private static final long serialVersionUID = 4723748473878175232L; @@ -349,7 +350,7 @@ public void setToolVersion(final String toolVersion) { } /** - * Gets stylesheet children. + * Gets mutable list of stylesheet children. * * @return stylesheet children */ @@ -545,7 +546,7 @@ public void setItemBody(final ItemBody itemBody) { getNodeGroups().getItemBodyGroup().setItemBody(itemBody); } - /* + /** * Gets apipAccessibility child * * @return apipAccessibility child @@ -555,6 +556,10 @@ public ApipAccessibility getApipAccessibility() { return getNodeGroups().getApipAccessibilityGroup().getApipAccessibility(); } + public void setApipAccessibility(final ApipAccessibility apipAccessibility) { + getNodeGroups().getApipAccessibilityGroup().setApipAccessibility(apipAccessibility); + } + @Override public final String computeXPathComponent() { final String identifier = getIdentifier(); diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java index 473e70c5c..48d0237da 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/ModalFeedback.java @@ -36,9 +36,13 @@ import uk.ac.ed.ph.jqtiplus.attribute.enumerate.VisibilityModeAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; +import uk.ac.ed.ph.jqtiplus.group.accessibility.ApipAccessibilityGroup; import uk.ac.ed.ph.jqtiplus.group.content.FlowStaticGroup; +import uk.ac.ed.ph.jqtiplus.group.item.StylesheetGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.ContentContainer; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibilityBearer; import uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic; import uk.ac.ed.ph.jqtiplus.node.shared.VariableDeclaration; import uk.ac.ed.ph.jqtiplus.node.shared.VariableType; @@ -60,8 +64,9 @@ * interaction whilst displayed * * @author Jonathon Hare + * @author Zack Pierce */ -public class ModalFeedback extends AbstractNode implements ContentContainer { +public class ModalFeedback extends AbstractNode implements ContentContainer, ApipAccessibilityBearer { private static final long serialVersionUID = -3911613199124971014L; @@ -89,6 +94,8 @@ public ModalFeedback(final AssessmentItem parent) { getAttributes().add(new StringAttribute(this, ATTR_TITLE_NAME, null, false)); getNodeGroups().add(new FlowStaticGroup(this)); + getNodeGroups().add(new StylesheetGroup(this)); + getNodeGroups().add(new ApipAccessibilityGroup(this, false)); } /** @@ -201,4 +208,31 @@ public boolean isVisible(final ItemSessionController itemController) { return identifierCheck && getVisibilityMode().equals(VisibilityMode.SHOW_IF_MATCH) || !identifierCheck && getVisibilityMode().equals(VisibilityMode.HIDE_IF_MATCH); } + + /** + * Gets mutable list of stylesheet children. + * + * @return stylesheet children + */ + public List getStylesheets() { + return getNodeGroups().getStylesheetGroup().getStylesheets(); + } + + /** + * Gets apipAccessibility child + * + * @return apipAccessibility child + * @see #setApipAccessibility + */ + public ApipAccessibility getApipAccessibility() { + return getNodeGroups().getApipAccessibilityGroup().getApipAccessibility(); + } + + /** + * + * @param apipAccessibility + */ + public void setApipAccessibility(final ApipAccessibility apipAccessibility) { + getNodeGroups().getApipAccessibilityGroup().setApipAccessibility(apipAccessibility); + } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/Stylesheet.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/Stylesheet.java index bf7a7f133..1b109272f 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/Stylesheet.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/item/Stylesheet.java @@ -37,12 +37,13 @@ import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.UriAttribute; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; +import uk.ac.ed.ph.jqtiplus.node.QtiNode; import java.net.URI; /** - * Used to associate an external stylesheet with an assessmentItem. - * + * Used to associate an external stylesheet with an assessmentItem, assessmentTest, a rubricBlock within an assessmentSection, a feedback block, or a template block. + * * @author Jonathon Hare */ public class Stylesheet extends AbstractNode { @@ -64,7 +65,7 @@ public class Stylesheet extends AbstractNode { /** Name of title attribute in xml schema. */ public static final String ATTR_TITLE_NAME = "title"; - public Stylesheet(AssessmentItem parent) { + public Stylesheet(final QtiNode parent) { super(parent, QTI_CLASS_NAME); getAttributes().add(new UriAttribute(this, ATTR_HREF_NAME, true)); @@ -75,7 +76,7 @@ public Stylesheet(AssessmentItem parent) { /** * Gets value of href attribute. - * + * * @return value of href attribute * @see #setHref */ @@ -85,17 +86,17 @@ public URI getHref() { /** * Sets new value of href attribute. - * + * * @param href new value of href attribute * @see #getHref */ - public void setHref(URI href) { + public void setHref(final URI href) { getAttributes().getUriAttribute(ATTR_HREF_NAME).setValue(href); } /** * Gets value of type attribute. - * + * * @return value of type attribute * @see #setType */ @@ -105,17 +106,17 @@ public String getType() { /** * Sets new value of type attribute. - * + * * @param type new value of type attribute * @see #getType */ - public void setType(String type) { + public void setType(final String type) { getAttributes().getStringAttribute(ATTR_TYPE_NAME).setValue(type); } /** * Gets value of media attribute. - * + * * @return value of media attribute * @see #setMedia */ @@ -125,17 +126,17 @@ public String getMedia() { /** * Sets new value of media attribute. - * + * * @param media new value of media attribute * @see #getMedia */ - public void setMedia(String media) { + public void setMedia(final String media) { getAttributes().getStringAttribute(ATTR_MEDIA_NAME).setValue(media); } /** * Gets value of title attribute. - * + * * @return value of title attribute * @see #setTitle */ @@ -145,11 +146,11 @@ public String getTitle() { /** * Sets new value of title attribute. - * + * * @param title new value of title attribute * @see #getTitle */ - public void setTitle(String title) { + public void setTitle(final String title) { getAttributes().getStringAttribute(ATTR_TITLE_NAME).setValue(title); } } diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java index cfa95cba0..707aafc9d 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/node/test/TestFeedback.java @@ -38,10 +38,15 @@ import uk.ac.ed.ph.jqtiplus.attribute.value.IdentifierAttribute; import uk.ac.ed.ph.jqtiplus.attribute.value.StringAttribute; import uk.ac.ed.ph.jqtiplus.exception.QtiLogicException; +import uk.ac.ed.ph.jqtiplus.group.accessibility.ApipAccessibilityGroup; import uk.ac.ed.ph.jqtiplus.group.content.FlowStaticGroup; +import uk.ac.ed.ph.jqtiplus.group.item.StylesheetGroup; import uk.ac.ed.ph.jqtiplus.node.AbstractNode; import uk.ac.ed.ph.jqtiplus.node.ContentContainer; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibility; +import uk.ac.ed.ph.jqtiplus.node.accessibility.ApipAccessibilityBearer; import uk.ac.ed.ph.jqtiplus.node.content.basic.FlowStatic; +import uk.ac.ed.ph.jqtiplus.node.item.Stylesheet; import uk.ac.ed.ph.jqtiplus.node.shared.VariableDeclaration; import uk.ac.ed.ph.jqtiplus.node.shared.VariableType; import uk.ac.ed.ph.jqtiplus.state.TestSessionState; @@ -60,8 +65,9 @@ * @see TestFeedbackAccess * @see VisibilityMode * @author Jiri Kajaba + * @author Zack Pierce */ -public final class TestFeedback extends AbstractNode implements ContentContainer { +public final class TestFeedback extends AbstractNode implements ContentContainer, ApipAccessibilityBearer { private static final long serialVersionUID = 6567681516055125776L; @@ -93,6 +99,8 @@ public TestFeedback(final ControlObject parent) { getAttributes().add(new StringAttribute(this, ATTR_TITLE_NAME, false)); getNodeGroups().add(new FlowStaticGroup(this)); + getNodeGroups().add(new StylesheetGroup(this)); + getNodeGroups().add(new ApipAccessibilityGroup(this, false)); } @@ -197,4 +205,31 @@ public boolean isVisible(final TestSessionState testSessionState, final TestFeed ": " + getVisibilityMode()); } } + + /** + * Gets mutable list of stylesheet children. + * + * @return stylesheet children + */ + public List getStylesheets() { + return getNodeGroups().getStylesheetGroup().getStylesheets(); + } + + /** + * Gets apipAccessibility child + * + * @return apipAccessibility child + * @see #setApipAccessibility + */ + public ApipAccessibility getApipAccessibility() { + return getNodeGroups().getApipAccessibilityGroup().getApipAccessibility(); + } + + /** + * Sets apipAccessibility child + * @param apipAccessibility + */ + public void setApipAccessibility(final ApipAccessibility apipAccessibility) { + getNodeGroups().getApipAccessibilityGroup().setApipAccessibility(apipAccessibility); + } } diff --git a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java index f9f3f1d77..0b5b18573 100644 --- a/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java +++ b/qtiworks-jqtiplus/src/test/java/uk/ac/ed/ph/jqtiplus/node/accessibility/link/ContentLinkInfoTest.java @@ -76,6 +76,7 @@ public void before() { paragraph = new P(itemBody); itemBody.getNodeGroups().getBlockGroup().getChildren().add(paragraph); apipAccessibility = new ApipAccessibility(item); + item.setApipAccessibility(apipAccessibility); accessibilityInfo = new AccessibilityInfo(apipAccessibility); apipAccessibility.setAccessibilityInfo(accessibilityInfo); accessElement = new AccessElement(accessibilityInfo); From 994e65d09e576f2b10291e85d64d3680f095b54a Mon Sep 17 00:00:00 2001 From: Zachary Pierce Date: Thu, 19 Sep 2013 10:21:05 -0700 Subject: [PATCH 5/5] Correcting overlooked merge adjustment: the movement of ForeignElement up a namespace-level. --- .../src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java index 3fe03733b..e386febff 100644 --- a/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java +++ b/qtiworks-jqtiplus/src/main/java/uk/ac/ed/ph/jqtiplus/QtiProfile.java @@ -35,9 +35,9 @@ import uk.ac.ed.ph.jqtiplus.group.accessibility.AccessibilityNode; import uk.ac.ed.ph.jqtiplus.internal.util.ObjectUtilities; +import uk.ac.ed.ph.jqtiplus.node.ForeignElement; import uk.ac.ed.ph.jqtiplus.node.QtiNode; import uk.ac.ed.ph.jqtiplus.node.RootNode; -import uk.ac.ed.ph.jqtiplus.node.block.ForeignElement; import uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem; import uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseProcessing; import uk.ac.ed.ph.jqtiplus.node.outcome.declaration.OutcomeDeclaration;