votorola.a.election
Class CR_Vote

java.lang.Object
  extended by CommandResponder.Base
      extended by CR_Vote
All Implemented Interfaces:
CommandResponder
Direct Known Subclasses:
CR_Unvote

public class CR_Vote
extends CommandResponder.Base

Responder for the command 'vote' - to cast a vote in an election.

See Also:
http://zelea.com/project/votorola/a/mail/guide.xht#vote

Nested Class Summary
(package private) static class CR_Vote.CachedCountNodeTable
          A count-node table that caches its nodes.
(package private) static class CR_Vote.TracePair
          A pair of vote traces: the old trace, as of last count; and a newly projected trace, based on the voter's subsequent input (if any).
 
Nested classes/interfaces inherited from interface CommandResponder
CommandResponder.AnonymousIssueException, CommandResponder.Base, CommandResponder.Session, CommandResponder.X
 
Field Summary
 
Fields inherited from class CommandResponder.Base
electoralService, keyPrefix
 
Constructor Summary
CR_Vote(Election election)
          Constructs a CR_Vote.
CR_Vote(Election election, String keyPrefix)
          Constructs a CR_Vote as a subclass.
 
Method Summary
protected  void commitVoteAndEcho(String newCandidateEmail, Vote vote, CommandResponder.Session session)
          Changes and commits the voter's vote, and appends an echo of the change to the reply.
(package private) static HashMap<String,Option> compileOptions(CommandResponder.Session session)
          Compiles a map of launch options.
(package private)  void echoTraces(Vote vote, CommandResponder.Session session)
          Appends vote traces to the reply.
protected  Election election()
           
(package private) static String finalRecipientOrNobody(CountNode[] trace, ResourceBundle b)
           
 void help(CommandResponder.Session session)
          Calls X.
 Exception respond(String[] argv, CommandResponder.Session session)
          Responds to an invocation of the command.
 
Methods inherited from class CommandResponder.Base
acceptsAnonymousIssue, canonicalEmail, commandName, compileBaseOptions, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CR_Vote

CR_Vote(Election election)
Constructs a CR_Vote.


CR_Vote

CR_Vote(Election election,
        String keyPrefix)
Constructs a CR_Vote as a subclass.

Method Detail

help

public void help(CommandResponder.Session session)
Description copied from class: CommandResponder.Base
Calls X.helpDefault(keyPrefix,session).

Specified by:
help in interface CommandResponder
Overrides:
help in class CommandResponder.Base

respond

public Exception respond(String[] argv,
                         CommandResponder.Session session)
Description copied from interface: CommandResponder
Responds to an invocation of the command.

Parameters:
argv - array of command name (index 0) and any arguments (indeces 1..*)
Returns:
any soft exception, of temporary cause (which might clear up on a retry); or null if none occured

commitVoteAndEcho

protected void commitVoteAndEcho(String newCandidateEmail,
                                 Vote vote,
                                 CommandResponder.Session session)
                          throws SQLException,
                                 VoterInputTable.BadInputException
Changes and commits the voter's vote, and appends an echo of the change to the reply.

Parameters:
session - with wrapping turned off in its reply builder
Throws:
SQLException
VoterInputTable.BadInputException

compileOptions

static HashMap<String,Option> compileOptions(CommandResponder.Session session)
Compiles a map of launch options.


echoTraces

void echoTraces(Vote vote,
                CommandResponder.Session session)
          throws IOException,
                 NoSuchMethodException,
                 ScriptException,
                 SQLException
Appends vote traces to the reply. Appends a first trace identical to that of the last count (if any); plus a second trace adjusted for subsequent changes, if any.

Parameters:
session - with wrapping turned off in its reply builder
Throws:
IOException
NoSuchMethodException
ScriptException
SQLException

election

protected Election election()

finalRecipientOrNobody

static String finalRecipientOrNobody(CountNode[] trace,
                                     ResourceBundle b)