Server.Election Class
Implementation for a single election, which has a string name and a list of candidates and count of votes for each candidate. Public methods called by the election server manager (results and exceptions are sent to the display), and methods called by Worker threads. <br/><br/> All methods declared synchronized to ensure the correct concurrency control between multiple threads.

Access: Public
Base Classes: Object
  Members Description  
    CLOSED    
    OPEN    
    name Name of the election

 
    candidates    
    votes    
    status    
    Election Constructor.

 
    addCandidate Adds a candidate to the election. <c>This</c> object is locked for any other threads when this function is called.

 
    getCandidates Returns the list of the candidates. <c>This</c> object is locked for any other threads when this function is called.

 
    open Opens the election. Raises <c>DisplayException</c> if the election is already open. Resets the number of votes for each candidate to 0. <c>This</c> object is locked for any other threads when this function is called.

 
    close Closes the election.

 
    view Sets the <c>ServerDisplay</c> to display the results of the election

 
    vote Adds an additional vote for the candidate

 
    isOpen Checks if the election is open