sclass WebNode implements _SetField { Web web; O labels; public void _setField(S f, O x) { if (f.equals('web)) web = (Web) x; else if (f.equals('labels)) labels = (L) x; } void _doneLoading { if (labels instanceof L) labels = smallestList_fromList(map_lispHead((L) labels)); } *() {} *(Web *web) { web.fireNewNode(this); } final O rawLabels() { ret labels; } void addLabel(S label) { labels = smallestList_add(rawLabels(), label); } void addLabel(Lisp label) { addLabel(web.unparseLabel(label)); } void addLabels(Collection<Lisp> l) { for (Lisp lbl : l) addLabel(lbl); } void addStrings(Collection<S> l) { for (S lbl : l) addLabel(lbl); } bool hasLabel(Lisp label) { ret hasLabel(web.unparseLabel(label)); } bool hasLabel(S label) { ret smallestList_contains(rawLabels(), label); } toString { ret smallestList_l(rawLabels()) == 1 ? str(smallestList_first(rawLabels())) : str(smallestList_toList(rawLabels())); } int count() { ret 1 + smallestList_l(rawLabels()); } final S text() { ret (S) smallestList_first(rawLabels()); } final L<S> texts() { ret smallestList_toList(rawLabels()); } void relation(S arrow, S b) { web.getRelation(this, web.node(b)).addLabel(arrow); } Lisp parseLabel(S l) { ret web.parseLabel(l); } S unparseLabel(Lisp l) { ret web.unparseLabel(l); } L<Lisp> labels() { ret web.parseLabels(texts()); } bool hasLabels() { ret smallestList_nempty(rawLabels()); } void setLabel(int i, Lisp l) { labels = smallestList_set(rawLabels(), i, web.unparseLabel(l)); } O visInfo() { ret null; } void visInfo(O o) {} }
Began life as a copy of #1012305
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1012306 |
Snippet name: | WebNode with SmallestList<S> labels, no visInfo |
Eternal ID of this version: | #1012306/9 |
Text MD5: | dfe7ffea09a9f0d2b07309943811a475 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-11-27 22:58:56 |
Source code size: | 1710 bytes / 54 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 469 / 490 |
Version history: | 8 change(s) |
Referenced in: | -