sets

package module
v0.0.0-...-943c3e9 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2013 License: LGPL-3.0 Imports: 2 Imported by: 0

README

sets

set library in go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a *StringSet, item string)

func AddArray

func AddArray(a *StringSet, items []string)

func AddInt

func AddInt(a *IntSet, item int)

func AddIntArray

func AddIntArray(a *IntSet, items []int)

func Jaquard

func Jaquard(a, b StringsSet) float64

Types

type BitSet

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

represents the set

func NewBitSet

func NewBitSet() *BitSet

create a new bit set, longhand for &BitSet{0,0}

func (*BitSet) Binary

func (self *BitSet) Binary() string

func (*BitSet) ClearBits

func (self *BitSet) ClearBits(bits Bits)

func (*BitSet) ClearSwitch

func (self *BitSet) ClearSwitch(s Switch)

func (*BitSet) Contents

func (self *BitSet) Contents() uint64

Get the set contents as an array of strings

func (*BitSet) Difference

func (a *BitSet) Difference(b BitsSet)

func (*BitSet) HasBits

func (self *BitSet) HasBits(b Bits) bool

func (*BitSet) Intersection

func (a *BitSet) Intersection(b BitsSet)

func (*BitSet) IsSet

func (self *BitSet) IsSet(s Switch) bool

func (*BitSet) Jaquard

func (a *BitSet) Jaquard(b BitsSet) float64

func (*BitSet) SetBits

func (self *BitSet) SetBits(bits Bits)

func (*BitSet) SetSwitch

func (self *BitSet) SetSwitch(s Switch)

Set a switch in the set

func (*BitSet) SetSwitchArray

func (self *BitSet) SetSwitchArray(s []Switch)

func (*BitSet) SetSwitches

func (self *BitSet) SetSwitches(s ...Switch)

func (*BitSet) Size

func (self *BitSet) Size() int

func (*BitSet) Union

func (a *BitSet) Union(b BitsSet)

type Bits

type Bits uint64

type BitsSet

type BitsSet interface {
	//CheckSwitch(s Switch)
	SetSwitch(s Switch)
	ClearSwitch(s Switch)
	SetBits(b Bits)
	ClearBits(b Bits)
	Contents() uint64
	Binary() string
	Size() int
	IsSet(s Switch) bool
	HasBits(b Bits) bool
	Union(a BitsSet)
	Intersection(a BitsSet)
	Difference(a BitsSet)
}

type IntSet

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

represents the set

func NewIntSet

func NewIntSet() *IntSet

create a new string set

func (*IntSet) Add

func (self *IntSet) Add(item int) bool

Add a string to the set

func (*IntSet) AddArray

func (a *IntSet) AddArray(items []int)

func (*IntSet) Contains

func (self *IntSet) Contains(item int) bool

func (*IntSet) Contents

func (self *IntSet) Contents() []int

Get the set contents as an array of strings

func (*IntSet) Difference

func (a *IntSet) Difference(b *IntSet)

func (*IntSet) Intersection

func (a *IntSet) Intersection(b *IntSet)

func (*IntSet) Jaquard

func (a *IntSet) Jaquard(b *IntSet) float64

func (*IntSet) Remove

func (self *IntSet) Remove(item int) bool

Remove a string from the set

func (*IntSet) Size

func (self *IntSet) Size() int

func (*IntSet) Union

func (a *IntSet) Union(b *IntSet)

type IntsSet

type IntsSet interface {
	Add(item int)
	Remove(item int)
	Contents() []int
	Size() int
	Contains(item int) bool
	Union(a IntsSet)
	Intersection(a IntsSet)
	Difference(a IntsSet)
}

interface for a set of integers

type StringSet

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

represents the set

func NewStringSet

func NewStringSet() *StringSet

create a new string set

func (*StringSet) Add

func (self *StringSet) Add(item string)

Add a string to the set

func (*StringSet) AddArray

func (a *StringSet) AddArray(items []string)

func (*StringSet) Contains

func (self *StringSet) Contains(item string) bool

func (*StringSet) Contents

func (self *StringSet) Contents() []string

Get the set contents as an array of strings

func (*StringSet) Difference

func (a *StringSet) Difference(b StringsSet)

func (*StringSet) Intersection

func (a *StringSet) Intersection(b StringsSet)

func (*StringSet) Jaquard

func (a *StringSet) Jaquard(b *StringSet) float64

func (*StringSet) Remove

func (self *StringSet) Remove(item string)

Remove a string from the set

func (*StringSet) Size

func (self *StringSet) Size() int

func (*StringSet) Union

func (a *StringSet) Union(b StringsSet)

type StringsSet

type StringsSet interface {
	Add(item string)
	Remove(item string)
	Contents() []string
	Size() int
	Contains(item string) bool
	Union(a StringsSet)
	Intersection(a StringsSet)
	Difference(a StringsSet)
}

interface for a set of strings

func Difference

func Difference(a, b StringsSet) StringsSet

func Intersection

func Intersection(a ...StringsSet) StringsSet

func Union

func Union(a ...StringsSet) StringsSet

type Switch

type Switch uint

interface for a tiny set of not more than 64 bits

Jump to

Keyboard shortcuts

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