intervalst

package
v1.0.0-preview.23 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 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 Entry added in v0.16.0

type Entry[T any] struct {
	Interval Interval
	Value    T
}

type Interval

type Interval struct {
	Min, Max Position
}

func NewInterval

func NewInterval(min, max Position) Interval

func (Interval) Compare

func (i Interval) Compare(other Interval) int

func (Interval) Contains

func (i Interval) Contains(x Position) bool

func (Interval) Intersects

func (i Interval) Intersects(other Interval) bool

func (Interval) String

func (i Interval) String() string

type IntervalST

type IntervalST[T any] struct {
	// contains filtered or unexported fields
}

func (*IntervalST[T]) Contains

func (t *IntervalST[T]) Contains(interval Interval) bool

func (*IntervalST[T]) Get

func (t *IntervalST[T]) Get(interval Interval) (T, bool)

func (*IntervalST[T]) Put

func (t *IntervalST[T]) Put(interval Interval, value T)

Put associates an interval with a value.

NOTE: does *not* check if the interval already exists

func (*IntervalST[T]) Search

func (t *IntervalST[T]) Search(p Position) (*Interval, T, bool)

func (*IntervalST[T]) SearchAll added in v0.16.0

func (t *IntervalST[T]) SearchAll(p Position) []Entry[T]

func (*IntervalST[T]) SearchInterval

func (t *IntervalST[T]) SearchInterval(interval Interval) (*Interval, T, bool)

func (*IntervalST[T]) Values

func (t *IntervalST[T]) Values() []T

type MinPosition

type MinPosition struct{}

func (MinPosition) Compare

func (MinPosition) Compare(other Position) int

type Position

type Position interface {
	Compare(other Position) int
}

Jump to

Keyboard shortcuts

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