bitmap

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 3 Imported by: 73

Documentation

Overview

Package bitmap provides a []bool/bitmap implementation with standardized iteration. Bitmaps are the equivalent of []bool, with improved compression for runs of similar values, and faster operations on ranges and the like.

Index

Constants

View Source
const MaxInt = -1

Variables

View Source
var ToEnd int = -1

Functions

This section is empty.

Types

type BitIndex

type BitIndex = int

type Bitmap

type Bitmap struct {
	RB *roaring.Bitmap
}

Bitmaps store the existence of values in [0,math.MaxUint32] more efficiently than []bool. The empty value starts with no bits set.

func Flip

func Flip(bm Bitmap, start, end int) Bitmap

func Sub

func Sub(left, right Bitmap) Bitmap

func (*Bitmap) Add

func (me *Bitmap) Add(is ...BitIndex)

func (*Bitmap) AddRange

func (me *Bitmap) AddRange(begin, end BitIndex)

func (*Bitmap) Clear

func (me *Bitmap) Clear()

func (*Bitmap) Contains

func (me *Bitmap) Contains(i int) bool

func (Bitmap) Copy

func (me Bitmap) Copy() (ret Bitmap)

func (*Bitmap) FlipRange

func (me *Bitmap) FlipRange(begin, end BitIndex)

func (*Bitmap) Get

func (me *Bitmap) Get(bit BitIndex) bool

func (Bitmap) IsEmpty

func (me Bitmap) IsEmpty() bool

func (Bitmap) Iter

func (me Bitmap) Iter(cb iter.Callback)

func (Bitmap) IterTyped

func (me Bitmap) IterTyped(f func(int) bool) bool

Returns true if all values were traversed without early termination.

func (*Bitmap) Len

func (me *Bitmap) Len() int

The number of set bits in the bitmap. Also known as cardinality.

func (*Bitmap) Remove

func (me *Bitmap) Remove(i BitIndex) bool

func (*Bitmap) RemoveRange

func (me *Bitmap) RemoveRange(begin, end BitIndex) *Bitmap

func (*Bitmap) Set

func (me *Bitmap) Set(bit BitIndex, value bool)

func (*Bitmap) Sub

func (me *Bitmap) Sub(other Bitmap)

func (Bitmap) ToSortedSlice

func (me Bitmap) ToSortedSlice() (ret []int)

func (*Bitmap) Union

func (me *Bitmap) Union(other Bitmap)

type Interface

type Interface interface {
	Len() int
}

type Iter

type Iter struct {
	// contains filtered or unexported fields
}

func (*Iter) Next

func (me *Iter) Next() bool

func (*Iter) Stop

func (me *Iter) Stop()

func (*Iter) Value

func (me *Iter) Value() interface{}

func (*Iter) ValueInt

func (me *Iter) ValueInt() int

Jump to

Keyboard shortcuts

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