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

41
LINES

< > BotCompany Repo | #1027437 // AI Musings CRUD (PhilosophyBot test cases)

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

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

!7

concept Musing {
  S text;
  S verificationResult;
  
  sS _fieldOrder = "text verificationResult";
}

cmodule AIMusingsCRUD > DynCRUD<Musing> {
  // API
  
  void storeMusing(S text) {
    storeMusing(text, null);
  }
  
  void storeMusing(S text, S verificationResult) {
    Musing m = uniq Musing(+text);
    if (nempty(verificationResult)) cset(m, +verificationResult);
    else
      dm_q(r { testMusing(m) });
  }
  
  void testMusing(Musing m) {
    if (m == null) ret;
    try {
      int n = ai_checkMusing(m.text);
      cset(m, verificationResult := "OK (" + n + ")");
    } catch print e {
      cset(m, verificationResult := "ERROR: " + exceptionToStringShort(e));
    }
  }
  
  start {
    crud.multiLineFields = litset("text");
  }
  
  afterVisualize {
    addSelectionDependentButton("Test", r { testMusing(selected()) });
  }
}

Author comment

Began life as a copy of #1027413

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: #1027437
Snippet name: AI Musings CRUD (PhilosophyBot test cases)
Eternal ID of this version: #1027437/7
Text MD5: 90926332d979ea5a37e91e6b16428b46
Transpilation MD5: 83d66dd14b423a4bfbf05bb0a073ffb2
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-20 16:31:22
Source code size: 890 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 263 / 876
Version history: 6 change(s)
Referenced in: #1027438 - dm_aiMusingsCRUD