Class Message

java.lang.Object
  |
  +--Message
All Implemented Interfaces:
java.io.Serializable

public class Message
extends java.lang.Object
implements java.io.Serializable

A message class for sending data across the network: defines message types and constructors for messages. A message is just a type plus a list of fields for the message, you can interpret it however you want.

This might be done more cleanly with an abstract message class and subclasses for different types, but since there is no processing associated with message types, this implementation is simpler!

See Also:
Serialized Form

Field Summary
static int ACK_VOTE
          We got your vote
static int BAD_CANDIDATE
          Bad candidate name given for vote request
static int BAD_ELECTION
          Bad election name given (closed or nonexistent)
static int ERROR
          Miscellaneous error, not currently used for anything
 java.util.LinkedList items
          Fields of the message
static int LIST_CANDIDATES
          Here is the list of candidates
static int QUERY_CANDIDATES
          Give me the list of candidates for the named election
static int SEND_VOTE
          Here is my vote for election + candidate
 int type
          Type of this message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
Miscellaneous error, not currently used for anything

See Also:
Constant Field Values

BAD_ELECTION

public static final int BAD_ELECTION
Bad election name given (closed or nonexistent)

See Also:
Constant Field Values

BAD_CANDIDATE

public static final int BAD_CANDIDATE
Bad candidate name given for vote request

See Also:
Constant Field Values

QUERY_CANDIDATES

public static final int QUERY_CANDIDATES
Give me the list of candidates for the named election

See Also:
Constant Field Values

LIST_CANDIDATES

public static final int LIST_CANDIDATES
Here is the list of candidates

See Also:
Constant Field Values

SEND_VOTE

public static final int SEND_VOTE
Here is my vote for election + candidate

See Also:
Constant Field Values

ACK_VOTE

public static final int ACK_VOTE
We got your vote

See Also:
Constant Field Values

type

public int type
Type of this message


items

public java.util.LinkedList items
Fields of the message