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

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
 

Detailed Description

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.

See also
ElectionResult.

Constructor & Destructor Documentation

◆ QualifierResult() [1/3]

Star::QualifierResult::QualifierResult ( )

Constructs a null qualifier result.

See also
isNull().

◆ QualifierResult() [2/3]

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.

Note
If the arguments passed to this constructor constitute an invalid qualifier result, the resultant instance will be null instead.

◆ QualifierResult() [3/3]

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.

Note
If the arguments passed to this constructor constitute an invalid qualifier result, the resultant instance will be null instead.

Member Function Documentation

◆ firstSeed()

QString Star::QualifierResult::firstSeed ( ) const

Returns the first candidate seeded into the runoff that this qualifier result details.

See also
hasFirstSeed() and secondSeed().

◆ hasFirstSeed()

bool Star::QualifierResult::hasFirstSeed ( ) const

Returns true if the qualifier successfully selected a first seed; otherwise, returns false.

See also
isComplete() and Calculator::Option::AllowTrueTies.

◆ hasSecondSeed()

bool Star::QualifierResult::hasSecondSeed ( ) const

Returns true if the qualifier successfully selected a second seed; otherwise, returns false.

See also
isComplete() and Calculator::Option::AllowTrueTies.

◆ isComplete()

bool Star::QualifierResult::isComplete ( ) const

Returns true if the qualifier successfully seeded two candidates for a runoff; otherwise, returns false.

See also
isNull() and Calculator::Option::AllowTrueTies.

◆ isNull()

bool Star::QualifierResult::isNull ( ) const

Returns true if the qualifier result is null; otherwise, returns false.

See also
isComplete().

◆ isSeededSimultaneously()

bool Star::QualifierResult::isSeededSimultaneously ( ) const

Returns true if both of the seeded candidates were advanced at the same time; otherwise, returns false.

◆ operator!=()

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.

See also
operator==().

◆ operator==()

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.

See also
operator!=().

◆ overflow()

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.

See also
isComplete() and unresolved().

◆ secondSeed()

QString Star::QualifierResult::secondSeed ( ) const

Returns the first candidate seeded into the runoff that this qualifier result details.

See also
hasFirstSeed() and secondSeed().

◆ seeds()

std::pair< QString, QString > Star::QualifierResult::seeds ( )

Returns the first and second runoff seeds as a pair.

See also
firstSeed() and secondSeed().

◆ unresolved()

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.

See also
isComplete() and overflow().

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