jimm.evote
Class ElectionDay

java.lang.Object
  extended byjimm.evote.ElectionDay

public class ElectionDay
extends java.lang.Object

Simulates election day voting. The method simulateVoting(jimm.evote.VoteServer) creates a bunch of voting Booths, has them generate votes, and sends all of the booths' votes to a VoteServer.


Field Summary
protected  int boothAddress
           
protected  java.util.Random rand
           
 
Constructor Summary
(package private) ElectionDay()
           
 
Method Summary
protected  byte[] asQuadByteArray(int address)
          Returns an int as a quad byte array.
protected  Booth createBooth()
          Creates and returns a voting booth.
static void main(java.lang.String[] args)
          Simulates election day voting.
protected  void sendVotesToServer(java.util.List booths, VoteServer server)
          Sends votes to a vote server using multiple threads so the server gets concurrent updates.
 void simulateVoting(VoteServer server)
          Simulates election day voting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rand

protected java.util.Random rand

boothAddress

protected int boothAddress
Constructor Detail

ElectionDay

ElectionDay()
Method Detail

simulateVoting

public void simulateVoting(VoteServer server)
Simulates election day voting. Creates voting booths, generates votes for each booth, and sends the votes to the server. Votes are sent from booths in num_threads chunks, each in a separate thread. num_threads is a parameter read from the properties file.

Parameters:
server - a vote server

createBooth

protected Booth createBooth()
Creates and returns a voting booth. The booth's address is unique.

Returns:
a new voting booth

asQuadByteArray

protected byte[] asQuadByteArray(int address)
Returns an int as a quad byte array.


sendVotesToServer

protected void sendVotesToServer(java.util.List booths,
                                 VoteServer server)
Sends votes to a vote server using multiple threads so the server gets concurrent updates.


main

public static void main(java.lang.String[] args)
Simulates election day voting.

usage: ElectionDay /path/to/database/directory



Copyright (c) 2004 by Jim Menard jimm@io.com