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).

1  
static L<Int> lineComp_replacePairWithUpdatingPairCount(IContentsIndexedList2<Int> l, Int pa, Int pb, Int y, LineComp_PairCounts pairCounts) {
2  
  int i = 0;
3  
  while (true) {
4  
    i = indexOfIntPairInContentsIndexedList(l, pa, pb, i);
5  
    if (i < 0) break;
6  
    
7  
    int to = i+2, to_new = i+1;
8  
9  
    pairCounts.removeAll(overlappingIntPairs(subList(l, i-1, to+1)));
10  
    l.set(i, y);
11  
    l.remove(i+1);
12  
    pairCounts.addAll(overlappingIntPairs(subList(l, i-1, to_new+1)));
13  
    i = to_new;
14  
  }
15  
  ret l;
16  
}

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