drum

package
v0.0.0-...-4b9bf86 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package drum provides a simple counter (with names based on musical methaphores)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drum

type Drum struct {
	Nam    string
	Cnt    int64
	Map    counter
	UseMap bool
	sync.Mutex
}

Drum is named counter

func NewDrum

func NewDrum(nam string, cap int) *Drum

NewDrum returns a new initialized drum

func (*Drum) Beat

func (b *Drum) Beat(cur int)

Beat increments b.Cnt by one. And iff b.Verbose then b.Map[cur] get incremented as well.

func (*Drum) Init

func (b *Drum) Init(nam string, cap int) *Drum

Init returns an initialized drum

func (*Drum) Print

func (b *Drum) Print()

Print prints the counter, if it's not empty, as lines of tab-terminated cells. And iff b.verbose then b.Map is printed in ascending order of its keys.

func (*Drum) Sort

func (b *Drum) Sort() []int

Sort returns the keys of b.Map in a sorted slice

Jump to

Keyboard shortcuts

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