Documentation
¶
Overview ¶
Package indexset implements a set for indices.
Index ¶
- type Set
- func (s Set) Add(value uint32) bool
- func (s Set) AddAll(values []uint32)
- func (s Set) Contains(other Set) bool
- func (s Set) Difference(other Set) Set
- func (s Set) Has(value uint32) bool
- func (s Set) HasAll(values ...uint32) bool
- func (s Set) Intersect(other Set) Set
- func (s Set) Len() int
- func (s Set) Remove(value uint32) bool
- func (s Set) RemoveAll(values []uint32)
- func (s Set) ToSlice() []uint32
- func (s Set) ToSortedSlice() []uint32
- func (s Set) Union(other Set) Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set map[uint32]struct{}
Set is the base type implemented by this package.
func NewFromSlice ¶
NewFromSlice returns a new set, initialized with the unique values in the given slice.
func (Set) Add ¶
Add ensures this set contains the given value. Returns true if it was added, and false if it already contained the value.
func (Set) Difference ¶
Difference returns a new set which is this set with all elements from the other set removed (i.e. `self - other`).
func (Set) Intersect ¶
Intersect returns a new set which is the intersection of this set with the other set.
func (Set) Remove ¶
Remove ensures this set does not contain the value. Returns true if the value was deleted, and false if the value was already not in the set.
func (Set) RemoveAll ¶
RemoveAll ensures this set does not contain any of the values in the given slice.
func (Set) ToSortedSlice ¶
ToSortedSlice renders this set to a sorted slice of all values contained in the set.