org.bolson.vote
Class NamedIRNR
java.lang.Object
org.bolson.vote.NameVotingSystem
org.bolson.vote.NamedIRNR
public class NamedIRNR
- extends NameVotingSystem
Instant Runoff Normalized Ratings
Methods inherited from class org.bolson.vote.NameVotingSystem |
defaultMain, denibble, depercentHexify, fromUrlEncoded, getDebug, getImplNames, getIpmlForName, htmlExplain, htmlSummary, init, nameEqStrToVoteArray, nameEqStrToVoteArray, percentHexify, readVotes, registerImpl, resultsHTMLDisplay, sort, urlEncode, voteNameEqStr, voteOrderSpec, voteRating, voteSpecToNameVoteArray, winnerSummaryHTMLTable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ratingFormat
public static java.text.DecimalFormat ratingFormat
NamedIRNR
public NamedIRNR()
voteRating
public void voteRating(NameVotingSystem.NameVote[] vote)
- Description copied from class:
NameVotingSystem
- Vote a set of ratings.
Keys of the map should be strings (choice names) and values should be of a numeric type.
This is slightly faster than the version that takes a map because no conversion is done.
- Specified by:
voteRating
in class NameVotingSystem
- Parameters:
vote
- a set of (name,rating) pairs- See Also:
NameVotingSystem.voteRating(Map)
getWinners
public NameVotingSystem.NameVote[] getWinners()
- Specified by:
getWinners
in class NameVotingSystem
- Returns:
- A sorted array of (name,rating) pairs. Ties can be determined by rating.
getWinners
public NameVotingSystem.NameVote[] getWinners(java.lang.StringBuffer explainb)
htmlSummary
public java.lang.StringBuffer htmlSummary(java.lang.StringBuffer sb)
- Description copied from class:
NameVotingSystem
- Get HTML summary of voting system state.
- Specified by:
htmlSummary
in class NameVotingSystem
- Parameters:
sb
- a valid StringBuffer to which HTML summary will be appended.
- Returns:
- same StringBuffer passed in, with HTML summary of voting system state appended.
htmlExplain
public java.lang.StringBuffer htmlExplain(java.lang.StringBuffer sb)
- Description copied from class:
NameVotingSystem
- Get HTML explaination of how the election worked.
Typically show intermediate rounds or other counting state progress.
Default implementation calls
NameVotingSystem.htmlSummary(StringBuffer)
.
Can be optionally overrided for extra educational benefit.
It may be really slow.
It may be a complete re-implementation of the election method that emits stuff as it goes.
- Overrides:
htmlExplain
in class NameVotingSystem
- Parameters:
sb
- a valid StringBuffer to which HTML explaination will be appended.
- Returns:
- same StringBuffer passed in, with HTML explaination of voting system process appended.
name
public java.lang.String name()
- Specified by:
name
in class NameVotingSystem
- Returns:
- name of this voting system (may be modified by settings from init)