Version: v0.0.0-...-e009dfb Latest Latest

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 4 Imported by: 0




This section is empty.


This section is empty.


func OverlappedPairs

func OverlappedPairs(as []Interval) (pairs [][2]int)


type Interval

type Interval struct {
	Min int `json:"min"`
	Max int `json:"max"`

Axioms: if (min >= max) it is empty interval if interval contains x than (min <= x < max)

var ZI Interval // Zero Interval

func Ivl

func Ivl(min, max int) Interval

Ivl is shorthand for Interval{Min, Max}

func Parse

func Parse(s string) (v Interval, err error)

func (Interval) Add

func (a Interval) Add(d int) Interval

func (Interval) Contains

func (a Interval) Contains(v int) bool

func (Interval) Empty

func (a Interval) Empty() bool

func (Interval) Equal

func (a Interval) Equal(b Interval) bool

func (Interval) MarshalText

func (v Interval) MarshalText() (text []byte, err error)

func (Interval) Overlaps

func (a Interval) Overlaps(b Interval) bool

func (Interval) Split

func (a Interval) Split(count int) []Interval

func (Interval) String

func (a Interval) String() string

func (Interval) Sub

func (a Interval) Sub(d int) Interval

func (*Interval) UnmarshalText

func (p *Interval) UnmarshalText(text []byte) error

func (Interval) Width

func (a Interval) Width() int

type StringFormatter

type StringFormatter struct {
	MinClosed bool
	MaxClosed bool

func (StringFormatter) Format

func (sf StringFormatter) Format(v Interval) string

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