feat: ajout des eventRegister dans le REPL

This commit is contained in:
Laureηt 2022-01-12 11:15:52 +01:00
parent efec8ad0a1
commit ce0c59d56d
No known key found for this signature in database
GPG key ID: D88C6B294FD40994
2 changed files with 20 additions and 2 deletions

10
.vscode/launch.json vendored
View file

@ -56,6 +56,16 @@
"4000" "4000"
], ],
"projectName": "Projet PDR" "projectName": "Projet PDR"
},
{
"type": "java",
"name": "Launch REPL",
"request": "launch",
"mainClass": "linda.test.REPL",
"args": [
"rmi://localhost:4000/linda"
],
"projectName": "Projet PDR"
} }
] ]
} }

View file

@ -10,10 +10,12 @@ import java.util.ArrayList;
import linda.Callback; import linda.Callback;
import linda.Tuple; import linda.Tuple;
import linda.Linda.eventTiming;
import linda.Linda.eventMode;
public class REPL implements Callback, Serializable { public class REPL implements Callback, Serializable {
public class MyCallback implements Callback { public static class MyCallback implements Callback {
public void call(Tuple t) { public void call(Tuple t) {
System.out.println("Tuple de l'event register : " + t); System.out.println("Tuple de l'event register : " + t);
} }
@ -111,7 +113,13 @@ public class REPL implements Callback, Serializable {
} }
System.out.println(" pris."); System.out.println(" pris.");
} else if (args[0].equals("evRI")) { } 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 { } else {
System.out.println("Il faut indiquer la commande et un tuple ! Ex : > r 1 S\n"); System.out.println("Il faut indiquer la commande et un tuple ! Ex : > r 1 S\n");
} }