|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.ai.geneticalgorithm.AbstractContext
org.vizzini.example.ant.AntContext
public class AntContext
State variables: x - ant x position y - ant y position heading - ant heading [north,east,south,west] t - time food - number of food pellets consumed
Field Summary | |
---|---|
static String |
GRID_NAME
State variable name for the grid. |
static String |
HEADING_NAME
State variable name for the ant heading. |
static String |
POSITION_NAME
State variable name for the position. |
static String |
TIME_NAME
State variable name for time. |
Constructor Summary | |
---|---|
AntContext()
Construct this object. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
protected void |
addToStateVariable(String name,
int delta)
Add the given delta to the specified state variable. |
void |
decrementX()
Decrement X. |
void |
decrementY()
Decrement Y. |
int |
getFood()
Return food. |
Grid |
getGrid()
Return grid. |
String |
getHeading()
Return heading. |
IntegerPosition |
getPosition()
Return position. |
int |
getTime()
Return time. |
void |
incrementTime()
Increment the time state variable. |
void |
incrementX()
Increment X. |
void |
incrementY()
Increment Y. |
void |
initialize()
Initialize the state of the context. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
setAnt()
Set the ant at the x, y coordinates. |
void |
setFootprint()
Set a footprint at the x, y coordinates. |
void |
setHeading(String heading)
Set heading. |
void |
setPosition(int x,
int y)
Set position. |
protected void |
setTime(int time)
Set time. |
Methods inherited from class org.vizzini.ai.geneticalgorithm.AbstractContext |
---|
add, getCurrentFitnessCase, getCurrentFitnessCaseIndex, getFitnessCaseCount, getStateVariable, incrementCurrentFitnessCase, reset, setStateVariable, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String GRID_NAME
public static final String POSITION_NAME
public static final String HEADING_NAME
public static final String TIME_NAME
Constructor Detail |
---|
public AntContext()
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.
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener
to be
added.public void decrementX()
public void decrementY()
public int getFood()
public Grid getGrid()
public String getHeading()
public IntegerPosition getPosition()
public int getTime()
public void incrementTime()
public void incrementX()
public void incrementY()
public void initialize()
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
PropertyChangeListener
for a specific property.
propertyName
- The name of the property that was listened on.listener
- The PropertyChangeListener
to be
removed.public void setAnt()
public void setFootprint()
public void setHeading(String heading)
public void setPosition(int x, int y)
protected void addToStateVariable(String name, int delta)
name
- State variable name.delta
- Amount to add.protected void setTime(int time)
|
||||||||||
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 |