Uses 911K of libraries. Click here for Pure Java version (11923L/62K).
!7 concept Scenario { S name; LS conditions; LS actions; } cmodule Scenarios > DynCRUD<Scenario> { transient Scenario selected; S answer(S s) null { print("answering: " + s); new Matches m; if "how many scenarios" ret str(countConcepts(Scenario)); if "delete scenario *" { S name = $1; setField(selected := null); if (nempty(deleteConceptsWhereCI Scenario(+name))) ret format("Scenario * deleted", name); else ret format("Scenario * not found", name); } if "new scenario *" { S name = $1; Scenario sc = conceptWhereCI Scenario(+name); if (sc != null) ret format("Scenario * exists", name); setField(selected := uniqCI Scenario(+name)); ret format("Scenario * created", name); } if "list scenarios" ret or2(joinWithComma(collect name(list(Scenario))), "No scenarios defined"); if "rename scenario * to *" { S name1 = $1, name2 = $2; if (!eqic(name1, name2) && conceptWhereCI Scenario(name := name2) != null) ret format("A scenario named * exists", name2); Scenario sc = conceptWhereCI Scenario(name := name1); if (sc == null) ret format("Scenario * not found", name1); cset(sc, name := name2); ret format("Scenario * renamed to *", name1, name2); } } afterVisualize { addComponent(crud.buttons, jbutton("Talk to me", rThread talkToMe)); } void talkToMe enter { dm_showConversationPopupForModule(); } }
Began life as a copy of #1027443
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: | #1027548 |
Snippet name: | Scenarios [backup v1 before undo] |
Eternal ID of this version: | #1027548/1 |
Text MD5: | 943185dd47bba7c0b4dba6685e9f1c2a |
Transpilation MD5: | 6d23402d57f1bed0e309247b88f0e109 |
Author: | stefan |
Category: | |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-23 18:05:41 |
Source code size: | 1573 bytes / 53 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 180 / 269 |
Referenced in: | -