org.bolson.vote
Class CondorcetRTB
java.lang.Object
org.bolson.vote.VotingSystem
org.bolson.vote.RatedVotingSystem
org.bolson.vote.Condorcet
org.bolson.vote.CondorcetRTB
- All Implemented Interfaces:
- java.io.Serializable
public class CondorcetRTB
- extends Condorcet
Implements the Condorcet method of ranked voting tabulation
and beatpath tie resolution based on Ratings, as suggested by James Green-Armytage
- See Also:
- Serialized Form
Field Summary |
protected double[] |
bpm
|
protected double[] |
dtalley
|
protected int[] |
talley
|
Method Summary |
int[] |
getWinners()
Do processing if necessary, return winners. |
java.lang.String |
htmlSummary(java.lang.String[] names)
A fancy html representation. |
static java.lang.StringBuffer |
htmlTable(java.lang.StringBuffer sb,
int numc,
double[] arr,
java.lang.String title,
java.lang.String[] names)
|
java.lang.String |
name()
Return name of this voting system. |
java.lang.String |
toString()
|
java.lang.String |
toString(java.lang.String[] names)
A more interesting representation. |
int |
voteRating(double[] rating)
|
int |
voteRating(float[] rating)
|
int |
voteRating(int[] rating)
|
Methods inherited from class org.bolson.vote.Condorcet |
countDefeats, getDebugText, getSchwartzSet, getSchwartzSet, getSchwartzSet, getSchwartzSet, getWinnersCSSD, getWinnersOldBPM, getWinnersSchwartzEqOne, getWinnersSimpleIfOne, htmlTable, init, verifySchwartzSet, verifySchwartzSet, verifySchwartzSet |
Methods inherited from class org.bolson.vote.VotingSystem |
checkRatedVote, getDebugHTML, getNumberOfCandidates, getWinners, getWinners, getWinners, isValidRankedVote, isValidRatedVote, normalize, normalize, normalize, normalize, normalize, normalizeL2, normalizeL2, normalizeL2, normalizeL2, normalizeL2, stretch, voteRating |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
talley
protected int[] talley
dtalley
protected double[] dtalley
bpm
protected double[] bpm
CondorcetRTB
public CondorcetRTB(int numCandidates)
name
public java.lang.String name()
- Description copied from class:
VotingSystem
- Return name of this voting system.
This is a function so that it can potentially construct a detailed name based on options set in init().
- Overrides:
name
in class Condorcet
- Returns:
- a descriptive name
voteRating
public int voteRating(int[] rating)
- Overrides:
voteRating
in class Condorcet
- Parameters:
rating
- An array int[numc].
rating[i] is the rating of choice i.
A rating can be any int value. Higher means more preferred.
NO_VOTE for unrated.
- Returns:
- 0 on success
voteRating
public int voteRating(float[] rating)
- Overrides:
voteRating
in class Condorcet
- Parameters:
rating
- An array int[N].
rating[i] is the rating of choice i.
A rating can be any int value. Higher means more preferred.
NO_VOTE for unrated.
- Returns:
- 0 on success
voteRating
public int voteRating(double[] rating)
- Overrides:
voteRating
in class Condorcet
- Parameters:
rating
- An array int[N].
rating[i] is the rating of choice i.
A rating can be any int value. Higher means more preferred.
NO_VOTE for unrated.
- Returns:
- 0 on success
getWinners
public int[] getWinners()
- Description copied from class:
VotingSystem
- Do processing if necessary, return winners.
It is recommended to cache the return value in such a way that calling this function again does not do complex recalculation.
That cache should be cleared if voteRating or voteRanking is called.
- Overrides:
getWinners
in class Condorcet
- Returns:
- indecies of winners (hopefully 1 of them)
toString
public java.lang.String toString()
- Overrides:
toString
in class Condorcet
toString
public java.lang.String toString(java.lang.String[] names)
- Description copied from class:
VotingSystem
- A more interesting representation.
Include the names of the choices voted upon in the representation.
- Overrides:
toString
in class Condorcet
- Parameters:
names
- The names of the choices.
- Returns:
- state, with names!
htmlTable
public static java.lang.StringBuffer htmlTable(java.lang.StringBuffer sb,
int numc,
double[] arr,
java.lang.String title,
java.lang.String[] names)
htmlSummary
public java.lang.String htmlSummary(java.lang.String[] names)
- Description copied from class:
VotingSystem
- A fancy html representation.
Include the names of the choices voted upon in the representation.
- Overrides:
htmlSummary
in class Condorcet
- Parameters:
names
- The names of the choices. May be null.
- Returns:
- state, with names!