internal

package
v0.0.0-...-04c4c42 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serialize

func Serialize(elems []uint16) string

Serialize produces a string encoding the given integers.

Types

type Grouping

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

func (Grouping) Copy

func (g Grouping) Copy() Grouping

type Groupings

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

Groupings maintain labels to identify membership to one or more groups. Labels are implemented as subsets of integers from 0 up to an excluded maximum, where the integers represent the groups. Assumptions:

  • most labels are for one group or very few
  • a few labels are sparse with more groups in them
  • very few comprise the universe of all groups

func NewGroupings

func NewGroupings(n int) (*Groupings, error)

NewGroupings creates a new Groupings supporting labels for membership to up n groups. n must be a positive multiple of 16 and <=65536.

func (*Groupings) AddTo

func (gr *Groupings) AddTo(g *Grouping, group uint16) error

AddTo adds the given group to the grouping.

func (*Groupings) Contains

func (gr *Groupings) Contains(g *Grouping, group uint16) bool

Contains returns whether the given group is a member of the grouping.

func (*Groupings) Deserialize

func (gr *Groupings) Deserialize(label string) (*Grouping, error)

Deserialize reconstructs a grouping out of the serialized label.

func (*Groupings) Iter

func (gr *Groupings) Iter(g *Grouping, f func(group uint16) error) error

Iter iterates over the groups in the grouping and calls f with each of them. If f returns an error Iter immediately returns with it.

func (*Groupings) N

func (gr *Groupings) N() int

N returns up to how many groups are supported. That is the value that was passed to NewGroupings.

func (*Groupings) Serialize

func (gr *Groupings) Serialize(g *Grouping) string

Serialize produces a string representing the grouping label.

func (*Groupings) WithinRange

func (gr *Groupings) WithinRange(group uint16) error

WithinRange checks whether group is within the admissible range for labeling otherwise it returns an error.

Jump to

Keyboard shortcuts

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