Documentation ¶
Overview ¶
A variable sized compact vector of bits which supports lookups, sets, appends, insertions, and deletions.
Index ¶
- type BitVector
- func (vector *BitVector) Append(bit byte)
- func (vector *BitVector) Bytes() []byte
- func (vector *BitVector) Delete(index int)
- func (vector *BitVector) Element(i int) byte
- func (vector *BitVector) Insert(bit byte, index int)
- func (vector *BitVector) Length() int
- func (vector *BitVector) Set(bit byte, index int)
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
}
A BitVector is a variable sized vector of bits. It supports lookups, sets, appends, insertions, and deletions.
This class is not thread safe.
func NewBitVector ¶
NewBitVector creates and initializes a new bit vector with length elements, using data as its initial contents.
func (*BitVector) Bytes ¶
Bytes returns a slice of the contents of the bit vector. If the caller changes the returned slice, the contents of the bit vector may change.
func (*BitVector) Delete ¶
Delete removes the bit in the supplied index of the bit vector. All bits in positions greater than or equal to index before the call will be shifted down by one.
func (*BitVector) Element ¶
Element returns the bit in the ith index of the bit vector. Returned value is either 1 or 0.
func (*BitVector) Insert ¶
Insert inserts bit into the supplied index of the bit vector. All bits in positions greater than or equal to index before the call will be shifted up by one.