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).

!7

// wrapper object!
sclass Msg {
  O o; *() {} *(O *o) {}
  
  S text() { ret castGet(o, 'text); }
}

// wrapper object!
sclass ItemPage {
  O o; *() {} *(O *o) {}
  
  S title() { ret castGet(o, 'title); }
  L<Msg> comments() { ret mapWrap(Msg, (L) get(o, 'comments)); }
  
  void addComment(S text) {
    call(creator(), 'addProgramComment, programID(), o, text);
  }
}

svoid onItemPage(ItemPage page) {
  print("Found page: " + page.title());
  for (Msg c : page.comments()) 
    print("Found comment: " + c.text());
    
  page.addComment("Kilroy was here");
}

p {
  O main = creator();
  L pages = cast call(main, 'list, 'ItemPage);
  new Matches m;
  print(n(pages, "page"));
  lock parentDBLock();
  if (nempty(pages))
    onItemPage(ItemPage(last(pages)));
}

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: 340 / 781
Version history: 1 change(s)
Referenced in: [show references]