1 | static Object addToMultiPort_responder; |
2 | |
3 | static long addToMultiPort(final S botName) { |
4 | ret addToMultiPort(botName, new Object() { |
5 | public S answer(S s, L<S> history) { |
6 | S answer = cast callOpt(getMainClass(), "answer", s, history); |
7 | if (answer != null) ret answer; |
8 | answer = (S) callOpt(getMainClass(), "answer", s); |
9 | if (answer != null) ret answer; |
10 | if (match3("get injection id", s)) |
11 | ret getInjectionID(); |
12 | ret null; |
13 | } |
14 | }); |
15 | } |
16 | |
17 | static long addToMultiPort(final S botName, final O responder) { |
18 | //print(botName); |
19 | addToMultiPort_responder = responder; |
20 | startMultiPort(); |
21 | L ports = getMultiPorts(); |
22 | if (ports == null) ret 0; |
23 | if (ports.isEmpty()) |
24 | fail("No multiports!"); |
25 | if (ports.size() > 1) |
26 | print("Multiple multi-ports. Using last one."); |
27 | O port = last(ports); |
28 | O responder2 = new O() { |
29 | public S answer(S s, L<S> history) { |
30 | if (match3("get injection id", s)) |
31 | ret getInjectionID(); |
32 | if (match3("your name", s)) |
33 | ret botName; |
34 | ret (S) call(responder, "answer", s, history); |
35 | } |
36 | }; |
37 | record(responder2); |
38 | ret (Long) call(port, "addResponder", botName, responder2); |
39 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001676 |
Snippet name: | addToMultiPort |
Eternal ID of this version: | #1001676/1 |
Text MD5: | 229e21fbd4739db4c9e18351f69c5cca |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-10 17:38:06 |
Source code size: | 1213 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 736 / 1932 |
Referenced in: | [show references] |