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

38
LINES

< > BotCompany Repo | #1009795 // Kilroy item page

JavaX module [tags: use-pretranspiled]

Download Jar. Libraryless. Click here for Pure Java version (1273L/9K/33K).

1  
!7
2  
3  
// wrapper object!
4  
sclass Msg {
5  
  O o; *() {} *(O *o) {}
6  
  
7  
  S text() { ret castGet(o, 'text); }
8  
}
9  
10  
// wrapper object!
11  
sclass ItemPage {
12  
  O o; *() {} *(O *o) {}
13  
  
14  
  S title() { ret castGet(o, 'title); }
15  
  L<Msg> comments() { ret mapWrap(Msg, (L) get(o, 'comments)); }
16  
  
17  
  void addComment(S text) {
18  
    call(creator(), 'addProgramComment, programID(), o, text);
19  
  }
20  
}
21  
22  
svoid onItemPage(ItemPage page) {
23  
  print("Found page: " + page.title());
24  
  for (Msg c : page.comments()) 
25  
    print("Found comment: " + c.text());
26  
    
27  
  page.addComment("Kilroy was here");
28  
}
29  
30  
p {
31  
  O main = creator();
32  
  L pages = cast call(main, 'list, 'ItemPage);
33  
  new Matches m;
34  
  print(n(pages, "page"));
35  
  lock parentDBLock();
36  
  if (nempty(pages))
37  
    onItemPage(ItemPage(last(pages)));
38  
}

Author comment

Began life as a copy of #1009784

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: #1009795
Snippet name: Kilroy item page
Eternal ID of this version: #1009795/2
Text MD5: 0b49bec781c7136b65e671ebc651ad38
Transpilation MD5: 21af223fd47a6c4c613d7a06ed668d35
Author: stefan
Category: javax / a.i.
Type: JavaX module
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-17 21:56:42
Source code size: 808 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 441 / 1060
Version history: 1 change(s)
Referenced in: [show references]