STAR++ v0.2.2
C++ implementation of STAR voting
|
The QualifierResult class holds the outcome of a runoff qualifier. More...
#include <star/qualifierresult.h>
Public Member Functions | |
QualifierResult () | |
QualifierResult (const QSet< QString > &firstAdv, const QSet< QString > &secondAdv={}) | |
QualifierResult (const QString &f, const QString &s, bool sim, const QSet< QString > &o) | |
QString | firstSeed () const |
bool | hasFirstSeed () const |
bool | hasSecondSeed () const |
bool | isComplete () const |
bool | isNull () const |
bool | isSeededSimultaneously () const |
bool | operator!= (const QualifierResult &other) const |
bool | operator== (const QualifierResult &other) const |
QSet< QString > | overflow () const |
QString | secondSeed () const |
std::pair< QString, QString > | seeds () |
QSet< QString > | unresolved () const |
When filling a seat in a STAR election, two candidates from the total pool are seeded into the runoff round before the final winner is determined, a process that STAR++ has dubbed the "Runoff Qualifier". A given instance of this class contains information about the result of one of these qualifiers for a single seat. This information can be useful for inspecting the details of the STAR process, how close a given election was, and whether the strength of votes or consensus were the larger deciding factor for a particular winner.
Star::QualifierResult::QualifierResult | ( | ) |
Constructs a null qualifier result.
Star::QualifierResult::QualifierResult | ( | const QSet< QString > & | firstAdv, |
const QSet< QString > & | secondAdv = {} |
||
) |
Constructs a qualifier result in which the candidate(s) in firstAdv were advanced first, and the candidate(s) in secondAdv were advanced second.
Star::QualifierResult::QualifierResult | ( | const QString & | f, |
const QString & | s, | ||
bool | sim, | ||
const QSet< QString > & | o | ||
) |
Constructs a qualifier result with first seed f, second seed s, overflow o, and the simultaneously seeded indicator sim.
QString Star::QualifierResult::firstSeed | ( | ) | const |
Returns the first candidate seeded into the runoff that this qualifier result details.
bool Star::QualifierResult::hasFirstSeed | ( | ) | const |
Returns true
if the qualifier successfully selected a first seed; otherwise, returns false.
bool Star::QualifierResult::hasSecondSeed | ( | ) | const |
Returns true
if the qualifier successfully selected a second seed; otherwise, returns false.
bool Star::QualifierResult::isComplete | ( | ) | const |
Returns true
if the qualifier successfully seeded two candidates for a runoff; otherwise, returns false.
bool Star::QualifierResult::isNull | ( | ) | const |
Returns true
if the qualifier result is null; otherwise, returns false
.
bool Star::QualifierResult::isSeededSimultaneously | ( | ) | const |
Returns true
if both of the seeded candidates were advanced at the same time; otherwise, returns false.
bool Star::QualifierResult::operator!= | ( | const QualifierResult & | result | ) | const |
Returns true if this qualifier result is not the same as other; otherwise, returns false.
When evaluating if two qualifier results are not equivalent, the order of the candidate seeds is ignored if both were seeded simultaneously.
bool Star::QualifierResult::operator== | ( | const QualifierResult & | result | ) | const |
Returns true if this qualifier result is the same as other; otherwise, returns false.
When evaluating if two qualifier results are equivalent, the order of the candidate seeds is ignored if both were seeded simultaneously.
QSet< QString > Star::QualifierResult::overflow | ( | ) | const |
Returns the set of candidates stuck in an unresolvable tie, if the qualifier did not successfully seed both candidates; otherwise, returns an empty set.
QString Star::QualifierResult::secondSeed | ( | ) | const |
Returns the first candidate seeded into the runoff that this qualifier result details.
std::pair< QString, QString > Star::QualifierResult::seeds | ( | ) |
Returns the first and second runoff seeds as a pair.
QSet< QString > Star::QualifierResult::unresolved | ( | ) | const |
Returns the set of candidates remaining in the qualifier when it failed, if it is incomplete. Otherwise, returns an empty set.
Unlike overflow(), this method will include the first seed if one was successfully seeded. seeded.