diff --git a/modules/core_wm_modules/default_backward_digit_span.xml b/modules/core_wm_modules/default_backward_digit_span.xml new file mode 100755 index 0000000..b63ed72 --- /dev/null +++ b/modules/core_wm_modules/default_backward_digit_span.xml @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BackwardDigitSpanInstructions.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + endOfModule.htm + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/jms/cogtasks/executables/BackwardDigitSpan.java b/src/main/java/jms/cogtasks/executables/BackwardDigitSpan.java new file mode 100644 index 0000000..756216c --- /dev/null +++ b/src/main/java/jms/cogtasks/executables/BackwardDigitSpan.java @@ -0,0 +1,52 @@ +package jms.cogtasks.executables; + +import ch.tatool.core.data.*; +import ch.tatool.core.display.swing.status.StatusPanel; +import ch.tatool.core.display.swing.status.StatusRegionUtil; +import ch.tatool.data.Trial; +import ch.tatool.exec.ExecutionOutcome; + +public class BackwardDigitSpan extends WordDigitSpan{ + public void processProperties() { + int stimulus_num = numbers[numbers.length - (respCounter+1)]; + correctResponseDigits = Integer.valueOf(stimulus_num); + Question.getResponseProperty().setValue(this, givenResponseDigits); + Question.setQuestionAnswer(this, String.valueOf(stimulus_num), correctResponseDigits); + + + Boolean success = correctResponseDigits == givenResponseDigits; + loadProperty.setValue(this, numbers.length); + + Points.setZeroOneMinMaxPoints(this); + Points.setZeroOnePoints(this, success); + Result.getResultProperty().setValue(this, success); + + if (respCounter < (numbers.length - 1)) { + Misc.getOutcomeProperty().setValue(this, ExecutionOutcome.SUSPENDED); + } else { + Misc.getOutcomeProperty().setValue(this, ExecutionOutcome.FINISHED); + } + + trialNoProperty.setValue(this, trialCounter + 1); + + // change feedback status panel + changeStatusPanelOutcome(success); + + // set duration time property + long duration = 0; + if (endTime > 0) { + duration = endTime - startTime; + } + long ms = (long) duration / 1000000; + Timing.getDurationTimeProperty().setValue(this, ms); + + if (getExecutionContext() != null) { + Misc.getOutcomeProperty().setValue(getExecutionContext(), ExecutionOutcome.FINISHED); + } + + // create new trial and store all executable properties in the trial + Trial currentTrial = getExecutionContext().getExecutionData().addTrial(); + currentTrial.setParentId(getId()); + DataUtils.storeProperties(currentTrial, this); + } +} diff --git a/src/main/java/jms/cogtasks/executables/WordDigitSpan.java b/src/main/java/jms/cogtasks/executables/WordDigitSpan.java index dde8c4e..8c4cb1e 100644 --- a/src/main/java/jms/cogtasks/executables/WordDigitSpan.java +++ b/src/main/java/jms/cogtasks/executables/WordDigitSpan.java @@ -60,7 +60,7 @@ public class WordDigitSpan extends BlockingAWTExecutable implements private RegionsContainer regionsContainer; String current_user; - private int StimuliType = 0; //set this using the XML, 1 for digits, 2 for words.// + protected int StimuliType = 0; //set this using the XML, 1 for digits, 2 for words.// final Font treb = new Font("Trebuchet MS", 1, 26); final Color fontColor = new Color(0,51,102); @@ -73,8 +73,8 @@ public enum Phase { private Phase currentPhase; //properties of interest// - private IntegerProperty loadProperty = new IntegerProperty("load"); - private IntegerProperty trialNoProperty = new IntegerProperty("trialNo"); + protected IntegerProperty loadProperty = new IntegerProperty("load"); + protected IntegerProperty trialNoProperty = new IntegerProperty("trialNo"); //panels// private CenteredTextPanel displayPanel; @@ -88,8 +88,8 @@ public enum Phase { private static int interResponseDuration = 1000; //blank screen between recalls// //stimuli// - private int[] numbers; //if digit span// - private String[] words; //if word span// + protected int[] numbers; //if digit span// + protected String[] words; //if word span// private ArrayList wordBank = new ArrayList(); //method will fill this arraylist with words from an external file// private String WordBankFileName = ""; private Random rand; @@ -110,13 +110,13 @@ public enum Phase { //should the list length be ordered presentation or randomised private int randomisedTrials = 0; //default is 0 which is for in sequence, set to 1 in the XML for randomised order. - private int trialCounter = 0; + protected int trialCounter = 0; private int memCounter; //counts memoranda presented per trial// - private int respCounter; //counts responses given// - private int correctResponseDigits; //if digit span// - private String correctResponseWord; //if word span// - private int givenResponseDigits; //if digit span// - private String givenResponseWord; //if word span// + protected int respCounter; //counts responses given// + protected int correctResponseDigits; //if digit span// + protected String correctResponseWord; //if word span// + protected int givenResponseDigits; //if digit span// + protected String givenResponseWord; //if word span// /* * need an indicator as to whether this executable is being used to run a simple span task @@ -125,8 +125,8 @@ public enum Phase { private int ComplexSpan = 0; //"0" by default, this will be the code for simple span, "1" if complex.// - private long startTime; - private long endTime; + protected long startTime; + protected long endTime; /* * constructor @@ -359,7 +359,7 @@ public void run() { } - private void processProperties() { + public void processProperties() { switch (StimuliType) { case 1: int stimulus_num = numbers[respCounter]; @@ -435,7 +435,7 @@ private void processProperties() { * Tatool should take care of feedback if I have set the variables and asked for a * feedback status panel....look into this. */ - private void changeStatusPanelOutcome(Boolean value) { + public void changeStatusPanelOutcome(Boolean value) { StatusPanel panelFeedback = StatusRegionUtil.getStatusPanel(StatusPanel.STATUS_PANEL_OUTCOME); if (panelFeedback != null) { if (value == null) { diff --git a/src/main/resources/jms/cogtasks/instructions/BackwardDigitSpan/BackwardDigitSpanInstructions.html b/src/main/resources/jms/cogtasks/instructions/BackwardDigitSpan/BackwardDigitSpanInstructions.html new file mode 100644 index 0000000..fcdac0f --- /dev/null +++ b/src/main/resources/jms/cogtasks/instructions/BackwardDigitSpan/BackwardDigitSpanInstructions.html @@ -0,0 +1,37 @@ + + + + + + +
+
Backward Digit Span
+ +
+

Instructions

+

Presentation Phase

+
+ This is the backward digit span task, a task that involves the presentation of a series of numbers (between 1-99) that you + must remember. A trial will consist of between 2 and 7 numbers for you to remember. They will be shown one at a time in the center of the screen. +
+
+ +
+

Recall Phase

+
+ After all the numbers in a given trial have been presented to you it is your turn: type in the numbers you + remember seeing backwards. It is important to remember to type them backwards, + that is, if you saw 21 33 54, then you should type first 54, then 33, and then 21. The program will ask for + one number at a time (the message "Number 1: " etc) and you must type it in and press enter to submit it. +
+
+ +
+
+
+ Press the right arrow key on your + keyboard to start the task. +
+
+ +