org.gswing.components.common
Class Entry

java.lang.Object
  extended by org.gswing.components.common.Entry
All Implemented Interfaces:
Serializable, Comparable<Entry>
Direct Known Subclasses:
ConstituencyEntry, ListEntry

public abstract class Entry
extends Object
implements Serializable, Comparable<Entry>

Purpose: Represents an election result entry. That is a single candidate's result.

See Also:
Serialized Form

Constructor Summary
Entry(Election election, int votes)
          Construcor.
 
Method Summary
 int compareTo(Entry ob)
          Compare the number of votes of this entry with another.
 Election getElection()
           
abstract  String getParticipant()
          Get the particpant of the contest.
abstract  Party getParty()
          Get the party object.
abstract  String getPartyName()
          Get the party name.
 int getPercentage()
          Get the percentage of vote.
 int getPosition()
          Get the position of the candidate in relation to others in the same constituency.
 int getVotes()
          Get the number of votes.
 void incrementPosition()
          Add one to the candidates position.
 void setPercentage(int percent)
          Set the percentage of vote.
 void setVotes(int votes)
          Set the number of votes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entry

public Entry(Election election,
             int votes)
Construcor.

Parameters:
election - Reference to the election of this entry.
votes - The number of votes for this candidate.
Method Detail

getPartyName

public abstract String getPartyName()
Get the party name.

Returns:
The name of the party.

getParty

public abstract Party getParty()
Get the party object.

Returns:
The the party object.

getParticipant

public abstract String getParticipant()
Get the particpant of the contest.

Returns:
The contest participant.

getVotes

public int getVotes()
Get the number of votes.

Returns:
The number of votes.

setVotes

public void setVotes(int votes)
Set the number of votes.

Parameters:
votes - The number of votes.

getElection

public Election getElection()
Returns:
Returns the election.

getPercentage

public int getPercentage()
Get the percentage of vote.

Returns:
The percentage of the vote.

setPercentage

public void setPercentage(int percent)
Set the percentage of vote.

Parameters:
percent - The percentage of the vote.

getPosition

public int getPosition()
Get the position of the candidate in relation to others in the same constituency.

Returns:
The candidate's position.

incrementPosition

public void incrementPosition()
Add one to the candidates position.


compareTo

public int compareTo(Entry ob)
Compare the number of votes of this entry with another. This is used for sorting object of this type.

Specified by:
compareTo in interface Comparable<Entry>
Parameters:
ob - The object to compare.
Returns:
1 if the number of votes for this entry is lower else return -1.


Copyright © 2008. All Rights Reserved.