Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
288 changes: 288 additions & 0 deletions modules/core_wm_modules/default_backward_digit_span.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">


<!-- +++++++++++++++++++++++++++++++++++++++ -->
<!-- MODULE SETTINGS -->
<!-- +++++++++++++++++++++++++++++++++++++++ -->

<!--######################################################### MODULE: PROPERTIES #########################################################-->
<bean id="moduleProperties" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="module.name" value="Backward Digit Span" />
<entry key="module.version" value="1" />
<entry key="module.author" value="James Stone (corrupted by John Gamboa)" />
<entry key="module.description" value="Java implementation of the digit span task" />
<entry key="module.execution.display.classname" value="ch.tatool.core.display.swing.SwingExecutionDisplayProvider" />
<entry key="module.execution.initializer.classname" value="ch.tatool.core.module.initializer.SpringExecutorInitializer" />
<entry key="module.execution.display.regionsContainer" value="true" />
<entry key="module.scheduler.classname" value="ch.tatool.core.module.scheduler.AlwaysAllowModuleScheduler" />
<entry key="module.info.classname" value="ch.tatool.app.gui.ModuleInfoPanel" />
</map>
</property>
</bean>
<!--######################################################################################################################################-->



<!--######################################################## MODULE: EXPORTERS ########################################################-->
<bean id="moduleExporters" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="localExporter">
<bean class="ch.tatool.app.export.FileDataExporter">
<property name="incrementalExport" value="false" />
<property name="autoExport" value="false" />
</bean>
</entry>
</map>
</property>
</bean>
<!--######################################################################################################################################-->






<!-- ########################################################################################### -->
<!-- ########################################################################################### -->
<!--############################ GENERAL SETTINGS ############################-->
<!-- ########################################################################################### -->
<!-- ########################################################################################### -->

<!-- KEYBOARD HANDLER -->
<bean id="keyHandler" class="ch.tatool.core.element.handler.EscapeKeyEventHandler">
<property name="allowEscapeKey" value="true" /> <!-- allow user to exit module by pressing ESCAPE key -->
</bean>

<!-- STATUS PANEL ON -->
<bean id="status_panel_on"
class="ch.tatool.core.display.swing.status.DefaultModuleStatusRegionConfigurator">
<property name="panels">
<list>
<util:constant
static-field="ch.tatool.core.display.swing.status.StatusPanel.STATUS_PANEL_OUTCOME" />
<util:constant
static-field="ch.tatool.core.display.swing.status.StatusPanel.STATUS_PANEL_TRIAL" />
<util:constant
static-field="ch.tatool.core.display.swing.status.StatusPanel.STATUS_PANEL_CUSTOM_ONE" />
<!-- for the username to be displayed-->
</list>
</property>
</bean>

<!-- STATUS PANEL OFF -->
<bean id="status_panel_off"
class="ch.tatool.core.display.swing.status.DefaultModuleStatusRegionConfigurator">
<property name="panels">
<list>
</list>
</property>
</bean>

<!--######################################################################################################################################-->






<!-- ########################################################################################### -->
<!-- ########################################################################################### -->
<!--############################ ITERATOR SETTINGS ############################-->
<!-- ########################################################################################### -->
<!-- ########################################################################################### -->

<!-- TASK ITERATORS -->

<bean id="ds_iterator" class="ch.tatool.core.element.IteratedListSelector">
<!-- number of iterations -->
<property name="numIterations" value="1" />
<!-- this value will be overwritten by the executable as it is calculated based on
how many of each span size trial you request -->
</bean>


<!--######################################################################################################################################-->








<!-- ########################################################################################### -->
<!-- ########################################################################################### -->
<!--############################ TASK SETTINGS ############################-->
<!-- ########################################################################################### -->
<!-- ########################################################################################### -->

<!-- Digit Span Executable -->
<bean id="digit_span" class="jms.cogtasks.executables.BackwardDigitSpan" >

<!-- Don't edit these-->
<property name="ComplexSpan" value="0" />
<property name="StimuliType" value="1" />

<!-- These are customisable-->
<property name="spanTwoTrials" value="3" /> <!-- how many trials of span size 2 would you like? -->
<property name="spanThreeTrials" value="3" /> <!-- how many trials of span size 3 would you like? -->
<property name="spanFourTrials" value="3" /> <!-- how many trials of span size 4 would you like? -->
<property name="spanFiveTrials" value="3" /> <!-- how many trials of span size 5 would you like? -->
<property name="spanSixTrials" value="3" /> <!-- how many trials of span size 6 would you like? -->
<property name="spanSevenTrials" value="3" /> <!-- how many trials of span size 7 would you like? -->
<property name="spanEightTrials" value="0" /> <!-- how many trials of span size 8 would you like? -->
<property name="spanNineTrials" value="0" /> <!-- how many trials of span size 9 would you like? -->
<property name="randomisedTrials" value="0" />
<!-- if this is set to 0 then the trial order is not randomised, all span size two trials will be administered,
then span size three, four, five ... etc.
If set to 1 then the order is randomised -->
<property name="minDigit" value="1" />
<property name="maxDigit" value="99" />
<!-- These two values define the range of the digits that can be selected to be stimuli in the trials, you
may want 1-99, 10-99, 1-9 etc... -->
</bean>

<!--######################################################################################################################################-->








<!-- ########################################################################################### -->
<!-- ########################################################################################### -->
<!--############################ MODULE HIERARCHY ############################-->
<!-- ########################################################################################### -->
<!-- ########################################################################################### -->

<bean id="moduleHierarchy" class="ch.tatool.core.element.ListElement">

<property name="handlers">
<list>
<bean id="main_iterator" class="ch.tatool.core.element.IteratedListSelector" />
<bean
class="ch.tatool.core.element.handler.pause.DefaultExecutionPauseHandler">
<!-- interval between elements in milliseconds -->
<property name="defaultInterElementPauseDuration" value="250" />
</bean>
<bean class="ch.tatool.core.element.handler.ExecutionFeedbackHandler" />
<bean class="ch.tatool.core.element.handler.StatusPanelStateHandler">
<property name="resetIds">
<list>
<util:constant static-field="ch.tatool.core.display.swing.status.StatusPanel.STATUS_PANEL_OUTCOME" />
</list>
</property>
<property name="enableIds">
<list>
<util:constant static-field="ch.tatool.core.display.swing.status.StatusPanel.STATUS_PANEL_OUTCOME" />
<util:constant static-field="ch.tatool.core.display.swing.status.StatusPanel.STATUS_PANEL_TRIAL" />
<util:constant static-field="ch.tatool.core.display.swing.status.StatusPanel.STATUS_PANEL_CUSTOM_ONE" />
</list>
</property>
<property name="phase">
<util:constant static-field="ch.tatool.exec.ExecutionPhase.PRE_PROCESS" />
</property>
</bean>
<ref bean="keyHandler" />
</list>
</property>

<property name="children">
<list>

<bean class="ch.tatool.core.element.ExecutableElement">
<property name="executable">
<bean class="jms.cogtasks.helperClasses.CodeExecutable" />
</property>
</bean>

<!-- ORDER OF EXECUTION: INSTRUCTIONS - TASK BEGINS - END SCREEN -->
<!-- instructions -->
<bean class="ch.tatool.core.element.ExecutableElement">
<property name="executable">
<bean class="jms.cogtasks.helperClasses.HTMLExecutable">
<property name="base" value="/jms/cogtasks/instructions/BackwardDigitSpan/" /> <!-- file location within the .jar -->
<property name="pages">
<list>
<value>BackwardDigitSpanInstructions.html</value>
<!-- refers to a html file that is contained within the app, this could be changed if you
so wished but you would need to download the source code, edit the instructions and then
compile the app with your instructions file in the resources -->
</list>
</property>
</bean>
</property>
</bean>

<!-- main task -->
<bean id="list" class="ch.tatool.core.element.ListElement">

<property name="handlers">
<list>
<ref bean="ds_iterator" /> <!-- using the bean we defined earlier, with the iterator properties selected -->
</list>
</property>

<property name="children">
<list>

<!-- status panel on -->
<bean class="ch.tatool.core.element.ExecutableElement">
<property name="executable">
<ref bean="status_panel_on" /> <!-- using the bean we defined earlier, with the s-panel properties selected -->
</property>
</bean>

<bean class="ch.tatool.core.element.ExecutableElement">
<property name="id" value="exec" />
<property name="handlers">
<list>
<bean class="ch.tatool.core.element.handler.TrialCountHandler" />
<bean class="ch.tatool.core.element.handler.DefaultTrialCountEvaluator" />
</list>
</property>
<property name="executable">
<ref bean="digit_span" /> <!-- using the bean we defined earlier, with the task properties selected -->
</property>
</bean>

</list>
</property>
</bean>

<!-- status panel off -->
<bean class="ch.tatool.core.element.ExecutableElement">
<property name="executable">
<ref bean="status_panel_off" />
</property>
</bean>

<!-- END -->
<bean class="ch.tatool.core.element.ExecutableElement">
<property name="executable">
<bean class="ch.tatool.core.executable.HTMLExecutable">
<property name="base" value="/jms/cogtasks/instructions/" />
<property name="pages">
<list>
<value>endOfModule.htm</value>
</list>
</property>
</bean>
</property>
</bean>

</list>
</property>

</bean>

</beans>
52 changes: 52 additions & 0 deletions src/main/java/jms/cogtasks/executables/BackwardDigitSpan.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading