STAR++ v0.2.2
C++ implementation of STAR voting
|
The Seat class contains the outcome for a specific seat in a given election. More...
#include <star/seat.h>
Public Member Functions | |
Seat () | |
Seat (const QString &winner, const QualifierResult &qualifierResult=QualifierResult()) | |
Seat (const QualifierResult &qualifierResult) | |
bool | isExceptionFilled () const |
bool | isFilled () const |
bool | isNull () const |
bool | isUpset () const |
bool | operator!= (const Seat &other) const |
bool | operator== (const Seat &other) const |
QualifierResult | qualifierResult () const |
QString | winner () const |
A seat consists of a winner and QualifierResult that details how that winner and their opponent were seeded into the runoff phase of the election they belong to. If a seat could not be filled, it will contain no winner and its QualifierResult will contain the unresolvable tie that prevented its completion if it occurred during the scoring round. Otherwise the tie was between the candidates in the runoff.
Star::Seat::Seat | ( | ) |
Constructs a null seat.
Star::Seat::Seat | ( | const QualifierResult & | qualifierResult | ) |
Constructs an unfilled seat with qualifier result qualifierResult.
Star::Seat::Seat | ( | const QString & | winner, |
const QualifierResult & | qualifierResult = QualifierResult() |
||
) |
Constructs a seat with the winner winner and qualifier result qualifierResult.
bool Star::Seat::isExceptionFilled | ( | ) | const |
Returns true
if the seat was filled via special exception; otherwise, returns false
.
Exceptions to the normal seat filling process include:
If this is the case, the seat's qualifier result will be null.
bool Star::Seat::isFilled | ( | ) | const |
Returns true
if the seat was successfully filled; otherwise, returns false
.
bool Star::Seat::isNull | ( | ) | const |
Returns true
if the seat is null; otherwise, returns false
.
bool Star::Seat::isUpset | ( | ) | const |
Returns true
if the seat's winner is its second seed instead of its first seed, and the candidates were not simultaneously seeded; otherwise, returns false
.
bool Star::Seat::operator!= | ( | const Seat & | other | ) | const |
Returns true if this seat is not the same as other; otherwise, returns false.
bool Star::Seat::operator== | ( | const Seat & | other | ) | const |
Returns true if this seat is the same as other; otherwise, returns false.
QualifierResult Star::Seat::qualifierResult | ( | ) | const |
Returns the qualifier result of the runoff qualifier that was performed while filling the seat.
QString Star::Seat::winner | ( | ) | const |
Returns the candidate that won the seat.