mana

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: Apache-2.0, BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RankByFixedRange

func RankByFixedRange(f Func, target *identity.Identity, identities []*identity.Identity, r int) []*identity.Identity

RankByFixedRange ranks by a fixed range r.

func RankByThreshold

func RankByThreshold(f Func, target *identity.Identity, identities []*identity.Identity, threshold float64) []*identity.Identity

RankByThreshold ranks by mana threshold.

func RankByVariableRange

func RankByVariableRange(f Func, target *identity.Identity, identities []*identity.Identity, r int, ro float64) []*identity.Identity

RankByVariableRange ranks by a variable range based on ro.

func Total

func Total(f Func, identities []*identity.Identity) (total uint64)

Total returns the total mana of the given identitites.

Types

type Func

type Func func(identity *identity.Identity) uint64

Func type is an adapter to allow the use of ordinary functions as Mana.

func (Func) Eval

func (f Func) Eval(identity *identity.Identity) uint64

Eval calls f(p).

type Identity

type Identity map[uint64][]*identity.Identity

Identity is a map between mana value and identities with that mana value.

func NewIdentity

func NewIdentity(identities []*identity.Identity, f Func) Identity

NewIdentity returns the mana-identitties map.

Jump to

Keyboard shortcuts

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