abstract sclass DynPhilosophyBotTextArea extends DynTextArea { S output, logicRules, factsOut; int nFacts; bool enabled = true; transient PhilosophyBot1 bot; transient ReliableSingleThread rstRunProgram = dm_rst(this, r runProgram); transient JLabel lblStatus; transient ReliableSingleThread rstLogicRules = dm_rst(this, r showLogicRules); transient ReliableSingleThread rstFactsOut = dm_rst(this, r showFactsDeduced); visual jvsplit( jCenteredSection("Program", super), centerAndSouth( jhsplit( jCenteredSection("Output", dm_textArea_scrollDown_readOnly output()), jCenteredLiveValueSection(dm_calculatedLiveValue(S, () -> "Facts deduced (" + nFacts + ")"), dm_textArea_scrollDown_readOnly factsOut()) ), withLeftRightAndBottomMargin(centerAndEastWithMargin( jline(dm_checkBox enabled(), jThreadedButton("Save as test case", r saveAsTestCase)), lblStatus = jRightAlignedLabel())))); start { grabInterval = 1.0; dm_watchField text(rstRunProgram); dm_watchFieldAndNow enabled(rstRunProgram); } void runProgram { if (!enabled) ret; temp tempMiniLoadingAnim(); time { setField(output := hijackPrint(r { pcall { bot = new PhilosophyBot1(text); bot.printFactsAfterThinking = false; bot.onLogicRuleAdded.add(rule -> rstLogicRules.run()); bot.onFactAdded.add(f -> rstFactsOut.run()); pb_allStandardFeatures(bot); bot.run(); bot.checkExpectations(); } })); } main setText(lblStatus, lastTiming_formatted()); } void showLogicRules { setField(logicRules := joinWithEmptyLines(allToString(cloneList(bot.logicRules)))); } void showFactsDeduced { Cl facts = bot.factsDeduced(); setField(nFacts := l(facts)); setField(factsOut := lines(facts)); } void saveAsTestCase enter { dm_call(dm_aiMusingsCRUD(), 'storeMusing, getText()); } }