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

16
LINES

< > BotCompany Repo | #1028240 // lineComp_replacePairWithUpdatingPairCount

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3450L/21K).

static L<Int> lineComp_replacePairWithUpdatingPairCount(IContentsIndexedList2<Int> l, Int pa, Int pb, Int y, LineComp_PairCounts pairCounts) {
  int i = 0;
  while (true) {
    i = indexOfIntPairInContentsIndexedList(l, pa, pb, i);
    if (i < 0) break;
    
    int to = i+2, to_new = i+1;

    pairCounts.removeAll(overlappingIntPairs(subList(l, i-1, to+1)));
    l.set(i, y);
    l.remove(i+1);
    pairCounts.addAll(overlappingIntPairs(subList(l, i-1, to_new+1)));
    i = to_new;
  }
  ret l;
}

Author comment

Began life as a copy of #1028216

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028240
Snippet name: lineComp_replacePairWithUpdatingPairCount
Eternal ID of this version: #1028240/3
Text MD5: ac090e2631bc90dce6461dc3cc1cb6d5
Transpilation MD5: 0b1fac0483d6d9f43a981994889b13fd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-27 21:50:42
Source code size: 514 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 88 / 151
Version history: 2 change(s)
Referenced in: [show references]