Version: v0.0.0-...-bf59245 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2017 License: Apache-2.0 Imports: 2 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Covering

type Covering []Range

Covering represents a non-overlapping, but possibly non-contiguous, set of intervals.

func (Covering) Len

func (c Covering) Len() int

func (Covering) Less

func (c Covering) Less(i, j int) bool

func (Covering) Swap

func (c Covering) Swap(i, j int)

type Range

type Range struct {
	Start   []byte
	End     []byte
	Payload interface{}

Range is an interval with a payload.

func OverlapCoveringMerge

func OverlapCoveringMerge(coverings []Covering) []Range

OverlapCoveringMerge returns the set of intervals covering every range in the input such that no output range crosses an input endpoint. The payloads are returned as a `[]interface{}` and in the same order as they are in coverings.


covering 1: [1, 2) -> 'a', [3, 4) -> 'b', [6, 7) -> 'c'
covering 2: [1, 5) -> 'd'
output: [1, 2) -> 'ad', [2, 3) -> `d`, [3, 4) -> 'bd', [4, 5) -> 'd', [6, 7) -> 'c'

The input is mutated (sorted). It is also assumed (and not checked) to be valid (e.g. non-overlapping intervals in each covering).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL