beacon-biosignals / TimeSpans.jl

A Julia package that provides a `TimeSpan` type for representing a continuous span between two points in time.
Other
6 stars 2 forks source link

Add functionality to merge timespans in collections #21

Closed ararslan closed 2 years ago

ararslan commented 2 years ago

There are four distinct commits

  1. Add a two-argument shortest_timespan_containing method. It's not uncommon to want merge exactly two TimeSpans, but currently you have to wrap them in an interator in order to pass them to shortest_timespan_containing. This commit adds a method to the function that accepts two TimeSpans and otherwise does what it says on the tin. It is only part of this PR because I wanted to use it to implement the other functions.
  2. Define merge_spans!(predicate, spans), which merges the timespans in spans, modifying and resizing it in-place.
  3. Define merge_spans(predicate, spans) for an out-of-place analogue.
  4. Bump the patch version.