bitvector

package module
v0.0.0-...-e3c616e Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 4 Imported by: 3

README

BitVector

Go Go Report Card Read the Docs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitVector

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

func NewBitVector

func NewBitVector(length int) *BitVector

Allocates space to hold the length of bit. All of the values in the BitVector are set to false.

func NewBitVectorFromBool

func NewBitVectorFromBool(values []bool) *BitVector

Allocates space to hold the values from the booleans.

func NewBitVectorFromVector

func NewBitVectorFromVector(vector BitVector) *BitVector

Allocates a new BitVector with the same length and bit values as vector.

func NewBitVectorFromVectorPadStart

func NewBitVectorFromVectorPadStart(vector *BitVector, padding int) *BitVector

Allocates a new BitVector padded with the same length and values as the vector but left shifted by the padding.

func NewBitVectorOfLength

func NewBitVectorOfLength(length int, defaultBit bool) *BitVector

Allocates space to hold the length of bit. All of the values in the BitVector are set to defaultBit.

func (*BitVector) And

func (s *BitVector) And(vector *BitVector)

ANDed with vector.

func (*BitVector) Concat

func (s *BitVector) Concat(vectors []*BitVector) *BitVector

func (*BitVector) Copy

func (s *BitVector) Copy(vector *BitVector, indexStart, indexEnd int)

func (*BitVector) Enumerate

func (s *BitVector) Enumerate() *BitVectorIterator

func (*BitVector) EnumerateFromOffset

func (s *BitVector) EnumerateFromOffset(indexStart, indexEnd int) *BitVectorIterator

func (BitVector) Get

func (s BitVector) Get(index int) bool

Returns the bit value at position index.

func (*BitVector) Length

func (s *BitVector) Length() int

func (*BitVector) Not

func (s *BitVector) Not()

Inverts all the bit values. On/true bit values are converted to off/false. Off/false bit values are turned on/true.

func (*BitVector) Or

func (s *BitVector) Or(vector *BitVector)

ORed with vector.

func (*BitVector) Rank

func (s *BitVector) Rank(bit bool, offset int) int

Rank counts the number of true or false (depending on what the bit is set to) in the bitvector but not including the offset

func (*BitVector) Resize

func (s *BitVector) Resize(length int)

func (*BitVector) Select

func (s *BitVector) Select(bit bool, rank int) int

find the offset of true or false (depending on what the bit is set to) from the rank (number of times the bit occurs)

func (BitVector) Set

func (s BitVector) Set(index int, bit bool)

Sets the bit value at position index to value.

func (*BitVector) SetAll

func (s *BitVector) SetAll(bit bool)

Sets all the bit values to value.

func (BitVector) String

func (s BitVector) String() string

func (*BitVector) TrueBits

func (s *BitVector) TrueBits() int

func (*BitVector) Xor

func (s *BitVector) Xor(vector *BitVector)

XORed with vector.

type BitVectorIterator

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

func NewBitVectorIteratorWithOffset

func NewBitVectorIteratorWithOffset(vector *BitVector, indexStart, indexEnd int) *BitVectorIterator

func (*BitVectorIterator) HasNext

func (s *BitVectorIterator) HasNext() bool

func (*BitVectorIterator) Next

func (s *BitVectorIterator) Next() (bool, int)

func (*BitVectorIterator) Reset

func (s *BitVectorIterator) Reset()

Jump to

Keyboard shortcuts

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