Commit 802e1ac3 authored by Xiaoying Pu's avatar Xiaoying Pu

fixed some logic in Trial

parent 1a31cf32
......@@ -25,6 +25,10 @@ public class MouseTrackerFacade {
this.eventList = new ArrayList<>();
}
public void theFirstContact() {
this.theController.connect();
}
/**
*
*/
......
......@@ -54,6 +54,13 @@ public class PrimaryTaskController {
System.out.println("Decision started, waiting for response.. ");
}
public void connect() {
this.udpHandle.setUp();
}
/**
* Ha this method is not called anywhere
*/
public void run() {
new Thread(() -> {
......
package tracker;
import java.util.List;
import util.Task;
import util.Configurator;
import util.Task;
/**
*
......@@ -40,7 +40,7 @@ public class PrimaryTaskModel {
}
public void updateCurTask() {
this.curTask = new Task();
this.curTask = new Task(); // TODO WOT???????
}
public int gettTask() {
......
......@@ -22,10 +22,10 @@ public class UDPController {
private String messageToSend = "";
public UDPController() {
setUp();
//setUp(); NOTE: should not be called at init
}
private void setUp() {
public void setUp() {
initialWaitSignal();
startSignalFromThis();
startConfirmationFromMouseTracker();
......
......@@ -9,5 +9,6 @@ public enum ActionType {
START_HWL_DIGIT,
START_LWL_DIGIT,
QUIT_TRIAL,
CONNECT_UDP,
END_SHOWING_DIGIT;
}
......@@ -44,8 +44,7 @@ public class Trial extends Thread {
}
public void startTrial() {
actionQueue.add(new ShowDigitAction(ActionType.START_HWL_DIGIT));
actionQueue.add(new ConnectAction(ActionType.CONNECT_UDP));
}
@Override
......@@ -57,6 +56,7 @@ public class Trial extends Thread {
return;
}
System.out.println("-----------------------------I am running");
System.out.println(ac.getType());
ac.run();
}
try {
......@@ -88,6 +88,23 @@ public class Trial extends Thread {
}
}
class ConnectAction extends ProtoAction {
public ConnectAction(ActionType type) {
super(type);
}
@Override
public void run() {
pFacade.theFirstContact();
System.out.println("TRIAL OBJ: Connecting to UDP");
// until this is done.....
//TODO this should later be a functional with param = actiontype
//actionQueue.add(new ShowDigitAction(ActionType.START_HWL_DIGIT));
}
}
class QuitAction extends ProtoAction {
public QuitAction(ActionType type) {
......@@ -128,6 +145,7 @@ public class Trial extends Thread {
sFacade.endDigitShowing();
System.out.println("Digit should go away now");
// YOOOOOO the UDHHander constructor blocked!!!!!!!!!!
// TODO make that setup method public and give it an action type
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
......
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