com.planet_ink.coffee_mud.Common.interfaces
Interface Poll

All Superinterfaces:
java.lang.Cloneable, CMCommon, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
DefaultPoll

public interface Poll
extends CMCommon

A Poll object manages the data and processes for all of the public and private voting polls available through the CoffeeMud POLL CREATE POLL, LIST POLLS, etc.. commands. These objects are managed by the PollManager Library

See Also:
PollManager, CMLib.polls()

Nested Class Summary
static class Poll.PollOption
          A class to represent a single choosable option for this poll.
static class Poll.PollResult
          A class to represent a single vote by a single user in this poll.
 
Field Summary
static int FLAG_ABSTAIN
          bitmask poll flag denoting that players may select to abstain from a vote
static int FLAG_ACTIVE
          bitmask poll flag denoting that the poll is ready to receive votes
static int FLAG_HIDERESULTS
          bitmask poll flag denoting that players may never seen the results of the poll
static int FLAG_NOTATLOGIN
          bitmask poll flag denoting that players will not be given a chance to vote at logon
static int FLAG_PREVIEWRESULTS
          bitmask poll flag denoting that players may preview results before voting
static int FLAG_VOTEBYIP
          bitmask poll flag denoting that a player is considered to have voted if ips match
 
Method Summary
 void addVoteResult(Poll.PollResult R)
          Populates this Poll object if necessary, and adds the given PollResult object that represents a mobs vote in this Poll to the list of results.
 java.lang.String getAuthor()
          Returns the Name of the creator of this poll.
 java.lang.String getDescription()
          Returns the description shown when participating in the poll.
 long getExpiration()
          Returns the time, in millis since 1970, that this poll expires.
 long getFlags()
          Returns a bitmap of flags related to this poll.
 Poll.PollResult getMyVote(MOB mob)
          Populates this Poll object if necessary, and returns the PollResult object that represents the given mobs vote in this Poll, or NULL otherwise.
 java.lang.String getName()
          A name for this poll, used for internal purposes only.
 java.util.List<Poll.PollOption> getOptions()
          Returns a list of PollOption objects denoting the poll choices.
 java.lang.String getOptionsXML()
          Returns a String of PollOption objects rendered as an XML document.
 java.lang.String getQualZapper()
          Returns a zapper mask string to mask out valid participants.
 java.util.List<Poll.PollResult> getResults()
          Returns a list of PollResult objects renoting all poll votes.
 java.lang.String getResultsXML()
          Returns a String of PollResult objects rendered as an XML document.
 java.lang.String getSubject()
          Returns the title used when showing poll results.
 boolean loaded()
          Returns whether the PollOption and PollResult objects have already been loaded and populated into this object from the database.
 boolean mayISeeResults(MOB mob)
          Returns true if the given mob may not see the poll results, false otherwise.
 boolean mayIVote(MOB mob)
          Returns true if the given mob is allowed to vote in this poll, false otherwise.
 void setAuthor(java.lang.String newname)
          Sets the Name of the creator of this poll.
 void setDescription(java.lang.String newdescription)
          Sets the description shown when participating in the poll.
 void setExpiration(long time)
          Sets the time, in millis since 1970, that this poll expires.
 void setFlags(long flag)
          Sets a bitmap of flags related to this poll.
 void setLoaded(boolean truefalse)
          Sets whether the PollOption and PollResult objects have already been loaded and populated into this object from the database.
 void setName(java.lang.String newname)
          Sets a name for this poll, used for internal purposes only.
 void setOptions(java.util.List<Poll.PollOption> V)
          Sets a list of PollOption objects denoting the poll choices.
 void setQualZapper(java.lang.String newZap)
          Sets a zapper mask string to mask out valid participants.
 void setResults(java.util.List<Poll.PollResult> V)
          Sets a list of PollResult objects renoting all poll votes.
 void setSubject(java.lang.String newsubject)
          Sets the title used when showing poll results.
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

FLAG_ACTIVE

static final int FLAG_ACTIVE
bitmask poll flag denoting that the poll is ready to receive votes

See Also:
Constant Field Values

FLAG_PREVIEWRESULTS

static final int FLAG_PREVIEWRESULTS
bitmask poll flag denoting that players may preview results before voting

See Also:
Constant Field Values

FLAG_ABSTAIN

static final int FLAG_ABSTAIN
bitmask poll flag denoting that players may select to abstain from a vote

See Also:
Constant Field Values

FLAG_VOTEBYIP

static final int FLAG_VOTEBYIP
bitmask poll flag denoting that a player is considered to have voted if ips match

See Also:
Constant Field Values

FLAG_HIDERESULTS

static final int FLAG_HIDERESULTS
bitmask poll flag denoting that players may never seen the results of the poll

See Also:
Constant Field Values

FLAG_NOTATLOGIN

static final int FLAG_NOTATLOGIN
bitmask poll flag denoting that players will not be given a chance to vote at logon

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
A name for this poll, used for internal purposes only.

Returns:
a name for this poll
See Also:
setName(String)

setName

void setName(java.lang.String newname)
Sets a name for this poll, used for internal purposes only.

Parameters:
newname - a name for this poll
See Also:
getName()

getSubject

java.lang.String getSubject()
Returns the title used when showing poll results.

Returns:
the title used when showing poll results.
See Also:
setSubject(String)

setSubject

void setSubject(java.lang.String newsubject)
Sets the title used when showing poll results.

Parameters:
newsubject - the title used when showing poll results.
See Also:
getSubject()

getDescription

java.lang.String getDescription()
Returns the description shown when participating in the poll.

Returns:
the description shown when participating in the poll.
See Also:
setDescription(String)

setDescription

void setDescription(java.lang.String newdescription)
Sets the description shown when participating in the poll.

Parameters:
newdescription - the description shown when participating in the poll.
See Also:
getDescription()

getAuthor

java.lang.String getAuthor()
Returns the Name of the creator of this poll.

Returns:
the Name of the creator of this poll.
See Also:
setAuthor(String)

setAuthor

void setAuthor(java.lang.String newname)
Sets the Name of the creator of this poll.

Parameters:
newname - the Name of the creator of this poll.
See Also:
getAuthor()

getFlags

long getFlags()
Returns a bitmap of flags related to this poll.

Returns:
a bitmap of flags related to this poll.
See Also:
setFlags(long), FLAG_ABSTAIN, FLAG_ACTIVE

setFlags

void setFlags(long flag)
Sets a bitmap of flags related to this poll.

Parameters:
flag - a bitmap of flags related to this poll.
See Also:
getFlags(), FLAG_ABSTAIN, FLAG_ACTIVE

getQualZapper

java.lang.String getQualZapper()
Returns a zapper mask string to mask out valid participants.

Returns:
a zapper mask string to mask out valid participants.
See Also:
setQualZapper(String), MaskingLibrary.maskCheck(String, Environmental, boolean)

setQualZapper

void setQualZapper(java.lang.String newZap)
Sets a zapper mask string to mask out valid participants.

Parameters:
newZap - a zapper mask string to mask out valid participants.
See Also:
getQualZapper(), MaskingLibrary.maskCheck(String, Environmental, boolean)

getExpiration

long getExpiration()
Returns the time, in millis since 1970, that this poll expires.

Returns:
the time, in millis since 1970, that this poll expires.
See Also:
setExpiration(long)

setExpiration

void setExpiration(long time)
Sets the time, in millis since 1970, that this poll expires.

Parameters:
time - the time, in millis since 1970, that this poll expires.
See Also:
getExpiration()

getOptions

java.util.List<Poll.PollOption> getOptions()
Returns a list of PollOption objects denoting the poll choices.

Returns:
a list of PollOption objects denoting the poll choices.
See Also:
setOptions(List), Poll.PollOption

setOptions

void setOptions(java.util.List<Poll.PollOption> V)
Sets a list of PollOption objects denoting the poll choices.

Parameters:
V - a list of PollOption objects denoting the poll choices.
See Also:
getOptions(), Poll.PollOption

getResults

java.util.List<Poll.PollResult> getResults()
Returns a list of PollResult objects renoting all poll votes.

Returns:
a list of PollResult objects renoting all poll votes.
See Also:
getResults(), Poll.PollResult

setResults

void setResults(java.util.List<Poll.PollResult> V)
Sets a list of PollResult objects renoting all poll votes.

Parameters:
V - a list of PollResult objects renoting all poll votes.
See Also:
getResults(), Poll.PollResult

getOptionsXML

java.lang.String getOptionsXML()
Returns a String of PollOption objects rendered as an XML document.

Returns:
a String of PollOption objects rendered as an XML document.
See Also:
getOptions(), Poll.PollOption, PollManager.loadPollIfNecessary(Poll)

getResultsXML

java.lang.String getResultsXML()
Returns a String of PollResult objects rendered as an XML document.

Returns:
a String of PollResult objects rendered as an XML document.
See Also:
getResults(), Poll.PollResult, PollManager.loadPollIfNecessary(Poll)

loaded

boolean loaded()
Returns whether the PollOption and PollResult objects have already been loaded and populated into this object from the database.

Returns:
true returns true if this object is fully populated from the database
See Also:
setLoaded(boolean), PollManager.loadPollIfNecessary(Poll)

setLoaded

void setLoaded(boolean truefalse)
Sets whether the PollOption and PollResult objects have already been loaded and populated into this object from the database.

Parameters:
truefalse - set to true if this object is fully populated from the database
See Also:
loaded(), PollManager.loadPollIfNecessary(Poll)

getMyVote

Poll.PollResult getMyVote(MOB mob)
Populates this Poll object if necessary, and returns the PollResult object that represents the given mobs vote in this Poll, or NULL otherwise.

Parameters:
mob - the mob to find a result object for
Returns:
the PollResult object denoting this mobs vote
See Also:
PollManager.loadPollIfNecessary(Poll), addVoteResult(com.planet_ink.coffee_mud.Common.interfaces.Poll.PollResult), Poll.PollResult

addVoteResult

void addVoteResult(Poll.PollResult R)
Populates this Poll object if necessary, and adds the given PollResult object that represents a mobs vote in this Poll to the list of results.

Parameters:
R - the particular vote by a particular mob to add
See Also:
PollManager.loadPollIfNecessary(Poll), getMyVote(MOB), Poll.PollResult

mayIVote

boolean mayIVote(MOB mob)
Returns true if the given mob is allowed to vote in this poll, false otherwise. Always returns false if getMyVote(mob)!=null.

Parameters:
mob - the mob to check for elligibility
Returns:
true if the given mob is allowed to vote in this poll, false otherwise.
See Also:
getMyVote(MOB), FLAG_VOTEBYIP, FLAG_ACTIVE

mayISeeResults

boolean mayISeeResults(MOB mob)
Returns true if the given mob may not see the poll results, false otherwise.

Parameters:
mob - the mob to check for elligibility
Returns:
true if the given mob can not see the poll results, false otherwise
See Also:
FLAG_HIDERESULTS, FLAG_PREVIEWRESULTS