intervalccl

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.

Example:

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
y or Y : Canonical URL