| 114 | } |
| 115 | |
| 116 | protected static CoreCount sum(List<CoreCount> cores) { |
| 117 | ImmutableList.Builder<Id> idBuilder = new ImmutableList.Builder<Id>(); |
| 118 | ImmutableList.Builder<Integer> countBuilder = new ImmutableList.Builder<Integer>(); |
| 119 | ImmutableSet.Builder<PlanFragmentId> fragmentIdBuilder = |
| 120 | new ImmutableSet.Builder<PlanFragmentId>(); |
| 121 | boolean hasPlanRootSink = false; |
| 122 | for (CoreCount coreRequirement : cores) { |
| 123 | idBuilder.addAll(coreRequirement.ids_); |
| 124 | countBuilder.addAll(coreRequirement.counts_); |
| 125 | fragmentIdBuilder.addAll(coreRequirement.uniqueFragmentIds_); |
| 126 | hasPlanRootSink |= coreRequirement.hasPlanRootSink_; |
| 127 | } |
| 128 | return new CoreCount(idBuilder.build(), countBuilder.build(), |
| 129 | fragmentIdBuilder.build(), hasPlanRootSink); |
| 130 | } |
| 131 | |
| 132 | protected static CoreCount sum(CoreCount core1, CoreCount core2) { |
| 133 | return sum(ImmutableList.of(core1, core2)); |