|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.game.AbstractAgent
public abstract class AbstractAgent
Provides base functionality for agents in the game framework. An agent instance encapsulates the logic an agent uses to create actions. Examples of this logic are simple coding, a minimax algorithm, or neural network based.
Field Summary |
---|
Fields inherited from interface org.vizzini.game.IAgent |
---|
NAME_PROPERTY, TEAM_PROPERTY |
Constructor Summary | |
---|---|
AbstractAgent()
|
Method Summary | |
---|---|
void |
addConcedeListener(IConcedeListener listener)
Add the given listener. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
void |
addScoreListener(IScoreListener listener)
Add the given listener. |
void |
addToScore(long value)
Add the given value to the score. |
void |
concede()
Concede the game. |
void |
configure(Properties properties,
int index)
Configure this agent. |
boolean |
equals(Object object)
Return true if the given object is equal to this. |
protected ConcedeManager |
getConcedeManager()
Return the concede manager. |
protected int |
getIndex()
|
String |
getName()
Return this agent's name. |
protected Properties |
getProperties()
|
protected PropertyChangeManager |
getPropertyChangeManager()
Return the property change manager. |
long |
getScore()
Return the current score. |
protected ScoreManager |
getScoreManager()
Return the score manager. |
ITeam |
getTeam()
Return this agent's team. |
ITokenCollection |
getTokenCollection()
Return the token collection. |
protected Class |
getTokenCollectionClass()
|
int |
hashCode()
Returns a hash code value for the object. |
void |
incrementScore()
Increment the score. |
void |
removeConcedeListener(IConcedeListener listener)
Remove the given listener. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
removeScoreListener(IScoreListener listener)
Remove the given listener. |
void |
reset()
Reset to the initial state. |
void |
setName(String name)
Set the name to the given name. |
void |
setScore(long score)
Set the score to the given value. |
void |
setTeam(ITeam team)
Set the associated team. |
protected void |
setTokenCollectionClass(Class tokenCollectionClass)
|
String |
toString()
Return a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.vizzini.game.IAgent |
---|
getAction |
Constructor Detail |
---|
public AbstractAgent()
Method Detail |
---|
public void addConcedeListener(IConcedeListener listener)
addConcedeListener
in interface IAgent
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 IAgent
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener
to be
added.public void addScoreListener(IScoreListener listener)
addScoreListener
in interface IAgent
public void addToScore(long value)
addToScore
in interface IAgent
value
- The value to add.public void concede()
concede
in interface IAgent
public void configure(Properties properties, int index) throws InstantiationException, IllegalAccessException
configure
in interface IAgent
InstantiationException
IllegalAccessException
public boolean equals(Object object)
equals
in class Object
object
- The object to compare.public String getName()
getName
in interface IAgent
public long getScore()
getScore
in interface IAgent
public ITeam getTeam()
getTeam
in interface IAgent
public ITokenCollection getTokenCollection()
getTokenCollection
in interface IAgent
public int hashCode()
hashCode
in class Object
public void incrementScore()
incrementScore
in interface IAgent
public void removeConcedeListener(IConcedeListener listener)
removeConcedeListener
in interface IAgent
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
PropertyChangeListener
for a specific property.
removePropertyChangeListener
in interface IAgent
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener
to be
removed.public void removeScoreListener(IScoreListener listener)
removeScoreListener
in interface IAgent
public void reset()
reset
in interface IAgent
public void setName(String name)
setName
in interface IAgent
name
- The new name.public void setScore(long score)
setScore
in interface IAgent
score
- The new score.public void setTeam(ITeam team)
setTeam
in interface IAgent
team
- The associated team.public String toString()
toString
in class Object
protected ConcedeManager getConcedeManager()
protected int getIndex()
protected Properties getProperties()
protected PropertyChangeManager getPropertyChangeManager()
protected ScoreManager getScoreManager()
protected Class getTokenCollectionClass()
protected void setTokenCollectionClass(Class tokenCollectionClass)
tokenCollectionClass
- The tokenCollectionClass 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 |