combFinder

package module
v0.0.0-...-679f46b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 2 Imported by: 0

README

combFinder

GoDoc

combFinder provides a way to determine all possible combinations of the entries of a map[string]Number which satisfy the CompareFunc. Combining elements is done via the CombineFunc. One entry of the map can only occure once in the final set!

Number is defined as:

import "golang.org/x/exp/constraints"

type Number interface {
    constraints.Float | constraints.Integer | constraints.Complex
}

Both functions are defined as:

type CompareFunc[T Number] func(valueToCheck T) bool

type CombineFunc[T Number] func(value1, value2 T) T

To speed up the search and optimize the memory usage (which is huge btw) you can supply a OORFunc (OutOfRange). If this function returns true, the corresponding set is discarded and not further used.

type OORFunc[T Number] func(valueToCheck T) bool

See the GoDoc for more details.

Install

just run go get codeberg.org/DerLukas/combFinder in your project folder.

Useage

please see file int_test.go

License

MIT licensed. See the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxNumberRoutines uint8 = 5

Functions

This section is empty.

Types

type CombineFunc

type CombineFunc[T Number] func(value1, value2 T) T

type CompareFunc

type CompareFunc[T Number] func(valueToCheck T) bool

type Entry

type Entry[T Number] struct {
	Name  string
	Value T
}

func (*Entry[T]) String

func (e *Entry[T]) String() string

type Number

type Number interface {
	constraints.Float | constraints.Integer | constraints.Complex
}

type OORFunc

type OORFunc[T Number] func(valueToCheck T) bool

type Set

type Set[T Number] []*Entry[T]

func Run

func Run[T Number](set Set[T], cpF CompareFunc[T], cbF CombineFunc[T], oorF OORFunc[T]) []Set[T]

func (Set[T]) String

func (s Set[T]) String() string

type SetSortByName

type SetSortByName[T Number] Set[T]

func (SetSortByName[T]) Len

func (s SetSortByName[T]) Len() int

func (SetSortByName[T]) Less

func (s SetSortByName[T]) Less(i, j int) bool

func (SetSortByName[T]) Swap

func (s SetSortByName[T]) Swap(i, j int)

Jump to

Keyboard shortcuts

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