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

11
LINES

< > BotCompany Repo | #1008650 // walkStringTreeToLeaf

JavaX fragment (include)

// -1 if no matching leaf found, otherwise number of steps to get there
static int walkStringTreeToLeaf(StringTree1 tree, L<S> items) {
  int i = 0;
  while (tree != null && i < l(items)) {
    if (tree.leaf)
      ret i;
    tree = tree.children.get(items.get(i));
    ++i;
  }
  ret -1;
}

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: #1008650
Snippet name: walkStringTreeToLeaf
Eternal ID of this version: #1008650/1
Text MD5: c8812d5de4414ed1762071abc3b3705c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-26 19:34:11
Source code size: 300 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 403 / 430
Referenced in: [show references]