set

package
v0.0.0-...-da378b8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package set creates a ItemSet data structure for the Item type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item generic.Type

Item the type of the Set

type ItemSet

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

ItemSet the set of Items

func (*ItemSet) Add

func (s *ItemSet) Add(t Item) *ItemSet

Add adds a new element to the Set. Returns a pointer to the Set.

func (*ItemSet) Clear

func (s *ItemSet) Clear()

Clear removes all elements from the Set

func (*ItemSet) Delete

func (s *ItemSet) Delete(item Item) bool

Delete removes the Item from the Set and returns Has(Item)

func (*ItemSet) Difference

func (s *ItemSet) Difference(s2 *ItemSet) *ItemSet

Difference returns a new set with all the elements that exist in the first set and don't exist in the second set

func (*ItemSet) Has

func (s *ItemSet) Has(item Item) bool

Has returns true if the Set contains the Item

func (*ItemSet) Intersection

func (s *ItemSet) Intersection(s2 *ItemSet) *ItemSet

Intersection returns a new set with elements that exist in both sets

func (*ItemSet) Items

func (s *ItemSet) Items() []Item

Items returns the Item(s) stored

func (*ItemSet) Size

func (s *ItemSet) Size() int

Size returns the size of the set

func (*ItemSet) Subset

func (s *ItemSet) Subset(s2 *ItemSet) bool

Subset returns true if s is a subset of s2

func (*ItemSet) Union

func (s *ItemSet) Union(s2 *ItemSet) *ItemSet

Union returns a new set with elements from both the given sets

Jump to

Keyboard shortcuts

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