STAR++ v0.2.2
C++ implementation of STAR voting
Loading...
Searching...
No Matches
Star::Election::Builder Class Reference

The Election::Builder class is a utility through which elections can be prepared. More...

#include <star/election.h>

Public Member Functions

 Builder (const QString &name=QString())
 
Election build ()
 
void reset ()
 
BuilderwBallot (const Voter &voter, const QList< Vote > &votes)
 
BuilderwName (const QString &name)
 
BuilderwSeatCount (int count)
 

Detailed Description

Elections are built by first instantiating a Builder, then adding all ballots from participating voters to it, and finally calling build().

The total pool of candidates is determined automatically while evaluating each Ballot. If a ballot is missing votes for a candidate that is present in other ballots, that ballots vote for that candidate is considered to be 0.

See also
Election.

Constructor & Destructor Documentation

◆ Builder()

Star::Election::Builder::Builder ( const QString &  name = QString())

Creates an election builder, poised to create an election named name.

See also
build().

Member Function Documentation

◆ build()

Election Star::Election::Builder::build ( )

Completes the work-in-progress election and returns it.

◆ reset()

void Star::Election::Builder::reset ( )

Resets the work-in-progress election to a default-constructed one.

◆ wBallot()

Election::Builder & Star::Election::Builder::wBallot ( const Voter voter,
const QList< Vote > &  votes 
)

Creates a ballot containing the votes from voter and adds them to the builder.

Returns a reference to the builder.

◆ wName()

Election::Builder & Star::Election::Builder::wName ( const QString &  name)

Sets the seat name of the work-in-progress election to name.

Returns a reference to the builder.

◆ wSeatCount()

Election::Builder & Star::Election::Builder::wSeatCount ( int  count)

Sets the seat count of the work-in-progress election to count.

Returns a reference to the builder.


The documentation for this class was generated from the following files: