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).

!7

sclass Transformed {
  S input, transformed;
  new LS madeBy;
}

compact module TransformedInput extends DynObjectTable<Transformed> {
  start {
    set fieldsInOrder;
    dm_onTopInput_q(voidfunc(S s) {
      setData(objectsWhere(getData(), input := s));
    });
  }
  
  // API
  
  void addEntry(S input, S transformed, S madeBy) {
    if (empty(transformed) || eq(input, transformed)
      || neq(input, dm_topInput())) ret;
    lock lock;
    Transformed l = objectWhere(getData(), +input, +transformed);
    bool nu = l == null;
    if (nu)
      l = nu(Transformed, +input, +transformed);
    setAdd(l.madeBy, madeBy);
    if (nu)
      add(l);
    else
      setData_force(data);
  }
}

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: 339 / 732
Version history: 8 change(s)
Referenced in: [show references]