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

28
LINES

< > BotCompany Repo | #1010066 // Collapse backwards [node operation, OK if helper diagrams in editor]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 616K of libraries. Click here for Pure Java version (14693L/106K).

!759

sS inputDiagram1 = [[CirclesAndLines(circles=[Circle(quickvis="A pixel", text="A pixel", x=d("0.056195965417867436"), y=d("0.058027079303675046")), Circle(text="2-tuple", x=d("0.1988472622478386"), y=d("0.5241779497098646")), Circle(text="x coordinate", x=d("0.5072046109510087"), y=d("0.172147001934236")), Circle(text="y coordinate", x=d("0.5115273775216138"), y=d("0.5377176015473888")), Circle(text="an integer", x=d("0.69164265129683"), y=d("0.3481624758220503"))], imgZoom=d("1.0"), lines=[Arrow(a=t5, b=t30, text="is a"), Arrow(a=t30, b=t51, text="containing"), Arrow(a=t30, b=t72, text="containing"), Arrow(a=t51, b=t93, text="which is"), Arrow(a=t72, b=t93, text="which is")], translate=Pt(x=147, y=83))]];

sS inputDiagram2 = [[CirclesAndLines(circles=[Circle(text="collapse backwards", x=d("0.29827089337175794"), y=d("0.47775628626692457")), Circle(text="is a", x=d("0.670028818443804"), y=d("0.4700193423597679"))], imgZoom=d("1.0"), lines=[Arrow(a=t5, b=t26, text="")], translate=Pt(x=0, y=0))]];

sS inputDiagram3 = [[CirclesAndLines(circles=[Circle(text="containing", x=d("0.31988472622478387"), y=d("0.43133462282398455")), Circle(text="has", x=d("0.7334293948126801"), y=d("0.4274661508704062"))], imgZoom=d("1.0"), lines=[Arrow(a=t5, b=t26, text="replace with")])]];

p {
  Web web = webFromCALStructure(inputDiagram1);
  web_upper(web);
  final Web outWeb = web_cloneWeb(web);
  for (WebNode toCollapse : web_allForwardRelated(webFromCALStructure(inputDiagram2), "collapse backwards", ""))
    for (Pair<WebNode> p : web_relationsOfType(outWeb, toCollapse.text()))
      web_collapseNodeTo(p.b, p.a);
  web_performReplace(webFromCALStructure(inputDiagram3), outWeb);
  web_lower(outWeb);
  printWeb(outWeb);
  JTabbedPane tabs = showTabbedWebs("Input", web, "Output", outWeb);
  addToWindow(tabs, jcenteredline(
    jbutton("Make form", r {
      thread {
        L<Web> webs = concatLists(ll(outWeb), allWebsFromCE());
        O o = hotwire(#1010024);
        call(o, 'makeForm, quickExport(webs, o), "a pixel");
      }
    })));
}

Author comment

Began life as a copy of #1010048

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1010066
Snippet name: Collapse backwards [node operation, OK if helper diagrams in editor]
Eternal ID of this version: #1010066/33
Text MD5: 4452bb9f2a8f77d1313d9689cc2147ba
Transpilation MD5: ddb40e9f8c4500223501cbe84f126535
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-02 15:33:54
Source code size: 2086 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 630 / 1543
Version history: 32 change(s)
Referenced in: