Documentation ¶
Index ¶
- Variables
- type Candidate
- type Election
- type Protocol
- type SimpleMajority
- func (election *SimpleMajority) Cast(vote Vote)
- func (election *SimpleMajority) Display()
- func (election *SimpleMajority) GetId() string
- func (election *SimpleMajority) Init(candidates []Candidate)
- func (election *SimpleMajority) Result() ([]string, float64)
- func (election *SimpleMajority) Tally()
- func (election *SimpleMajority) ValidateVote(vote Vote) bool
- type Vote
Constants ¶
This section is empty.
Variables ¶
View Source
var ProtocolCommandMap = map[string]Protocol{ "simpleMajority": new(SimpleMajority), }
Consumed by cmd/serve.go
Functions ¶
This section is empty.
Types ¶
type Protocol ¶
type Protocol interface { Init([]Candidate) Cast(Vote) // Cast a vote Tally() // Compute the candidate's totals Result() ([]string, float64) // Get the final result(s) Display() // Print the current totals GetId() string // Get the id of the election ValidateVote(Vote) bool // Return if a cast vote is valid }
type SimpleMajority ¶
type SimpleMajority struct {
Election
}
func (*SimpleMajority) Cast ¶
func (election *SimpleMajority) Cast(vote Vote)
func (*SimpleMajority) Display ¶
func (election *SimpleMajority) Display()
func (*SimpleMajority) GetId ¶
func (election *SimpleMajority) GetId() string
func (*SimpleMajority) Init ¶
func (election *SimpleMajority) Init(candidates []Candidate)
func (*SimpleMajority) Result ¶
func (election *SimpleMajority) Result() ([]string, float64)
func (*SimpleMajority) Tally ¶
func (election *SimpleMajority) Tally()
func (*SimpleMajority) ValidateVote ¶
func (election *SimpleMajority) ValidateVote(vote Vote) bool
Click to show internal directories.
Click to hide internal directories.