org.bolson.vote
Class RankedPairs

java.lang.Object
  extended by org.bolson.vote.VotingSystem
      extended by org.bolson.vote.RatedVotingSystem
          extended by org.bolson.vote.Condorcet
              extended by org.bolson.vote.RankedPairs
All Implemented Interfaces:
java.io.Serializable

public class RankedPairs
extends Condorcet

Implements the Ranked Pairs method of ranked voting tabulation. It is much like Condorcet.

See Also:
Serialized Form

Nested Class Summary
protected static class RankedPairs.Pair
           
 
Field Summary
 
Fields inherited from class org.bolson.vote.Condorcet
talley
 
Fields inherited from class org.bolson.vote.VotingSystem
debug, NO_VOTE, numc
 
Constructor Summary
RankedPairs(int nc)
           
 
Method Summary
 java.lang.String getDebugText(java.lang.String[] names)
          Return textual representation of debug data.
 int[] getWinners()
          Do processing if necessary, return winners.
 java.lang.String name()
          Return name of this voting system.
 
Methods inherited from class org.bolson.vote.Condorcet
countDefeats, getSchwartzSet, getSchwartzSet, getSchwartzSet, getSchwartzSet, getWinnersCSSD, getWinnersOldBPM, getWinnersSchwartzEqOne, getWinnersSimpleIfOne, htmlSummary, htmlTable, init, toString, toString, verifySchwartzSet, verifySchwartzSet, verifySchwartzSet, voteRating, voteRating, voteRating
 
Methods inherited from class org.bolson.vote.RatedVotingSystem
voteRanking
 
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
 

Constructor Detail

RankedPairs

public RankedPairs(int nc)
Method Detail

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)

getDebugText

public java.lang.String getDebugText(java.lang.String[] names)
Description copied from class: VotingSystem
Return textual representation of debug data. Default implementation returns null.

Overrides:
getDebugText in class Condorcet
Parameters:
names - Symbolic names for the choices makes human debugging easier. May be null.
Returns:
debug text (default=null)
See Also:
VotingSystem.debug

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