STAR++ v0.2.2
C++ implementation of STAR voting
|
The ElectionResult class holds the outcome of an election. More...
#include <star/electionresult.h>
Public Member Functions | |
ElectionResult () | |
ElectionResult (const Election *election, const QList< Seat > &seats) | |
const Election * | election () const |
qsizetype | filledSeatCount () const |
bool | isComplete () const |
bool | isNull () const |
bool | operator!= (const ElectionResult &other) const |
bool | operator== (const ElectionResult &other) const |
const Seat & | seatAt (qsizetype i) const |
qsizetype | seatCount () const |
QList< Seat > | seats () const |
qsizetype | unfilledSeatCount () const |
QSet< QString > | unresolvedCandidates () const |
Seat | unresolvedSeat () const |
QStringList | winners () const |
Election results consist primarily of a list of seats filled according to the makeup of an Election.
An election result for a given Election can be generated through the use of Calculator.
Star::ElectionResult::ElectionResult | ( | ) |
Constructs a null election result.
Constructs a election result that corresponds to the election election and consists of the evaluated seats seats.
const Election * Star::ElectionResult::election | ( | ) | const |
Returns the election that was evaluated.
qsizetype Star::ElectionResult::filledSeatCount | ( | ) | const |
Returns the number of seats that were able to successfully be filled.
bool Star::ElectionResult::isComplete | ( | ) | const |
Returns true
if all the seats of the election were able to be filled; otherwise, returns false.
bool Star::ElectionResult::isNull | ( | ) | const |
Returns true
if the election result is null; otherwise, returns false
.
bool Star::ElectionResult::operator!= | ( | const ElectionResult & | other | ) | const |
Returns true if this election result is not the same as other; otherwise, returns false.
bool Star::ElectionResult::operator== | ( | const ElectionResult & | other | ) | const |
Returns true if this election result is the same as other; otherwise, returns false.
const Seat & Star::ElectionResult::seatAt | ( | qsizetype | i | ) | const |
Returns the seat at position i.
qsizetype Star::ElectionResult::seatCount | ( | ) | const |
Returns the number of seats that were evaluated.
This will always be equal to the seat count of the election that corresponds with this result, unless Calculator::Option::AllowTrueTies was set in the Calculator that generated it and an unresolvable tie occurred.
QList< Seat > Star::ElectionResult::seats | ( | ) | const |
Returns the list of seats evaluated for the election.
qsizetype Star::ElectionResult::unfilledSeatCount | ( | ) | const |
Returns the number of seats that were were left unfilled.
QSet< QString > Star::ElectionResult::unresolvedCandidates | ( | ) | const |
Returns the set of candidates that caused the election to be ended prematurely, if it is incomplete; otherwise, returns an empty set.
Seat Star::ElectionResult::unresolvedSeat | ( | ) | const |
Returns the seat in the results that was left unfilled, if the election is incomplete; otherwise, returns a null seat.
If the election is incomplete, this is equivalent to:
QStringList Star::ElectionResult::winners | ( | ) | const |
Returns a list of the candidates that won each seat.