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

22
LINES

< > BotCompany Repo | #1007817 // xyzToNewIDs - replace X, Y, Z etc. with new ids

JavaX fragment (include)

static S xyzToNewIDs(S s) {
  ret xyzToNewIDs(s, (L<S>) null);
}

static S xyzToNewIDs(S s, L<S> varCollector) {
  L<S> tok = javaTok(s);
  int n = numberOfXYZVars(tok);
  for (int i = 1; i <= n; i++) {
    S var = xyzIndexToVar(i);
    if (tok.contains(var))
      replace(tok, var, addAndReturn(varCollector, aGlobalID()));
  }
  ret join(tok);
}

static S xyzToNewIDs(S s, S... varsToReplace) {
  L<S> tok = javaTok(s);
  for (S var : varsToReplace)
    if (tok.contains(var))
      replace(tok, var, aGlobalID());
  ret join(tok);
}

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: #1007817
Snippet name: xyzToNewIDs - replace X, Y, Z etc. with new ids
Eternal ID of this version: #1007817/8
Text MD5: 14a38e5ae174d358a238e532d5f44f82
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-30 00:16:15
Source code size: 557 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 563 / 557
Version history: 7 change(s)
Referenced in: [show references]