Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

28
LINES

< > BotCompany Repo | #1001701 // makeResponder

JavaX fragment (include)

1  
static S makeResponder_callAnswerMethod(O bot, S s, L<S> history) {
2  
  S answer = (S) callOpt(bot, "answer", s, history);
3  
  if (answer == null)
4  
    answer = (S) callOpt(bot, "answer", s);
5  
  return answer;
6  
}
7  
8  
static Responder makeResponder(final O bot) {
9  
  if (bot instanceof Responder) ret (Responder) bot;
10  
  
11  
  if (bot instanceof S) {
12  
    S f = cast bot;
13  
    ret new Responder {
14  
      public S answer(S s, L<S> history) {
15  
        S answer = (S) callOptMC((S) bot, s, history);
16  
        if (answer == null)
17  
          answer = (S) callOptMC((S) bot, s);
18  
        return answer;
19  
      }
20  
    };
21  
  }
22  
  
23  
  ret new Responder {
24  
    public S answer(S s, L<S> history) {
25  
      return makeResponder_callAnswerMethod(bot, s, history);
26  
    }
27  
  };
28  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001701
Snippet name: makeResponder
Eternal ID of this version: #1001701/3
Text MD5: 0480dd2bb6c2ef495e4d9fe1de507562
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-01 15:53:58
Source code size: 760 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 713 / 1028
Version history: 2 change(s)
Referenced in: [show references]