interval

package
v0.0.0-...-d8be82f Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sort

func Sort(intervals []I)

Sort sorts a slice of intervals by start (and then end, for equal starts).

Types

type I

type I [2]int

I represents an (inclusive) interval.

func New

func New(start, end int) I

New creates a new Interval, given start and end.

func (I) Adjacent

func (i I) Adjacent(other I) bool

Adjacent checks if this interval is right next to the other.

func (I) Contains

func (i I) Contains(other I) bool

Contains checks if this interval completely contains the other.

func (I) Merge

func (i I) Merge(other I) I

Merge takes two intervals, and returns one new one that stretches from the lowest number in either to the highest number in either.

func (I) Overlaps

func (i I) Overlaps(other I) bool

Overlap checks if this interval overlaps with the other.

func (I) String

func (i I) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL