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

33
LINES

< > BotCompany Repo | #1000640 - LHotwire (learner, plugs in other sources)

JavaX fragment (include)

static class LHotwire extends LearnerImpl {
  static boolean cacheSnippets = true;
  static new (Tree)Map<Long, Class> cache;
  
  static boolean debug;
  String programID;
  Class prog;

  *(String *programID) {}
  
  public void processInOut(Object in, Object out) {
  }
  
  public Object processIn(Object in) {
    if (prog == null) {
      prog = cache.get(parseSnippetID(programID));
      if (prog == null) {
        if (debug)
          debug("Loading " + programID);
        prog = hotwire(programID);
        if (cacheSnippets)
          cache.put(parseSnippetID(programID), prog);
      }
    }
    
    set(prog, "in", in);
    call(prog, "main", new Object[] {new String[0]});
    in = get(prog, "in");
    if (debug)
      debug(programID + " returned: " + structure(in));
    return in;
  }
}

Author comment

Began life as a copy of #1000532

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: #1000640
Snippet name: LHotwire (learner, plugs in other sources)
Eternal ID of this version: #1000640/1
Text MD5: b8f7746398d615e2893c13f1ec3866fb
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-21 00:28:08
Source code size: 841 bytes / 33 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 470 / 833
Referenced in: [show references]