|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.vizzini.game.AbstractToken
public abstract class AbstractToken
Provides base functionality for tokens in the game framework. A token instance encapsulates the different types and behavior of game tokens. A token has a position, a value, and an optional associated agent. Examples of tokens are chess pieces, playing cards, and the ball in pong.
| Field Summary | |
|---|---|
protected static String |
UNKNOWN_NAME
Unknown name constant. |
| Fields inherited from interface org.vizzini.game.IToken |
|---|
AGENT_PROPERTY, NAME_PROPERTY, POSITION_PROPERTY, TEAM_PROPERTY |
| Constructor Summary | |
|---|---|
AbstractToken()
|
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
Object |
clone()
Return a clone of this instance. |
void |
configure(Properties properties,
int index)
Configure this token. |
void |
copy(IToken token)
Copy data from the given instance. |
boolean |
equals(Object object)
Return true if the given object is equal to this. |
IAgent |
getAgent()
Return the associated agent. |
int |
getIndex()
|
String |
getName()
Return this token's name. |
IPosition |
getPosition()
Return the position. |
protected PropertyChangeManager |
getPropertyChangeManager()
Return the property change manager. |
ITeam |
getTeam()
Return this token's team. |
int |
getValue()
Return the value of this token. |
int |
hashCode()
Returns a hash code value for the object. |
protected static boolean |
isFiringPositionChanges()
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
setAgent(IAgent agent)
Set the associated agent. |
protected static void |
setFiringPositionChanges(boolean isFiringPositionChanges)
|
protected void |
setIndex(int index)
|
void |
setName(String name)
Set the name to the given name. |
void |
setPosition(IPosition position)
Set the position. |
void |
setTeam(ITeam team)
Set the associated team. |
void |
setValue(int value)
Set the value of this token. |
String |
toString()
Return a string representation of this object. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final String UNKNOWN_NAME
| Constructor Detail |
|---|
public AbstractToken()
| Method Detail |
|---|
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
PropertyChangeListener for a specific property. The
listener will be invoked only when a call on
firePropertyChange names that specific property.
addPropertyChangeListener in interface ITokenpropertyName - The name of the property to listen on.listener - The PropertyChangeListener to be
added.public Object clone()
clone in interface ITokenclone in class Object
public void configure(Properties properties,
int index)
configure in interface ITokenproperties - Source of configuration information.index - Index of this token's properties.public void copy(IToken token)
public boolean equals(Object object)
equals in class Objectobject - The object to compare.public IAgent getAgent()
getAgent in interface ITokenpublic int getIndex()
getIndex in interface ITokenpublic String getName()
getName in interface ITokenpublic IPosition getPosition()
getPosition in interface ITokenpublic ITeam getTeam()
setTeam(), that team is returned. If team is null and the agent is
set, then the agent's team is returned. Else null is returned.
getTeam in interface ITokenpublic int getValue()
getValue in interface ITokenpublic int hashCode()
hashCode in class Object
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
PropertyChangeListener for a specific property.
removePropertyChangeListener in interface ITokenpropertyName - The name of the property that was listened on.listener - The PropertyChangeListener to be
removed.public void setAgent(IAgent agent)
setTeam() and the agent is not null, then the agent's team must
match.
setAgent in interface ITokenagent - The associated agent. May be null.public void setName(String name)
setName in interface ITokenname - The new name.public void setPosition(IPosition position)
setPosition in interface ITokenpublic void setTeam(ITeam team)
setTeam in interface ITokenteam - The associated team. Can be null.public void setValue(int value)
setValue in interface ITokenvalue - The new value.public String toString()
toString in class Objectprotected static boolean isFiringPositionChanges()
protected static void setFiringPositionChanges(boolean isFiringPositionChanges)
isFiringPositionChanges - The _isFiringPositionChanges to set.protected PropertyChangeManager getPropertyChangeManager()
protected void setIndex(int index)
index - the index to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |