273
}
274
275
>
func (s *SliceImpl) CompactWithSlice(slice Slice) Slice {
slice.go
276
>
s.stateSanityCheck()
277
>
278
>
incomingSlice, ok := slice.(*SliceImpl)
279
>
if !ok {
280
panic(fmt.Sprintf("Unable to compact queue slice of type %T with type %T", s, slice))
281
}
282
>
incomingSlice.stateSanityCheck()
slice.go
283
>
284
>
compactedScope := NewScope(
285
>
NewRange(
286
>
tasks.MinKey(s.scope.Range.InclusiveMin, incomingSlice.scope.Range.InclusiveMin),
287
>
tasks.MaxKey(s.scope.Range.ExclusiveMax, incomingSlice.scope.Range.ExclusiveMax),
288
>
),
289
>
tasks.OrPredicates(s.scope.Predicate, incomingSlice.scope.Predicate),
290
>
)
291
>
292
>
compactedTaskTracker := s.merge(incomingSlice.executableTracker)
293
>
compactedIterators := s.mergeIterators(incomingSlice)
294
>
295
>
s.destroy()
296
>
incomingSlice.destroy()
297
>
298
>
return s.newSlice(
299
>
compactedScope,
300
>
compactedIterators,
301
>
compactedTaskTracker,
302
>
)
303
}
304