com.planet_ink.coffee_mud.Common
Class DefaultPoll

java.lang.Object
  extended by com.planet_ink.coffee_mud.Common.DefaultPoll
All Implemented Interfaces:
CMCommon, Poll, CMObject, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class DefaultPoll
extends java.lang.Object
implements Poll


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Common.interfaces.Poll
Poll.PollOption, Poll.PollResult
 
Field Summary
protected  java.lang.String author
           
protected  long bitmap
           
protected  java.lang.String description
           
protected  long expiration
           
 boolean loaded
           
protected  java.lang.String name
           
protected  java.util.List<Poll.PollOption> options
           
protected  java.lang.String qualZapper
           
protected  java.util.List<Poll.PollResult> results
           
protected  java.lang.String subject
           
 
Fields inherited from interface com.planet_ink.coffee_mud.Common.interfaces.Poll
FLAG_ABSTAIN, FLAG_ACTIVE, FLAG_HIDERESULTS, FLAG_NOTATLOGIN, FLAG_PREVIEWRESULTS, FLAG_VOTEBYIP
 
Constructor Summary
DefaultPoll()
           
 
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.
 int compareTo(CMObject o)
           
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 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.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 void initializeClass()
          Called ONCE after all objects are loaded, but before the map is read in during initialization.
 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.
 java.lang.String name()
          The displayable name of this object.
 CMObject newInstance()
          Returns a new instance of this class.
 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loaded

public boolean loaded

name

protected java.lang.String name

subject

protected java.lang.String subject

description

protected java.lang.String description

author

protected java.lang.String author

expiration

protected long expiration

bitmap

protected long bitmap

qualZapper

protected java.lang.String qualZapper

options

protected java.util.List<Poll.PollOption> options

results

protected java.util.List<Poll.PollResult> results
Constructor Detail

DefaultPoll

public DefaultPoll()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, Tech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Returns:
the name of this class

name

public java.lang.String name()
Description copied from interface: CMObject
The displayable name of this object. May be modified by phyStats() object. Is derived from the Name().

Specified by:
name in interface CMObject
Returns:
the modified final name of this object on the map.
See Also:
Environmental.Name()

newInstance

public CMObject newInstance()
Description copied from interface: CMObject
Returns a new instance of this class.

Specified by:
newInstance in interface CMObject
Returns:
a new instance of this class

initializeClass

public void initializeClass()
Description copied from interface: CMObject
Called ONCE after all objects are loaded, but before the map is read in during initialization.

Specified by:
initializeClass in interface CMObject

compareTo

public int compareTo(CMObject o)
Specified by:
compareTo in interface java.lang.Comparable<CMObject>

copyOf

public CMObject copyOf()
Description copied from interface: CMObject
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.

Specified by:
copyOf in interface CMObject
Returns:
a clone of this object

loaded

public boolean loaded()
Description copied from interface: Poll
Returns whether the PollOption and PollResult objects have already been loaded and populated into this object from the database.

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

setLoaded

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

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

getName

public java.lang.String getName()
Description copied from interface: Poll
A name for this poll, used for internal purposes only.

Specified by:
getName in interface Poll
Returns:
a name for this poll
See Also:
Poll.setName(String)

setName

public void setName(java.lang.String newname)
Description copied from interface: Poll
Sets a name for this poll, used for internal purposes only.

Specified by:
setName in interface Poll
Parameters:
newname - a name for this poll
See Also:
Poll.getName()

getSubject

public java.lang.String getSubject()
Description copied from interface: Poll
Returns the title used when showing poll results.

Specified by:
getSubject in interface Poll
Returns:
the title used when showing poll results.
See Also:
Poll.setSubject(String)

setSubject

public void setSubject(java.lang.String newsubject)
Description copied from interface: Poll
Sets the title used when showing poll results.

Specified by:
setSubject in interface Poll
Parameters:
newsubject - the title used when showing poll results.
See Also:
Poll.getSubject()

getDescription

public java.lang.String getDescription()
Description copied from interface: Poll
Returns the description shown when participating in the poll.

Specified by:
getDescription in interface Poll
Returns:
the description shown when participating in the poll.
See Also:
Poll.setDescription(String)

setDescription

public void setDescription(java.lang.String newdescription)
Description copied from interface: Poll
Sets the description shown when participating in the poll.

Specified by:
setDescription in interface Poll
Parameters:
newdescription - the description shown when participating in the poll.
See Also:
Poll.getDescription()

getAuthor

public java.lang.String getAuthor()
Description copied from interface: Poll
Returns the Name of the creator of this poll.

Specified by:
getAuthor in interface Poll
Returns:
the Name of the creator of this poll.
See Also:
Poll.setAuthor(String)

setAuthor

public void setAuthor(java.lang.String newname)
Description copied from interface: Poll
Sets the Name of the creator of this poll.

Specified by:
setAuthor in interface Poll
Parameters:
newname - the Name of the creator of this poll.
See Also:
Poll.getAuthor()

getFlags

public long getFlags()
Description copied from interface: Poll
Returns a bitmap of flags related to this poll.

Specified by:
getFlags in interface Poll
Returns:
a bitmap of flags related to this poll.
See Also:
Poll.setFlags(long), Poll.FLAG_ABSTAIN, Poll.FLAG_ACTIVE

setFlags

public void setFlags(long flag)
Description copied from interface: Poll
Sets a bitmap of flags related to this poll.

Specified by:
setFlags in interface Poll
Parameters:
flag - a bitmap of flags related to this poll.
See Also:
Poll.getFlags(), Poll.FLAG_ABSTAIN, Poll.FLAG_ACTIVE

getQualZapper

public java.lang.String getQualZapper()
Description copied from interface: Poll
Returns a zapper mask string to mask out valid participants.

Specified by:
getQualZapper in interface Poll
Returns:
a zapper mask string to mask out valid participants.
See Also:
Poll.setQualZapper(String), MaskingLibrary.maskCheck(String, Environmental, boolean)

setQualZapper

public void setQualZapper(java.lang.String newZap)
Description copied from interface: Poll
Sets a zapper mask string to mask out valid participants.

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

getExpiration

public long getExpiration()
Description copied from interface: Poll
Returns the time, in millis since 1970, that this poll expires.

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

setExpiration

public void setExpiration(long time)
Description copied from interface: Poll
Sets the time, in millis since 1970, that this poll expires.

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

getOptions

public java.util.List<Poll.PollOption> getOptions()
Description copied from interface: Poll
Returns a list of PollOption objects denoting the poll choices.

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

setOptions

public void setOptions(java.util.List<Poll.PollOption> V)
Description copied from interface: Poll
Sets a list of PollOption objects denoting the poll choices.

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

getResults

public java.util.List<Poll.PollResult> getResults()
Description copied from interface: Poll
Returns a list of PollResult objects renoting all poll votes.

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

setResults

public void setResults(java.util.List<Poll.PollResult> V)
Description copied from interface: Poll
Sets a list of PollResult objects renoting all poll votes.

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

getOptionsXML

public java.lang.String getOptionsXML()
Description copied from interface: Poll
Returns a String of PollOption objects rendered as an XML document.

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

getResultsXML

public java.lang.String getResultsXML()
Description copied from interface: Poll
Returns a String of PollResult objects rendered as an XML document.

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

getMyVote

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

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

addVoteResult

public void addVoteResult(Poll.PollResult R)
Description copied from interface: Poll
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.

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

mayIVote

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

Specified by:
mayIVote in interface Poll
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:
Poll.getMyVote(MOB), Poll.FLAG_VOTEBYIP, Poll.FLAG_ACTIVE

mayISeeResults

public boolean mayISeeResults(MOB mob)
Description copied from interface: Poll
Returns true if the given mob may not see the poll results, false otherwise.

Specified by:
mayISeeResults in interface Poll
Parameters:
mob - the mob to check for elligibility
Returns:
true if the given mob can not see the poll results, false otherwise
See Also:
Poll.FLAG_HIDERESULTS, Poll.FLAG_PREVIEWRESULTS