Commit 1e887cbf authored by Xiaoying Pu's avatar Xiaoying Pu

added some >>>>lambda expr<<<<, or more threads... need more monitors to see both tasks tho

parent 1e278067
......@@ -60,24 +60,25 @@ public class PrimaryTaskController {
}
public void startDecision(WLState state) {
Runnable task = () -> {
while (!this.timeIsUp) {
String msg = this.theModel.getDecision(DecisionType.GETMIXATYPICAL, state.toString());
this.udpHandle.sendTrialAndRecvResponse(msg);
System.out.println("Decision started, waiting for response.. ");
}
while (!this.timeIsUp) {
String msg = this.theModel.getDecision(DecisionType.GETMIXATYPICAL, state.toString());
this.udpHandle.sendTrialAndRecvResponse(msg);
System.out.println("Decision started, waiting for response.. ");
}
//after some time, the facade interrupts and MouseTracker displays a break screen
// while the user recalls digits
// TODO: break also needs to wait for response message??????
String breakMsg = this.theModel.getDecision(DecisionType.GETBREAK, state.toString());
this.udpHandle.sendTrialAndRecvResponse(breakMsg);
//after some time, the facade interrupts and MouseTracker displays a break screen
// while the user recalls digits
// TODO: break also needs to wait for response message??????
String breakMsg = this.theModel.getDecision(DecisionType.GETBREAK, state.toString());
this.udpHandle.sendTrialAndRecvResponse(breakMsg);
};
new Thread(task).start();
}
public void endEntireExperiment(){
public void endEntireExperiment() {
this.udpHandle.endExperiment();
}
public void endDecision() {
this.timeIsUp = false;
......@@ -111,7 +112,7 @@ public class PrimaryTaskController {
// eventListenerList.stream().forEach((listener) -> {
// System.out.println("hey UDPListner is working\n");
// // TODO or type, right?
// // should have multiple MT trials run
// // should have multiple MT trials run
// // before telling the MouseTrackerFacade that it's done
// // like a counter here
// listener.run(EventType.END_MULTI_DECISION);
......
......@@ -81,9 +81,11 @@ public class Trial extends Thread {
@Override
public void run(EventType type) {
System.out.println("listener called");
switch (type) {
// Now the Trial should decide when the decision is done
// more of an action than response to listen to ...
case DECISION_FINISHED:
sFacade.startRecallingDigit();
break;
......@@ -190,7 +192,7 @@ public class Trial extends Thread {
// TODO why is this not sleeping/???/
System.out.println("WHY ARE YOU NOT SLEEPING");
actionQueue.add(new SleepForDecisions(ActionType.SLEEP_FOR_DECISIONS));
//pFacade.startAndWait(curState);
pFacade.startAndWait(curState);
}
int tTask = Configurator.gettSTask();
......
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