feat: ajout des eventRegister dans le REPL
This commit is contained in:
parent
efec8ad0a1
commit
ce0c59d56d
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
|
@ -56,6 +56,16 @@
|
|||
"4000"
|
||||
],
|
||||
"projectName": "Projet PDR"
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Launch REPL",
|
||||
"request": "launch",
|
||||
"mainClass": "linda.test.REPL",
|
||||
"args": [
|
||||
"rmi://localhost:4000/linda"
|
||||
],
|
||||
"projectName": "Projet PDR"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -10,10 +10,12 @@ import java.util.ArrayList;
|
|||
|
||||
import linda.Callback;
|
||||
import linda.Tuple;
|
||||
import linda.Linda.eventTiming;
|
||||
import linda.Linda.eventMode;
|
||||
|
||||
public class REPL implements Callback, Serializable {
|
||||
|
||||
public class MyCallback implements Callback {
|
||||
public static class MyCallback implements Callback {
|
||||
public void call(Tuple t) {
|
||||
System.out.println("Tuple de l'event register : " + t);
|
||||
}
|
||||
|
@ -111,7 +113,13 @@ public class REPL implements Callback, Serializable {
|
|||
}
|
||||
System.out.println(" pris.");
|
||||
} else if (args[0].equals("evRI")) {
|
||||
lc.even
|
||||
lc.eventRegister(eventMode.READ, eventTiming.IMMEDIATE, t, new MyCallback());
|
||||
} else if (args[0].equals("evRF")) {
|
||||
lc.eventRegister(eventMode.READ, eventTiming.FUTURE, t, new MyCallback());
|
||||
} else if (args[0].equals("evTI")) {
|
||||
lc.eventRegister(eventMode.TAKE, eventTiming.IMMEDIATE, t, new MyCallback());
|
||||
} else if (args[0].equals("evTF")) {
|
||||
lc.eventRegister(eventMode.TAKE, eventTiming.FUTURE, t, new MyCallback());
|
||||
} else {
|
||||
System.out.println("Il faut indiquer la commande et un tuple ! Ex : > r 1 S\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue