Documentation ¶
Overview ¶
The module util/sets implements the type Set, a set of non-negative integers, represented by intervals.
Index ¶
- Constants
- type Set
- func (s *Set) Attach() *SetIterator
- func (s *Set) Clear(min, max int)
- func (s *Set) Copy() *Set
- func (s1 *Set) Diff(s2 *Set) *Set
- func (s1 *Set) Equal(s2 *Set) bool
- func (s *Set) Excl(e int)
- func (s *Set) Fill(min, max int)
- func (s *Set) In(e int) bool
- func (s *Set) Incl(e int)
- func (s1 *Set) Inter(s2 *Set) *Set
- func (s *Set) IsEmpty() bool
- func (s *Set) NbElems() int
- func (s1 *Set) Subset(s2 *Set) bool
- func (s1 *Set) Union(s2 *Set) *Set
- func (s1 *Set) XOR(s2 *Set) *Set
- type SetIterator
Constants ¶
const ( // The smallest integer in sets. SMin = 0 // The largest integer in sets. SMax = 1<<31 - 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set of non-negative integers.
func (*Set) Attach ¶
func (s *Set) Attach() *SetIterator
Attach the set s to a SetIterator and return the later.
type SetIterator ¶
type SetIterator struct {
// contains filtered or unexported fields
}
func (*SetIterator) First ¶
func (i *SetIterator) First() (min, max int, ok bool)
On return, min..max is the first interval of the set attached to i. Returns true in ok if such an interval exists. Usage: min, max, ok := i.First(); for ok { ... min, max, ok = i.Next()}
func (*SetIterator) FirstE ¶
func (i *SetIterator) FirstE() (e int, ok bool)
On return, e contains the first element of the set attached to i. Returns true in ok if such an element exists. Usage: e, ok := i.FirstE(); for ok { ... e, ok = i.NextE()}
func (*SetIterator) Next ¶
func (i *SetIterator) Next() (min, max int, ok bool)
On return, min..max is the next interval of the set attached to i. Returns true in ok if such an interval exists. i.First must have been called once before i.Next. Usage: min, max, ok := i.First(); for ok { ... min, max, ok = i.Next()}
func (*SetIterator) NextE ¶
func (i *SetIterator) NextE() (e int, ok bool)
On return, e contains the next element of the set attached to i. Returns true in ok if such an element exists. i.FirstE must have been called once before i.NextE. Usage: e, ok := i.FirstE(); for ok { ... e, ok = i.NextE()}