|
|||||||||
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.RankedVotingSystem org.bolson.vote.STV
public class STV
Single Transferrable Vote, IRV for multi-seat elections.
Nested Class Summary | |
---|---|
protected static class |
STV.Ballot
|
Field Summary |
---|
Fields inherited from class org.bolson.vote.VotingSystem |
---|
debug, NO_VOTE, numc |
Constructor Summary | |
---|---|
STV(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 STV |
protected void |
intoBucket(STV.Ballot b)
|
protected void |
intoBucket(java.util.Vector bv)
|
protected void |
intoBucket(java.util.Vector bv,
double weightmod)
|
protected void |
myInit()
|
java.lang.String |
name()
Return name of this voting system. |
static double |
quota(int style,
double votes,
int seats)
|
void |
recountBuckets()
|
void |
resetBuckets()
|
java.lang.String |
toString(java.lang.String[] names)
A more interesting representation. |
int |
voteRanking(int[] ranking)
|
Methods inherited from class org.bolson.vote.RankedVotingSystem |
---|
voteRating, voteRating, voteRating |
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 STV(int numCandidates)
Method Detail |
---|
public static double quota(int style, double votes, int seats)
protected void myInit()
public VotingSystem init(java.lang.String[] argv)
init
in class VotingSystem
vs = (new VS(numc)).init( new String[]{"blah", "grunt"} );
protected void intoBucket(STV.Ballot b)
protected void intoBucket(java.util.Vector bv)
protected void intoBucket(java.util.Vector bv, double weightmod)
public void resetBuckets()
public void recountBuckets()
public int voteRanking(int[] ranking)
voteRanking
in class VotingSystem
ranking
- 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 VotingSystem
public int[] getWinners(int numSeats)
getWinners
in class VotingSystem
numSeats
- the number of seats available.
public java.lang.String toString(java.lang.String[] names)
toString
in class VotingSystem
names
- The names of the choices.
public java.lang.String htmlSummary(java.lang.String[] names)
htmlSummary
in class VotingSystem
names
- 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 |