org.bolson.vote
Class vote

java.lang.Object
  extended by org.bolson.vote.vote

public class vote
extends java.lang.Object

Command line app for processing votes.


Constructor Summary
vote()
           
 
Method Summary
static java.lang.Object CListToNumberArray(java.lang.String cd, int numc, java.util.Hashtable namehash)
           
 void displayTab()
           
 void initHistogram()
           
static void main(java.lang.String[] argv)
           
static java.lang.String[] namehashToNameArray(java.util.Hashtable namehash)
           
static java.lang.String[] namehashToNameArray(java.util.Hashtable namehash, int numc)
           
static void printVote(float[] pf)
           
static void printVote(int[] pf)
           
 java.lang.String[] readArgv(java.lang.String[] argv)
           
static void resultsHTMLDisplay(java.io.PrintWriter out, VotingSystem[] vs, java.lang.String[] cnames, boolean debug, int numSeats)
          Print full results.
 void setNames(java.lang.String[] namesi)
           
static java.lang.Object StringToNumberArray(java.lang.String votes, int len)
           
static java.lang.String stripNonDig(java.lang.String s)
          utility to StringToNumberArray and CListToNumberArray
 void voteFloatFromVoteSource(org.bolson.vote.vote.VoteSource vs)
           
 void voteFromTextFile(java.lang.String filename)
           
 void voteFromVoteSource(org.bolson.vote.vote.VoteSource vs)
           
 void voteFromVoteSourceWithInit(org.bolson.vote.vote.VoteSource vs)
           
 void voteIntFromVoteSource(org.bolson.vote.vote.VoteSource vs)
           
 void voteOne(float[] pf)
           
 void voteOne(int[] pi)
           
 void voteReader(java.io.Reader r)
           
 void voteStream(java.io.DataInputStream dis)
           
 void voteStream(java.io.InputStream is)
           
static void winnerSummaryHTMLTable(java.io.PrintWriter out, VotingSystem[] vs, java.lang.String[] cnames, boolean debug, int numSeats)
          Print summary table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

vote

public vote()
Method Detail

stripNonDig

public static java.lang.String stripNonDig(java.lang.String s)
utility to StringToNumberArray and CListToNumberArray


StringToNumberArray

public static java.lang.Object StringToNumberArray(java.lang.String votes,
                                                   int len)

CListToNumberArray

public static java.lang.Object CListToNumberArray(java.lang.String cd,
                                                  int numc,
                                                  java.util.Hashtable namehash)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

namehashToNameArray

public static java.lang.String[] namehashToNameArray(java.util.Hashtable namehash)

namehashToNameArray

public static java.lang.String[] namehashToNameArray(java.util.Hashtable namehash,
                                                     int numc)

initHistogram

public void initHistogram()

voteStream

public void voteStream(java.io.InputStream is)

voteStream

public void voteStream(java.io.DataInputStream dis)

voteReader

public void voteReader(java.io.Reader r)

voteFromTextFile

public void voteFromTextFile(java.lang.String filename)
                      throws java.lang.Exception
Throws:
java.lang.Exception

voteFromVoteSourceWithInit

public void voteFromVoteSourceWithInit(org.bolson.vote.vote.VoteSource vs)

printVote

public static void printVote(float[] pf)

printVote

public static void printVote(int[] pf)

voteOne

public void voteOne(float[] pf)

voteOne

public void voteOne(int[] pi)

voteFloatFromVoteSource

public void voteFloatFromVoteSource(org.bolson.vote.vote.VoteSource vs)

voteIntFromVoteSource

public void voteIntFromVoteSource(org.bolson.vote.vote.VoteSource vs)

voteFromVoteSource

public void voteFromVoteSource(org.bolson.vote.vote.VoteSource vs)

winnerSummaryHTMLTable

public static void winnerSummaryHTMLTable(java.io.PrintWriter out,
                                          VotingSystem[] vs,
                                          java.lang.String[] cnames,
                                          boolean debug,
                                          int numSeats)
Print summary table. prints a table just containing each VotingSystem name and its winner.

Parameters:
out - receives the html table
vs - systems that have been voted and can getWinners
cnames - choice names to match with winner indecies
debug - sets if getWinners is to collect debug info
numSeats - number of seats available in this election

resultsHTMLDisplay

public static void resultsHTMLDisplay(java.io.PrintWriter out,
                                      VotingSystem[] vs,
                                      java.lang.String[] cnames,
                                      boolean debug,
                                      int numSeats)
Print full results. Prints each VotingSystem's html summary.

Parameters:
out - receives the html results
vs - systems that have been voted and can getWinners
cnames - choice names to match with winner indecies
debug - sets if getWinners is to collect debug info
numSeats - number of seats available in this election

displayTab

public void displayTab()

main

public static void main(java.lang.String[] argv)

readArgv

public java.lang.String[] readArgv(java.lang.String[] argv)
Parameters:
argv - like main()
Returns:
unused arguments (filenames)

setNames

public void setNames(java.lang.String[] namesi)