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

wired into Trial

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