ginterval

package
v0.0.0-...-04ff805 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 5 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        *gdecimal.Decimal
	IncludeMin bool
	Max        *gdecimal.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 gdecimal.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 gdecimal.Decimal, includeMax bool) *Interval

Set interval right edge.

func (*Interval) SetMin

func (i *Interval) SetMin(min gdecimal.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