meekstv

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 6 Imported by: 2

README

meekstv

Go Report Card Build Status

An implementation of Algorithm 123 - single transferable vote by Meek's Method

Background and specifications: https://svn.apache.org/repos/asf/steve/trunk/stv_background/meekm.pdf

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByVotes

type ByVotes MeekCandidates

func (ByVotes) Len

func (c ByVotes) Len() int

func (ByVotes) Less

func (c ByVotes) Less(i, j int) bool

func (ByVotes) Swap

func (c ByVotes) Swap(i, j int)

type CandidateStatus

type CandidateStatus string
const (
	Elected      CandidateStatus = "Elected"
	NewlyElected CandidateStatus = "NewlyElected"
	Hopeful      CandidateStatus = "Hopeful"
	Excluded     CandidateStatus = "Excluded"
	Almost       CandidateStatus = "Almost"
)

type MeekCandidate

type MeekCandidate struct {
	election.Candidate
	Status CandidateStatus
	Weight int64
	Votes  int64
}

func (*MeekCandidate) AsCandidate

func (meekCandidate *MeekCandidate) AsCandidate() election.Candidate

type MeekCandidates

type MeekCandidates []*MeekCandidate

func (MeekCandidates) AsCandidates

func (meekCandidates MeekCandidates) AsCandidates() election.Candidates

type MeekRound

type MeekRound struct {
	Number     int
	Excess     int64
	Surplus    int64
	AnyElected bool
}

type MeekStv

type MeekStv interface {
	election.Counter
}

func NewMeekStv

func NewMeekStv() MeekStv

type Pool

type Pool interface {
	Candidate(id string) *MeekCandidate
	SetVotes(id string, votes int64)
	Lowest() MeekCandidates
	Candidates() MeekCandidates
	Count() int
	Elected() MeekCandidates
	Hopeful() MeekCandidates
	NewlyElected() MeekCandidates
	Almost() MeekCandidates
	ElectedCount() int
	ExcludedCount() int
	Elect(id string)
	ElectAllNewlyElected()
	NewlyElect(id string)
	SetAlmost(id string)
	ElectHopeful()
	AddNewCandidates(candidates election.Candidates, scale int64)
	Exclude(id string) *MeekCandidate
	ExcludeByName(name string) MeekCandidates
	ExcludeHopeful()
	SetWeight(id string, weight int64)
	ZeroAllVotes()
	CandidateSummaries() []election.CandidateSummary
}

func NewPool

func NewPool() Pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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