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

17
LINES

< > BotCompany Repo | #1012354 // ai_tripleToWebNode

JavaX fragment (include)

static WebNode ai_tripleToWebNode(TripleWeb w, Symbol searchTerm, int occurrence) {
  if (w == null) null;
  ifdef ai_tripleToWebNode_debug
    print("ai_tripleToWebNode: " + sfu(w) + ", searchTerm=" + quote(searchTerm) + ", occurrence=" + occurrence);
  endifdef
  Web web = webFromTripleWeb(w);
  try {
    for (int i = 0; i < l(web.nodes); i++) 
      if (eqic(web_sym(web.nodes.get(i)), searchTerm)) {
        if (occurrence-- == 0) ret web.nodes.get(i);
      }
    null;
  } catch e {
    print("ai_tripleToWebNode: " + e + " " + sfu(w) + " => " + webToStringShort(web));
    throw rethrow(e);
  }
}

Author comment

Began life as a copy of #1012332

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: #1012354
Snippet name: ai_tripleToWebNode
Eternal ID of this version: #1012354/8
Text MD5: 830655337c54e39480a360387f3e887c
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-10 07:24:30
Source code size: 621 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 428 / 440
Version history: 7 change(s)
Referenced in: [show references]