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

17
LINES

< > BotCompany Repo | #1012354 // ai_tripleToWebNode

JavaX fragment (include)

1  
static WebNode ai_tripleToWebNode(TripleWeb w, Symbol searchTerm, int occurrence) {
2  
  if (w == null) null;
3  
  ifdef ai_tripleToWebNode_debug
4  
    print("ai_tripleToWebNode: " + sfu(w) + ", searchTerm=" + quote(searchTerm) + ", occurrence=" + occurrence);
5  
  endifdef
6  
  Web web = webFromTripleWeb(w);
7  
  try {
8  
    for (int i = 0; i < l(web.nodes); i++) 
9  
      if (eqic(web_sym(web.nodes.get(i)), searchTerm)) {
10  
        if (occurrence-- == 0) ret web.nodes.get(i);
11  
      }
12  
    null;
13  
  } catch e {
14  
    print("ai_tripleToWebNode: " + e + " " + sfu(w) + " => " + webToStringShort(web));
15  
    throw rethrow(e);
16  
  }
17  
}

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