Documentation ¶
Index ¶
- Constants
- type FiniteBitVector
- func (vec *FiniteBitVector) Clear()
- func (vec *FiniteBitVector) Contains(vec2 *FiniteBitVector) bool
- func (vec *FiniteBitVector) Count() (count int)
- func (vec *FiniteBitVector) Equals(vec2 *FiniteBitVector) bool
- func (vec *FiniteBitVector) FindNext(index int) int
- func (vec *FiniteBitVector) IntersectWith(vec2 *FiniteBitVector)
- func (vec *FiniteBitVector) IntersectWithComplement(vec2 *FiniteBitVector)
- func (vec *FiniteBitVector) IntersectionSize(vec2 *FiniteBitVector) int
- func (vec *FiniteBitVector) Set(key uint)
- func (vec *FiniteBitVector) String() string
- func (vec *FiniteBitVector) Test(key uint) bool
- func (vec *FiniteBitVector) TestAndSet(key uint) bool
- func (vec *FiniteBitVector) TestAndUnset(key uint) bool
- func (vec *FiniteBitVector) UnionAndIntersectionSize(vec2 *FiniteBitVector) (int, int)
- func (vec *FiniteBitVector) UnionWith(vec2 *FiniteBitVector)
- func (vec *FiniteBitVector) Unset(key uint)
- type KeyType
- type SparseBitVector
- func (sbv *SparseBitVector) Clear()
- func (sbv *SparseBitVector) Contains(sbv2 *SparseBitVector) bool
- func (sbv *SparseBitVector) Count() int
- func (sbv *SparseBitVector) Equals(sbv2 *SparseBitVector) bool
- func (sbv *SparseBitVector) IntersectWith(sbv2 *SparseBitVector)
- func (sbv *SparseBitVector) IntersectWithComplement(sbv2 *SparseBitVector)
- func (sbv *SparseBitVector) IntersectionSize(sbv2 *SparseBitVector) int
- func (sbv *SparseBitVector) Iterate() <-chan KeyType
- func (sbv *SparseBitVector) Set(key KeyType)
- func (sbv *SparseBitVector) String() string
- func (sbv *SparseBitVector) Test(key KeyType) bool
- func (sbv *SparseBitVector) TestAndSet(key KeyType) bool
- func (sbv *SparseBitVector) UnionAndIntersectionSize(sbv2 *SparseBitVector) (int, int)
- func (sbv *SparseBitVector) UnionSize(sbv2 *SparseBitVector) int
- func (sbv *SparseBitVector) UnionWith(sbv2 *SparseBitVector)
- func (sbv *SparseBitVector) Unset(key KeyType)
Constants ¶
const ElementSize = bitsperword * wordsperelement
ElementSize is the number of bits per FiniteBitVector
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FiniteBitVector ¶
type FiniteBitVector [wordsperelement]elementwordtype
FiniteBitVector provides a bit vector of length elementsize.
func NewFiniteBitVector ¶
func NewFiniteBitVector(set ...uint) *FiniteBitVector
NewFiniteBitVector initializes a FiniteBitVector from the given elements.
func (*FiniteBitVector) Clear ¶
func (vec *FiniteBitVector) Clear()
Clear sets all bits in the Element to false.
func (*FiniteBitVector) Contains ¶
func (vec *FiniteBitVector) Contains(vec2 *FiniteBitVector) bool
Contains returns true iff vec contains all of vec2's true bits.
func (*FiniteBitVector) Count ¶
func (vec *FiniteBitVector) Count() (count int)
Count returns the number of true bits within the ELement.
func (*FiniteBitVector) Equals ¶
func (vec *FiniteBitVector) Equals(vec2 *FiniteBitVector) bool
Equals returns true iff vec and vec2 contain equivalent true bits.
func (*FiniteBitVector) FindNext ¶
func (vec *FiniteBitVector) FindNext(index int) int
FindNext retruns the next true bit starting from index, or -1 if none exist. The initial call should pass index 0. Successive calls should pass previous+1.
func (*FiniteBitVector) IntersectWith ¶
func (vec *FiniteBitVector) IntersectWith(vec2 *FiniteBitVector)
IntersectWith sets vec to the intersection of itself and vec2.
func (*FiniteBitVector) IntersectWithComplement ¶
func (vec *FiniteBitVector) IntersectWithComplement(vec2 *FiniteBitVector)
IntersectWithComplement sets vec to the intersection of itself and ~vec2.
func (*FiniteBitVector) IntersectionSize ¶
func (vec *FiniteBitVector) IntersectionSize(vec2 *FiniteBitVector) int
IntersectionSize returns the number of true bits of the intersection with vec2.
func (*FiniteBitVector) String ¶
func (vec *FiniteBitVector) String() string
func (*FiniteBitVector) Test ¶
func (vec *FiniteBitVector) Test(key uint) bool
Test returns true iff the given bit is true.
func (*FiniteBitVector) TestAndSet ¶
func (vec *FiniteBitVector) TestAndSet(key uint) bool
TestAndSet sets a bit to true and returns true iff it was changed.
func (*FiniteBitVector) TestAndUnset ¶
func (vec *FiniteBitVector) TestAndUnset(key uint) bool
TestAndUnset sets a bit to false and returns true iff it was changed.
func (*FiniteBitVector) UnionAndIntersectionSize ¶
func (vec *FiniteBitVector) UnionAndIntersectionSize(vec2 *FiniteBitVector) (int, int)
UnionAndIntersectionSize returns the number of true bits of the union and intersection with vec2.
func (*FiniteBitVector) UnionWith ¶
func (vec *FiniteBitVector) UnionWith(vec2 *FiniteBitVector)
UnionWith sets vec to the union of itself and vec2.
func (*FiniteBitVector) Unset ¶
func (vec *FiniteBitVector) Unset(key uint)
Unset sets a bit to false.
type SparseBitVector ¶
type SparseBitVector struct {
// contains filtered or unexported fields
}
SparseBitVector implementation based on that from LLVM: https://github.com/llvm-mirror/llvm/blob/master/include/llvm/ADT/SparseBitVector.h
func New ¶
func New(set ...KeyType) *SparseBitVector
New creates and instance of a SparseBitVector, optionally initialized by set.
func (*SparseBitVector) Contains ¶
func (sbv *SparseBitVector) Contains(sbv2 *SparseBitVector) bool
Contains returns true iff sbv contains all of sbv2's true bits.
func (*SparseBitVector) Count ¶
func (sbv *SparseBitVector) Count() int
Count returns the number of distinct bits that are true.
func (*SparseBitVector) Equals ¶
func (sbv *SparseBitVector) Equals(sbv2 *SparseBitVector) bool
Equals returns true iff sbv and sbv2 contain equivalent true bits.
func (*SparseBitVector) IntersectWith ¶
func (sbv *SparseBitVector) IntersectWith(sbv2 *SparseBitVector)
IntersectWith sets sbv to the intersection of itself and sbv2.
func (*SparseBitVector) IntersectWithComplement ¶
func (sbv *SparseBitVector) IntersectWithComplement(sbv2 *SparseBitVector)
IntersectWithComplement sets sbv to the intersection of itself and the inverse of sbv2.
func (*SparseBitVector) IntersectionSize ¶
func (sbv *SparseBitVector) IntersectionSize(sbv2 *SparseBitVector) int
IntersectionSize returns the number of true bits of the intersection with sbv2.
func (*SparseBitVector) Iterate ¶
func (sbv *SparseBitVector) Iterate() <-chan KeyType
Iterate returns a channel which publishes all true bits in ascending order. The behaviour is undefined for bits modified while iterating.
func (*SparseBitVector) Set ¶
func (sbv *SparseBitVector) Set(key KeyType)
Set sets a particular bit to true in a SparseBitVector.
func (*SparseBitVector) String ¶
func (sbv *SparseBitVector) String() string
func (*SparseBitVector) Test ¶
func (sbv *SparseBitVector) Test(key KeyType) bool
Test checks whether a particular bit is true.
func (*SparseBitVector) TestAndSet ¶
func (sbv *SparseBitVector) TestAndSet(key KeyType) bool
TestAndSet checks whether a bit was previously true before setting it to true.
func (*SparseBitVector) UnionAndIntersectionSize ¶
func (sbv *SparseBitVector) UnionAndIntersectionSize(sbv2 *SparseBitVector) (int, int)
UnionAndIntersectionSize returns the number of true bits of the union and intersection with sbv2.
func (*SparseBitVector) UnionSize ¶
func (sbv *SparseBitVector) UnionSize(sbv2 *SparseBitVector) int
UnionSize returns the number of true bits of the union with sbv2.
func (*SparseBitVector) UnionWith ¶
func (sbv *SparseBitVector) UnionWith(sbv2 *SparseBitVector)
UnionWith returns the number of true bits of the union and intersection with sbv2.
func (*SparseBitVector) Unset ¶
func (sbv *SparseBitVector) Unset(key KeyType)
Unset sets a particular bit to false.