PollSimulation

This class allows to create a poll with its mandatory members.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open lateinit override var competition: Competition<S>

Definition of competition and its members.

Link copied to clipboard
open lateinit override var pollAlgorithm: PollAlgorithm<S, V>

Algorithm chosen to compute the final ranking.

Link copied to clipboard
open lateinit override var votesList: List<V>

Definition of votes.

Functions

Link copied to clipboard
open override fun competition(compInit: Competition<S>.() -> Unit): Competition<S>

DSL-function which initializes a Competition.

Link copied to clipboard
open override fun computePoll(): Ranking<S>

Computes the final ranking.

Link copied to clipboard

DSL-function which initializes MyCondorcetAlgorithm.

Link copied to clipboard

DSL-function which initializes MajorityVotesAlgorithm.

Link copied to clipboard
open infix override fun String.then(s: String): List<String>
open infix override fun List<String>.then(s: String): List<String>

Shortcut which allows competitors' name chaining in the list.

Link copied to clipboard
open operator override fun Competition<S>.unaryMinus()

Shortcut which assigns the value to competition.

open operator override fun PollAlgorithm<S, V>.unaryMinus()

Shortcut which assigns the value to pollAlgorithm.

Link copied to clipboard
open operator override fun V.unaryPlus()

Shortcut to add a vote in votesList.

Link copied to clipboard
open infix override fun String.votedBy(voterIdentifier: String): SinglePreferenceVote<S>

This function allows a shortcut to create a SinglePreferenceVote, given the name of Competitor voted by a Voter, distinguished by its identifier.

open infix override fun List<String>.votedBy(voterIdentifier: String): ListOfPreferencesVote<S>

This function allows a shortcut to create a ListOfPreferencesVote, given the name list of Competitor voted by a Voter, distinguished by its identifier.