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

47
LINES

< > BotCompany Repo | #1028956 // Loaded Standard Functions

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (12970L/68K).

1  
!7
2  
3  
concept FunctionDef {
4  
  S functionName;
5  
  S snippetID;
6  
}
7  
8  
cmodule LoadedStandardFunctions > DynCRUD<FunctionDef> {
9  
  transient Map<S, Class> loadedBlobs = syncMap(); // snippetID -> main class
10  
  transient S status;
11  
  
12  
  start {
13  
    dbIndexing FunctionDef('functionName);
14  
    updateStatus();
15  
  }
16  
  
17  
  visual centerAndSouth(super, withLeftRightAndTopMargin(dm_centeredLabel status()));
18  
  
19  
  Class getBlob(S _snippetID, S forFunction) {
20  
    S snippetID = fsI(_snippetID);
21  
    Class _blob = loadedBlobs.get(snippetID);
22  
    if (_blob != null) ret _blob;
23  
    ret dm_evalInQ(() -> {
24  
      Class blob = loadedBlobs.get(snippetID);
25  
      if (blob == null) {
26  
        print("Hotwiring " + snippetID + " for function " + forFunction);
27  
        loadedBlobs.put(snippetID, blob = hotwireDependent(snippetID));
28  
        updateStatus();
29  
      }
30  
      ret blob;
31  
    });
32  
  }
33  
  
34  
  void updateStatus {
35  
    setField(status := n2(loadedBlobs, "loaded blob"));
36  
  }
37  
  
38  
  // API
39  
  
40  
  ObjectPlusMethodName getFunction(S name) {
41  
    FunctionDef def = conceptWhere FunctionDef(functionName := name);
42  
    if (def == null) null;
43  
    O blob = getBlob(def.snippetID, name);
44  
    if (blob == null) null;
45  
    ret ObjectPlusMethodName(blob, name);
46  
  }
47  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028956
Snippet name: Loaded Standard Functions
Eternal ID of this version: #1028956/6
Text MD5: 86ee8801a97913c2a90588b8fb65bb9d
Transpilation MD5: 8439787d9d7ea5c7e690d7e04d9a2e01
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-13 23:44:39
Source code size: 1265 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 200 / 557
Version history: 5 change(s)
Referenced in: [show references]