sets

package
v0.0.0-...-634b395 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitArrayPointSet

type BitArrayPointSet [16]uint16

A set representing membership as bits. Has up to 16^2 = 256 members, which is sufficient for all points on a max sized grid. Each uint16 represents memberships for one row.

func (*BitArrayPointSet) Add

func (ps *BitArrayPointSet) Add(p grid.Point)

func (*BitArrayPointSet) Clear

func (ps *BitArrayPointSet) Clear()

func (*BitArrayPointSet) Clone

func (ps *BitArrayPointSet) Clone(ps2 PointSet)

func (*BitArrayPointSet) Copy

func (ps *BitArrayPointSet) Copy() PointSet

func (BitArrayPointSet) Elements

func (ps BitArrayPointSet) Elements() grid.Placements

func (BitArrayPointSet) Has

func (ps BitArrayPointSet) Has(p grid.Point) bool

func (*BitArrayPointSet) Iter

func (ps *BitArrayPointSet) Iter() grid.PointIterator

func (*BitArrayPointSet) Union

func (ps *BitArrayPointSet) Union(ps2 PointSet)

type BitArraySeparationSet

type BitArraySeparationSet [6]uint64

A set representing membership as bits. Has up to 2*13^2 = 338 members, which is sufficient for separations on a max sized grid. Separation element ordering is little endian.

func (*BitArraySeparationSet) Add

func (ss *BitArraySeparationSet) Add(sep uint16)

func (*BitArraySeparationSet) Clear

func (ss *BitArraySeparationSet) Clear()

func (*BitArraySeparationSet) Clone

func (ss *BitArraySeparationSet) Clone(ss2 SeparationSet)

func (*BitArraySeparationSet) Copy

func (BitArraySeparationSet) Elements

func (ss BitArraySeparationSet) Elements() []uint16

func (BitArraySeparationSet) Has

func (ss BitArraySeparationSet) Has(sep uint16) bool

func (*BitArraySeparationSet) Union

func (ss *BitArraySeparationSet) Union(ss2 SeparationSet)

type PointSet

type PointSet interface {
	// Has checks if the point is in the set
	Has(grid.Point) bool
	// Add adds the point to the set
	Add(grid.Point)
	// Union updates the set to contain the union of points of the two sets
	Union(PointSet)
	// Clear resets the set to contain no points
	Clear()
	// Copy creates a copy of the set that does not share memory
	Copy() PointSet
	// Clone updates the set to contain the same elements as the other set
	Clone(PointSet)
	// Elements returns a slice of points in the set
	Elements() grid.Placements
	// Iter returns an iterator over the points in the set
	Iter() grid.PointIterator
}

func NewBitArrayPointSet

func NewBitArrayPointSet(points grid.Placements) PointSet

func NewMapPointSet

func NewMapPointSet(points grid.Placements) PointSet

type PointSetConstructor

type PointSetConstructor func(grid.Placements) PointSet

type SeparationSet

type SeparationSet interface {
	Has(uint16) bool
	Add(uint16)
	Union(SeparationSet)
	Clear()
	Copy() SeparationSet
	Clone(SeparationSet)
	Elements() []uint16
}

func NewBitArraySeparationSet

func NewBitArraySeparationSet(p grid.Placements) SeparationSet

func NewMapSeparationSet

func NewMapSeparationSet(p grid.Placements) SeparationSet

type SeparationSetConstructor

type SeparationSetConstructor func(grid.Placements) SeparationSet

type SeparationSetIterator

type SeparationSetIterator struct {
	SeparationSet SeparationSet
	// contains filtered or unexported fields
}

func NewSeparationSetIterator

func NewSeparationSetIterator(ss SeparationSet) SeparationSetIterator

func NewSeparationSetIteratorForGrid

func NewSeparationSetIteratorForGrid(ss SeparationSet, g grid.Grid) SeparationSetIterator

func (*SeparationSetIterator) Next

func (ssi *SeparationSetIterator) Next() (uint16, bool)

Jump to

Keyboard shortcuts

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