|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bolson.vote.VotingSystem org.bolson.vote.RatedVotingSystem org.bolson.vote.IRNR
public class IRNR
Instant Runoff Normalized Ratings
Field Summary | |
---|---|
protected double[] |
talley
|
Fields inherited from class org.bolson.vote.VotingSystem |
---|
debug, NO_VOTE, numc |
Constructor Summary | |
---|---|
IRNR(int numCandidates)
|
Method Summary | |
---|---|
java.lang.String |
getDebugHTML(java.lang.String[] names)
Return HTML representation of debug data. |
int[] |
getWinners()
Do processing if necessary, return winners. |
int[] |
getWinners(java.io.PrintWriter out)
Print verbose explaination of internal process as it happens. |
int[] |
getWinners(java.io.PrintWriter out,
int numSeats)
Multi-seat IRNR. |
java.lang.String |
htmlSummary(java.lang.String[] names)
A fancy html representation. |
VotingSystem |
init(java.lang.String[] argv)
Arguments to modify behavior of VotingSystem |
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.RatedVotingSystem |
---|
voteRanking |
Methods inherited from class org.bolson.vote.VotingSystem |
---|
checkRatedVote, getDebugText, getNumberOfCandidates, 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 |
Field Detail |
---|
protected double[] talley
Constructor Detail |
---|
public IRNR(int numCandidates)
Method Detail |
---|
public java.lang.String name()
VotingSystem
name
in class VotingSystem
public VotingSystem init(java.lang.String[] argv)
VotingSystem
init
in class VotingSystem
vs = (new VS(numc)).init( new String[]{"blah", "grunt"} );
public int voteRating(int[] rating)
voteRating
in class RatedVotingSystem
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.
public int voteRating(float[] rating)
voteRating
in class VotingSystem
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.
public int voteRating(double[] rating)
voteRating
in class RatedVotingSystem
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.
public int[] getWinners()
VotingSystem
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.
getWinners
in class VotingSystem
public int[] getWinners(java.io.PrintWriter out)
VotingSystem
getWinners
in class VotingSystem
out
- where to print
VotingSystem.getWinners()
,
VotingSystem.debug
,
VotingSystem.getDebugText(String[])
,
VotingSystem.getDebugHTML(String[])
public int[] getWinners(java.io.PrintWriter out, int numSeats)
getWinners
in class VotingSystem
out
- where to print news and diagnosticsnumSeats
- the number of seats available.
VotingSystem.getWinners(int)
,
VotingSystem.debug
,
VotingSystem.getDebugText(String[])
,
VotingSystem.getDebugHTML(String[])
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String[] names)
VotingSystem
toString
in class VotingSystem
names
- The names of the choices.
public java.lang.String htmlSummary(java.lang.String[] names)
VotingSystem
htmlSummary
in class VotingSystem
names
- The names of the choices. May be null.
public java.lang.String getDebugHTML(java.lang.String[] names)
VotingSystem
getDebugHTML
in class VotingSystem
names
- Symbolic names for the choices makes human debugging easier. May be null.
VotingSystem.debug
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |