algo

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MPL-2.0, MPL-2.0 Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Permutator

type Permutator interface {
	// PermuteAxes enumerates all the fields whose possible values should yield permutations, e.g. "size" and "color".
	PermuteAxes() []interface{}

	// PermuteSubject returns a zero-valued subject from which permutations are created.
	PermuteSubject() interface{}

	// PermuteNew returns a new permutation with the input axis assigned the input value.
	//
	// The subject is a pointer type, this function should should initialize the new
	// permutation from the subject without modifying the latter.
	//
	// The subject may or may not have other axis values defined. Implementations take the
	// current subject value and only assign one axis/value pair, allowing PermuteSet
	// to be used to compose single subject from multiple PermuteSet calls to set different axes.
	PermuteNew(subject, axis, value interface{}) interface{}

	// PermuteValues returns all possible values of the input axis, e.g. "red" and "green" for axis "colors".
	PermuteValues(axis interface{}) []interface{}

	// PermuteId stores the permutation ID.
	PermuteId(subject interface{}, id int) interface{}
}

Permutator implementations enumerate the permutation axes and all possible values of each.

It assumes a permutation only has one value per axis.

The method naming convention it assumes subject type T may implement this interface itself, rather than through a separate Permutator type where the names could stutter less (https://blog.golang.org/package-names).

Jump to

Keyboard shortcuts

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