|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bolson.vote.VotingSystem
org.bolson.vote.EmptyVotingSystem
public class EmptyVotingSystem
Empty code for copying before making a new VotingSystem.
| Field Summary |
|---|
| Fields inherited from class org.bolson.vote.VotingSystem |
|---|
debug, NO_VOTE, numc |
| Constructor Summary | |
|---|---|
EmptyVotingSystem(int numCandidates)
In addition to interfaced methods, there shall be a constructor taking the integer number N of choices to be voted on. |
|
| Method Summary | |
|---|---|
int[] |
getWinners()
Do processing if necessary, return winners. |
int[] |
getWinners(int numSeats)
Do processing if necessary, return winners. |
java.lang.String |
htmlSummary(java.lang.String[] names)
A fancy html representation. |
VotingSystem |
init(java.lang.String[] argv)
Arguments to modify behavior of EmptyVotingSystem |
java.lang.String |
name()
Return name of this voting system. |
java.lang.String |
toString(java.lang.String[] names)
A more interesting representation. |
int |
voteRanking(int[] ranking)
|
int |
voteRating(double[] rating)
|
int |
voteRating(float[] rating)
|
int |
voteRating(int[] rating)
|
| Methods inherited from class org.bolson.vote.VotingSystem |
|---|
checkRatedVote, getDebugHTML, getDebugText, getNumberOfCandidates, 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, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EmptyVotingSystem(int numCandidates)
| Method Detail |
|---|
public VotingSystem init(java.lang.String[] argv)
init in class VotingSystemvs = (new VS(numc)).init( new String[]{"blah", "grunt"} );public int voteRating(int[] rating)
voteRating in class VotingSystemrating - 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 VotingSystemrating - 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 VotingSystemrating - 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 voteRanking(int[] ranking)
voteRanking in class VotingSystemranking - An array int[N].
ranking[i] is the ranking of choice i.
rankings are 1 (most preferred) through N (least).
INT_MAX, N, or NO_VOTE for unspecified.
public int[] getWinners()
getWinners in class VotingSystempublic int[] getWinners(int numSeats)
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 VotingSystemnumSeats - the number of seats available.
public java.lang.String toString(java.lang.String[] names)
toString in class VotingSystemnames - The names of the choices.
public java.lang.String htmlSummary(java.lang.String[] names)
htmlSummary in class VotingSystemnames - The names of the choices. May be null.
public java.lang.String name()
VotingSystem
name in class VotingSystem
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||