ginterval

package
v0.0.0-...-2bcc11b Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interval

type Interval struct {
	Min        *gnum.Decimal
	IncludeMin bool
	Max        *gnum.Decimal
	IncludeMax bool
}

func New

func New() *Interval

New infinite interval (-∞,+∞)

func Parse

func Parse(s string) (*Interval, error)

Parse interval string: [1,2] [100,+∞) (-∞,-1)

func (*Interval) Contains

func (i *Interval) Contains(n gnum.Decimal) bool

Check contains n or not.

func (*Interval) IsOverlap

func (i *Interval) IsOverlap(cmp Interval) bool

Check whether two intervals has overlapping area.

func (*Interval) SetMax

func (i *Interval) SetMax(max gnum.Decimal, includeMax bool) *Interval

Set interval right edge.

func (*Interval) SetMin

func (i *Interval) SetMin(min gnum.Decimal, includeMin bool) *Interval

Set interval left edge.

func (*Interval) String

func (i *Interval) String() string

Format interval to string.

Jump to

Keyboard shortcuts

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