Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
func Diff[P any, S Segment[P], StepT comparable, D Diffabble[P, StepT]]( haves []S, needs []S, step StepT, diff D, ) []S
Diff compares haves to needs and returns a []Segments missing from needs. Both haves and needs must be sorted by start value. This operates on segment boundaries in O(N+M) time rather than iterating individual timestamps.
Types ¶
type Diffabble ¶
type Diffabble[P any, StepT any] interface { Add(a P, step StepT) P Less(a, b P) bool Equal(a, b P) bool Zero() P Neg(step StepT) StepT }
Diffabble is a named type of a slice of an implementation of Segment that can be passed into Difference() as diff D
type Segment ¶
type Segment[U any] interface { StartVal() U EndVal() U NewSegment(start, end U) Segment[U] String() string }
Segment represents a range with inclusive Start/End points of type U.
Click to show internal directories.
Click to hide internal directories.