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

44
LINES

< > BotCompany Repo | #1025938 // Philosophy Bot Text Area v2 [with logic rules list]

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

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

!7

cmodule PhilosophyBotTextArea > DynTextArea {
  S output, logicRules;
  transient PhilosophyBot1 bot;
  transient ReliableSingleThread rstRunProgram = dm_rst(this, r runProgram);
  transient JLabel lblStatus;
  transient ReliableSingleThread rstLogicRules = dm_rst(this, r showLogicRules);
  
  visual jvsplit(
    jCenteredSection("Program", super),
    centerAndSouth(
      jhsplit(
        jCenteredSection("Output", dm_textArea_scrollDown_readOnly output()),
        jCenteredSection("Logic rules",
          dm_textArea_scrollDown_readOnly logicRules())
      ),
      withRightMargin(lblStatus = jRightAlignedLabel())));
  
  start {
    grabInterval = 1.0;
    dm_watchFieldAndNow text(rstRunProgram);
  }
  
  void runProgram {
    temp tempMiniLoadingAnim();
    time {
      setField(output := hijackPrint(r {
        pcall {
          bot = new PhilosophyBot1(text);
          bot.onLogicRuleAdded.add(rule -> rstLogicRules.run());
          bot.standardImports();
          bot.run();
          bot.checkExpectations();
        }
      }));
    }
    main setText(lblStatus, lastTiming_formatted());
  }
  
  void showLogicRules {
    setField(logicRules := joinWithEmptyLines(allToString(cloneList(bot.logicRules)));
  }
}

Author comment

Began life as a copy of #1025777

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: #1025938
Snippet name: Philosophy Bot Text Area v2 [with logic rules list]
Eternal ID of this version: #1025938/9
Text MD5: cca068e175925663a37d171435316684
Transpilation MD5: 6b132a29c08e63ceb988624f120f5ea3
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-01 13:33:33
Source code size: 1283 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 144 / 1337
Version history: 8 change(s)
Referenced in: [show references]