Uses 911K of libraries. Click here for Pure Java version (11923L/62K).
1 | !7 |
2 | |
3 | concept Scenario { |
4 | S name; |
5 | LS conditions; |
6 | LS actions; |
7 | } |
8 | |
9 | cmodule Scenarios > DynCRUD<Scenario> { |
10 | transient Scenario selected; |
11 | |
12 | S answer(S s) null { |
13 | print("answering: " + s); |
14 | new Matches m; |
15 | if "how many scenarios" |
16 | ret str(countConcepts(Scenario)); |
17 | if "delete scenario *" { |
18 | S name = $1; |
19 | setField(selected := null); |
20 | if (nempty(deleteConceptsWhereCI Scenario(+name))) |
21 | ret format("Scenario * deleted", name); |
22 | else |
23 | ret format("Scenario * not found", name); |
24 | } |
25 | if "new scenario *" { |
26 | S name = $1; |
27 | Scenario sc = conceptWhereCI Scenario(+name); |
28 | if (sc != null) |
29 | ret format("Scenario * exists", name); |
30 | setField(selected := uniqCI Scenario(+name)); |
31 | ret format("Scenario * created", name); |
32 | } |
33 | if "list scenarios" |
34 | ret or2(joinWithComma(collect name(list(Scenario))), "No scenarios defined"); |
35 | if "rename scenario * to *" { |
36 | S name1 = $1, name2 = $2; |
37 | if (!eqic(name1, name2) |
38 | && conceptWhereCI Scenario(name := name2) != null) |
39 | ret format("A scenario named * exists", name2); |
40 | Scenario sc = conceptWhereCI Scenario(name := name1); |
41 | if (sc == null) |
42 | ret format("Scenario * not found", name1); |
43 | cset(sc, name := name2); |
44 | ret format("Scenario * renamed to *", name1, name2); |
45 | } |
46 | } |
47 | |
48 | afterVisualize { |
49 | addComponent(crud.buttons, jbutton("Talk to me", rThread talkToMe)); |
50 | } |
51 | |
52 | void talkToMe enter { dm_showConversationPopupForModule(); } |
53 | } |
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: | 181 / 270 |
Referenced in: | [show references] |