Commit 7fc22c71 authored by Xiaoying Pu's avatar Xiaoying Pu

wired into Trial

parent 6870a34a
...@@ -138,9 +138,13 @@ public class DigitTaskFacade { ...@@ -138,9 +138,13 @@ public class DigitTaskFacade {
@Override @Override
public void run(EventType type) { public void run(EventType type) {
endRecallingDigit(); final boolean isCorrect = endRecallingDigit();
eventListenerList.stream().forEach((listener) -> { eventListenerList.stream().forEach((listener) -> {
listener.run(EventType.DIGITINPUT_FINISHED); if (isCorrect) {
listener.run(EventType.DIGITINPUT_FINISHED_CORRECT);
} else {
listener.run(EventType.DIGITINPUT_FINISHED_INCORRECT);
}
}); });
} }
} }
......
...@@ -15,5 +15,6 @@ public enum EventType { ...@@ -15,5 +15,6 @@ public enum EventType {
DIGITINPUT_TO_CONTROLLER, DIGITINPUT_TO_CONTROLLER,
UDPMSG_FROM_MT, UDPMSG_FROM_MT,
END_MULTI_DECISION, END_MULTI_DECISION,
DIGITINPUT_FINISHED; DIGITINPUT_FINISHED_CORRECT,
DIGITINPUT_FINISHED_INCORRECT;
} }
...@@ -37,8 +37,6 @@ public class Trial extends Thread { ...@@ -37,8 +37,6 @@ public class Trial extends Thread {
/* csv dump for digit recall */ /* csv dump for digit recall */
private Persistence writer; private Persistence writer;
private String templine = "";
/** /**
* The constructor * The constructor
*/ */
...@@ -99,12 +97,15 @@ public class Trial extends Thread { ...@@ -99,12 +97,15 @@ public class Trial extends Thread {
sFacade.startRecallingDigit(); sFacade.startRecallingDigit();
pFacade.endDecision(); pFacade.endDecision();
break; break;
case DIGITINPUT_FINISHED: case DIGITINPUT_FINISHED_CORRECT:
// TODO who calls the listener in this case?
// TODO: the counter may be happier if it lived here
// TODO: csv writing here // TODO: csv writing here
templine = ""; writer.put("correct");
writer.flush();
actionQueue.add(new ShowDigitAction(ActionType.START_HWL_DIGIT));
break;
case DIGITINPUT_FINISHED_INCORRECT:
writer.put("incorrect");
writer.flush();
actionQueue.add(new ShowDigitAction(ActionType.START_HWL_DIGIT)); actionQueue.add(new ShowDigitAction(ActionType.START_HWL_DIGIT));
break; break;
...@@ -195,14 +196,18 @@ public class Trial extends Thread { ...@@ -195,14 +196,18 @@ public class Trial extends Thread {
if (type == ActionType.START_HWL_DIGIT if (type == ActionType.START_HWL_DIGIT
|| type == ActionType.START_LWL_DIGIT) { || type == ActionType.START_LWL_DIGIT) {
WLState curState; WLState curState;
int id = aTask.getTaskID();
if (type == ActionType.START_HWL_DIGIT) { if (type == ActionType.START_HWL_DIGIT) {
writer.put("HWL");
curState = WLState.HIGH_WORKLOAD; curState = WLState.HIGH_WORKLOAD;
sFacade.showDigit(util.WLState.HIGH_WORKLOAD); sFacade.showDigit(util.WLState.HIGH_WORKLOAD);
} else { } else {
writer.put("LWL");
curState = WLState.LOW_WORKLOAD; curState = WLState.LOW_WORKLOAD;
sFacade.showDigit(util.WLState.LOW_WORKLOAD); sFacade.showDigit(util.WLState.LOW_WORKLOAD);
} }
writer.put(id);
// start UDP to MouseTracker // start UDP to MouseTracker
// go look at the mousetracker!!! // go look at the mousetracker!!!
......
...@@ -19,10 +19,10 @@ public class PersistenceTest { ...@@ -19,10 +19,10 @@ public class PersistenceTest {
@Test @Test
public void theWholeThing() { public void theWholeThing() {
for (int i = 0; i < 10; i++) { for (int id = 0; id < 10; id++) {
this.writer.initEntry(); this.writer.initEntry();
this.writer.put(2); this.writer.put("HWL");
this.writer.put(3); this.writer.put(id);
this.writer.put("correct"); this.writer.put("correct");
this.writer.flush(); this.writer.flush();
} }
......
time,digit_length,decision_id,response time,digit_length,decision_id,response
1448384635129,2,3,correct 1448389767015,HWL,0,correct
1448384635346,2,3,correct 1448389767175,HWL,1,correct
1448384635346,2,3,correct 1448389767176,HWL,2,correct
1448384635347,2,3,correct 1448389767176,HWL,3,correct
1448384635347,2,3,correct 1448389767176,HWL,4,correct
1448384635347,2,3,correct 1448389767177,HWL,5,correct
1448384635348,2,3,correct 1448389767177,HWL,6,correct
1448384635348,2,3,correct 1448389767177,HWL,7,correct
1448384635348,2,3,correct 1448389767177,HWL,8,correct
1448384635348,2,3,correct 1448389767177,HWL,9,correct
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment