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

41
LINES

< > BotCompany Repo | #1028755 // Compare Scenarios [OK]

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

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

1  
cprint {
2  
  S scenario1 = autoUnindent_mls([[
3  
    There is a plan
4  
    The plan works
5  
  ]]);
6  
7  
  S scenario2 = autoUnindent_mls([[
8  
    There is this idea
9  
    This idea is a plan
10  
    This idea works
11  
  ]]);
12  
13  
  NLABlock nla1, nla2;
14  
  S output;
15  
  
16  
  visual jvsplit(
17  
    jhsplit(
18  
      hgridWithSpacing(
19  
        jCenteredSection("Scenario 1 (in Natural Language Assembly)", dm_textAreaAsSection scenario1()),
20  
        jCenteredSection("Scenario 2 (in Natural Language Assembly)", dm_textAreaAsSection scenario2())),
21  
      dm_textAreaAsSection output()),
22  
    super);
23  
  
24  
  start {
25  
    dm_onFieldChange scenario1(r calc);
26  
    dm_onFieldChangeAndNow scenario2(r calc);
27  
  }
28  
29  
  void calc {
30  
    setField(nla1 := nla_simplifyIntroductions(scenario1));
31  
    setField(nla2 := nla_simplifyIntroductions(scenario2));
32  
    printWithIndent("nla1: ", nla1);
33  
    printWithIndent("nla2: ", nla2);
34  
    
35  
    L<Map<NLABlock.Entity>> mappings = nla_partialMappings(nla1, nla2);
36  
    if (empty(mappings))
37  
      setField(output := "Scenarios incompatible");
38  
    else
39  
      setField(output := "Scenarios compatible:\n\n" + lines(mappings));
40  
  }
41  
}

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: #1028755
Snippet name: Compare Scenarios [OK]
Eternal ID of this version: #1028755/10
Text MD5: 1236b7ecb756cc27709509267e9ee755
Transpilation MD5: 6389f795eba5295d537e379c405c8281
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-07 01:33:38
Source code size: 1150 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 550
Version history: 9 change(s)
Referenced in: [show references]