Documentation
¶
Index ¶
- Variables
- type RangeEntry
- type RangeSet
- func (r *RangeSet[T]) Add(newEntry RangeEntry[T])
- func (r *RangeSet[T]) Contains(v T) bool
- func (r *RangeSet[T]) ContainsRange(rn RangeEntry[T]) bool
- func (r *RangeSet[T]) Get(idx int) (RangeEntry[T], error)
- func (r *RangeSet[T]) Items() []RangeEntry[T]
- func (r *RangeSet[T]) Iter() iter.Seq[RangeEntry[T]]
- func (r *RangeSet[T]) Len() int
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIndex = errors.New("index out of range of RangeSet")
Functions ¶
This section is empty.
Types ¶
type RangeEntry ¶
type RangeEntry[T any] struct { Start T End T }
type RangeSet ¶
type RangeSet[T any] struct { // the merged ranges Ranges *btree.BTreeG[RangeEntry[T]] // a three-way comparison function like strcmp; // 0 for equality, -1 for v1 < v2, 1 for v1 > v2 Compare func(v1, v2 T) int // a sentinel value indicating wrapping around from this value from the end to the start // if HasWrap is true and the final value is this, then any value sorting after it // is considered within the range RWrapV T // whether or not there is a "wraparound value" on the right side HasRWrap bool // contains filtered or unexported fields }
container for arbitrary ranges of values
func NewRangeset ¶ added in v1.1.0
func (*RangeSet[T]) Add ¶
func (r *RangeSet[T]) Add(newEntry RangeEntry[T])
add a range, potentially expanding or merging existing ranges
func (*RangeSet[T]) ContainsRange ¶
func (r *RangeSet[T]) ContainsRange(rn RangeEntry[T]) bool
func (*RangeSet[T]) Items ¶ added in v1.2.0
func (r *RangeSet[T]) Items() []RangeEntry[T]
Click to show internal directories.
Click to hide internal directories.