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

32
LINES

< > BotCompany Repo | #1020768 // Transformed Input

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

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

1  
!7
2  
3  
sclass Transformed {
4  
  S input, transformed;
5  
  new LS madeBy;
6  
}
7  
8  
compact module TransformedInput extends DynObjectTable<Transformed> {
9  
  start {
10  
    set fieldsInOrder;
11  
    dm_onTopInput_q(voidfunc(S s) {
12  
      setData(objectsWhere(getData(), input := s));
13  
    });
14  
  }
15  
  
16  
  // API
17  
  
18  
  void addEntry(S input, S transformed, S madeBy) {
19  
    if (empty(transformed) || eq(input, transformed)
20  
      || neq(input, dm_topInput())) ret;
21  
    lock lock;
22  
    Transformed l = objectWhere(getData(), +input, +transformed);
23  
    bool nu = l == null;
24  
    if (nu)
25  
      l = nu(Transformed, +input, +transformed);
26  
    setAdd(l.madeBy, madeBy);
27  
    if (nu)
28  
      add(l);
29  
    else
30  
      setData_force(data);
31  
  }
32  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020768
Snippet name: Transformed Input
Eternal ID of this version: #1020768/9
Text MD5: 4c96a82e087e50afc7d6dffc7e69d42f
Transpilation MD5: b9c32ecc7d437822064969ec11ef5e66
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-02 00:48:56
Source code size: 728 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 340 / 733
Version history: 8 change(s)
Referenced in: [show references]