data

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: MPL-2.0 Imports: 1 Imported by: 2

Documentation

Overview

Package data defines custom data types for parsing.

Index

Constants

This section is empty.

Variables

View Source
var EmptyIntMap = IntMap{make(map[int]int)}

EmptyIntMap is the empty map

View Source
var EmptyIntSet = NewIntSet()

EmptyIntSet is the empty set

Functions

This section is empty.

Types

type IntMap

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

IntMap is an immutable int-int map

func NewIntMap

func NewIntMap(data map[int]int) IntMap

NewIntMap creates a new IntMap instance TODO: return a pointer

func (IntMap) Each

func (i IntMap) Each(f func(key int, val int))

Each runs the given function on all elements of the map

func (IntMap) Filter

func (i IntMap) Filter(keys IntSet) IntMap

Filter creates a new int map including only the keys present in the given integer set

func (IntMap) Get

func (i IntMap) Get(key int) int

Get returns with the value for the given key

func (IntMap) Inc

func (i IntMap) Inc(val int) IntMap

Inc increments the value in the integer map. If it doesn't exist it will be inserted

func (IntMap) Keys

func (i IntMap) Keys() []int

Keys returns with the map keys

type IntSet

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

IntSet is a sorted immutable integer set

func NewIntSet

func NewIntSet(values ...int) IntSet

NewIntSet creates a new integer set TODO: return a pointer

func (IntSet) Each

func (i IntSet) Each(f func(val int))

Each runs the given function on all elements of the set

func (IntSet) Insert

func (i IntSet) Insert(val int) IntSet

Insert adds a new item to the set

func (IntSet) Len

func (i IntSet) Len() int

Len returns with the length of the set

func (IntSet) Union

func (i IntSet) Union(i2 IntSet) IntSet

Union returns with the union of the two set

Jump to

Keyboard shortcuts

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