| 532 | } |
| 533 | |
| 534 | static TFlatPairsInfo GetPairsSubset( |
| 535 | TConstArrayRef<TPair> pairs, |
| 536 | const TObjectsGrouping& objectsGrouping, |
| 537 | const TObjectsGroupingSubset& objectsGroupingSubset |
| 538 | ) { |
| 539 | TVector<TMaybe<ui32>> srcToDstObjectIndices(objectsGrouping.GetObjectCount()); |
| 540 | objectsGroupingSubset.GetObjectsIndexing().ForEach( |
| 541 | [&srcToDstObjectIndices] (ui32 idx, ui32 srcIdx) { srcToDstObjectIndices[srcIdx] = idx; } |
| 542 | ); |
| 543 | |
| 544 | TFlatPairsInfo result; |
| 545 | for (const auto& pair : pairs) { |
| 546 | const auto& maybeDstWinnerId = srcToDstObjectIndices[pair.WinnerId]; |
| 547 | if (!maybeDstWinnerId) { |
| 548 | continue; |
| 549 | } |
| 550 | const auto& maybeDstLoserId = srcToDstObjectIndices[pair.LoserId]; |
| 551 | if (!maybeDstLoserId) { |
| 552 | continue; |
| 553 | } |
| 554 | result.emplace_back(*maybeDstWinnerId, *maybeDstLoserId, pair.Weight); |
| 555 | } |
| 556 | return result; |
| 557 | } |
| 558 | |
| 559 | |
| 560 | struct TSrcToDstGroupMap { |
no test coverage detected