STAR++ v0.2.2
C++ implementation of STAR voting
|
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 () |
Builder & | wBallot (const Voter &voter, const QList< Vote > &votes) |
Builder & | wName (const QString &name) |
Builder & | wSeatCount (int count) |
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
.
Star::Election::Builder::Builder | ( | const QString & | name = QString() | ) |
Creates an election builder, poised to create an election named name.
Election Star::Election::Builder::build | ( | ) |
Completes the work-in-progress election and returns it.
void Star::Election::Builder::reset | ( | ) |
Resets the work-in-progress election to a default-constructed one.
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.
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.
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.