@ThreadRestricted(value="touch") public final class Vote extends Object implements Cloneable, Serializable
InputTable,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
Vote.CastEvent
An event that records the casting of a vote.
|
static class |
Vote.VotingEvent
An event that records the casting or withdrawal of a vote.
|
static class |
Vote.WithdrawalEvent
An event that records the withdrawal of a vote.
|
| Constructor and Description |
|---|
Vote(IDPair _voter)
Constructs a Vote with default initial data.
|
Vote(IDPair voter,
String xml)
Constructs a Vote from the specified initial data.
|
Vote(IDPair _voter,
VoterInputTable<?> voterInputTable)
Constructs a Vote from an ID pair, reading the initial state from the input table.
|
Vote(String voterEmail)
Constructs a Vote with default initial data.
|
Vote(String voterEmail,
String xml)
Constructs a Vote from the specified initial data.
|
Vote(String voterEmail,
VoterInputTable<?> _voterInputTable)
Constructs a Vote from an email address, reading the initial state from the input
table.
|
| Modifier and Type | Method and Description |
|---|---|
Vote |
clone() |
IDPair |
getCandidate()
The candidate for whom the voter is voting, or NOBODY
if the voter's vote is currently uncast.
|
String |
getCandidateEmail()
Identifies the candidate for whom the voter is voting.
|
byte |
getDartSector()
Returns the dart sector that was last assigned by a count, if any.
|
long |
getTime()
Specifies the time at which the voter last altered this vote.
|
void |
resetTime()
Sets the time at which the voter last altered this vote to the current clock
time.
|
void |
setCandidate(IDPair newCandidate)
Changes the candidate for whom the voter is voting, and resets the timestamp.
|
void |
setCandidateEmail(String newCandidateEmail)
Changes the candidate for whom the voter is voting, and resets the timestamp.
|
void |
setDartSector(int _newSector)
Sets the dart sector.
|
void |
setTime(long newTime)
Sets the time at which the voter last altered this vote.
|
IDPair |
voter()
The voter.
|
String |
voterEmail()
Identifies the voter.
|
(package private) void |
write(VoterInputTable<?> voterInputTable,
ServiceSession userSession)
Writes this vote to the table if it has unwritten changes, or deletes the vote if
it's at default.
|
void |
write(VoterInputTable<?> voterInputTable,
ServiceSession userSession,
boolean toForce)
Writes this vote to the table, or deletes the vote if it's at default.
|
public Vote(IDPair _voter, VoterInputTable<?> voterInputTable) throws SQLException
SQLExceptionpublic Vote(String voterEmail, VoterInputTable<?> _voterInputTable) throws SQLException
SQLExceptionVote(IDPair voter, String xml) throws XMLStreamException
xml - the initial data from the 'xml' column of the input table, or null to use defaults.XMLStreamExceptionpublic Vote(String voterEmail, String xml) throws XMLStreamException
xml - the initial data from the 'xml' column of the input table, or null to use defaults.XMLStreamExceptionpublic IDPair getCandidate()
setCandidate(IDPair)public void setCandidate(IDPair newCandidate)
getCandidate(),
resetTime()public String getCandidateEmail()
public void setCandidateEmail(String newCandidateEmail)
public byte getDartSector()
setDartSector(int),
CountNode.dartSector()public void setDartSector(int _newSector)
getDartSector()public long getTime()
getCandidateEmail(),
setTime(long)public void resetTime()
getTime()public void setTime(long newTime)
getTime()public String voterEmail()
InternetAddressX.canonicalAddress(String)void write(VoterInputTable<?> voterInputTable, ServiceSession userSession) throws SQLException, VoterInputTable.BadInputException
userSession - the session of the user requesting the change, or null if
the change is not user requested.SQLExceptionVoterInputTable.BadInputExceptionpublic void write(VoterInputTable<?> voterInputTable, ServiceSession userSession, boolean toForce) throws SQLException, VoterInputTable.BadInputException
toForce - false to write only if changes were made; true to force the
write regardless.userSession - the session of the user requesting the change, or null if
the change is not user requested.SQLExceptionVoterInputTable.BadInputException