|
|||||||||
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.Histogram
public class Histogram
Collects votes and presents HTML histograms.
Field Summary | |
---|---|
java.lang.String |
barImgUrl
URL to insert in generated Histogram HTML. |
static java.lang.String |
defaultValueTitle
|
boolean |
useSpan
|
java.lang.String |
valueTitle
|
Fields inherited from class org.bolson.vote.VotingSystem |
---|
debug, NO_VOTE, numc |
Constructor Summary | |
---|---|
Histogram(int numc)
|
|
Histogram(int numcIn,
int nbuck,
double min,
double max)
|
Method Summary | |
---|---|
void |
addRanking(int[] rankings)
|
void |
addRating(double[] ratings)
|
void |
addRating(float[] ratings)
|
void |
addRating(int[] ratings)
|
void |
clear()
|
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 VotingSystem |
java.lang.String |
toString()
|
java.lang.String |
toString(int style,
java.lang.String[] names)
|
java.lang.String |
toString(java.lang.String[] names)
A more interesting representation. |
int |
voteRanking(int[] rankings)
|
int |
voteRating(double[] ratings)
|
int |
voteRating(float[] ratings)
|
int |
voteRating(int[] ratings)
|
Methods inherited from class org.bolson.vote.VotingSystem |
---|
checkRatedVote, getDebugHTML, getDebugText, getNumberOfCandidates, getWinners, getWinners, isValidRankedVote, isValidRatedVote, name, 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 |
---|
public java.lang.String barImgUrl
public boolean useSpan
public static java.lang.String defaultValueTitle
public java.lang.String valueTitle
Constructor Detail |
---|
public Histogram(int numcIn, int nbuck, double min, double max)
public Histogram(int numc)
Method Detail |
---|
public VotingSystem init(java.lang.String[] argv)
VotingSystem
init
in class VotingSystem
vs = (new VS(numc)).init( new String[]{"blah", "grunt"} );
public void clear()
public int voteRanking(int[] rankings)
voteRanking
in class VotingSystem
rankings
- 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 void addRanking(int[] rankings)
public int voteRating(int[] ratings)
voteRating
in class VotingSystem
ratings
- 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 void addRating(int[] ratings)
public int voteRating(float[] ratings)
voteRating
in class VotingSystem
ratings
- 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 void addRating(float[] ratings)
public int voteRating(double[] ratings)
voteRating
in class VotingSystem
ratings
- 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 void addRating(double[] ratings)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int style, java.lang.String[] names)
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 toString(java.lang.String[] names)
VotingSystem
toString
in class VotingSystem
names
- The names of the choices.
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(int numSeats)
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
numSeats
- the number of seats available.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |