|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gswing.components.common.Result
public class Result
Purpose: Represents a single constituency or regional result.
Field Summary | |
---|---|
static char |
CONSTITUENCY
Constituency election result type. |
static char |
COUNCIL
Regional election result type. |
protected Vector<Entry> |
entries
Holds all result entries. |
protected static String |
GAIN
Result gain string. |
protected static String |
HOLD
Result hold string. |
static char |
INVALID
Invalid election result type. |
static char |
LOCAL
Local election result type. |
protected int |
m_electorate
Size of the electorate. |
protected String |
m_result
The actual result. |
protected int |
m_totalVotes
Total votes cast. |
protected int |
m_turnout
The size of the electorate. |
static char |
NATIONAL
Overall election result type. |
static char |
REGIONAL
Regional election result type. |
protected static String |
WIN
Result win string. |
Constructor Summary | |
---|---|
Result(Constituency constituency)
Constructor. |
Method Summary | |
---|---|
void |
add(Entry entry)
Add an entry to the result. |
void |
calculateResult(String previousWinner)
Work out the result. |
protected void |
calculateWinner(String previousWinner)
Is this a win, hold or gain. |
Vector |
cloneEntries()
Clone entries vector. |
Entry |
elementAt(int i)
Get the entry at this index. |
Constituency |
getConstituency()
Get the constituency of this result. |
Election |
getElection()
Set the election data for this result. |
int |
getElectorate()
Get the number of voters eligible to vote in this constituency. |
Vector |
getEntries()
Get all entries in this result. |
int |
getIndex()
Set the index of this result in relation to other results of the same constituency. |
int |
getMajority()
Get the size of the mojority in this result. |
int |
getPercentage(String party)
Returns the percentage of the specified party. |
String |
getResult()
Get this result. |
int |
getTotalVotes()
Get total number of votes cast in this constituency. |
int |
getTurnout()
Gets the percentage of eligible voters who participated in the election. |
char |
getType()
What type of result is this - Constituency, regional or overall. |
Party |
getWinningParty()
Get the winning party. |
boolean |
isLatest()
Get whether this result is the latest in the database. |
boolean |
isOldest()
Get whether this result is the oldest in the database. |
void |
removeEntries()
Remove all entries. |
void |
setElection(Election election)
Set the election data of this result. |
void |
setElectorate(int electorate)
The number of voters eligible to vote in this constituency. |
void |
setIndex(int index)
Set the index of this result in relation to other results of the same constituency. |
void |
setIsLatest(boolean isLatest)
Set whether this result is the latest result in the database. |
void |
setIsOldest(boolean isOldest)
Set whether this result is the oldest result in the database. |
void |
setTurnout(int turnout)
Sets the percentage of eligible voters who participated in the election. |
int |
size()
Get the number of entries in this result. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String WIN
protected static final String HOLD
protected static final String GAIN
public static final char INVALID
public static final char NATIONAL
public static final char REGIONAL
public static final char COUNCIL
public static final char CONSTITUENCY
public static final char LOCAL
protected Vector<Entry> entries
protected String m_result
protected int m_electorate
protected int m_totalVotes
protected int m_turnout
Constructor Detail |
---|
public Result(Constituency constituency)
constituency
- The constituency name.Method Detail |
---|
public void add(Entry entry)
entry
- An entry representing a candidates vote.public int size()
public Entry elementAt(int i)
i
- The entry index.
public Constituency getConstituency()
public Party getWinningParty()
public int getMajority()
public void calculateResult(String previousWinner)
previousWinner
- The party of the previous winner of this
constituency.protected void calculateWinner(String previousWinner)
previousWinner
- The party of the previous winner of this
constituency.public int getPercentage(String party)
party
- The party name.
public void setElection(Election election)
election
- The election data.public Election getElection()
public String getResult()
public void setIsLatest(boolean isLatest)
isLatest
- Whether this is the latest result.public boolean isLatest()
public void setIsOldest(boolean isOldest)
isOldest
- Whether this is the oldest result.public boolean isOldest()
public void setIndex(int index)
index
- The result index.public int getIndex()
public int getTotalVotes()
public void setTurnout(int turnout)
turnout
- The percentage turnout as an integer.public int getTurnout()
public Vector getEntries()
public void removeEntries()
public Vector cloneEntries()
public char getType()
public void setElectorate(int electorate)
electorate
- The number of eligible voters.public int getElectorate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |