|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.vizzini.example.ant.Grid
public class Grid
Provides a grid for the artificial ant problem.
| Field Summary | |
|---|---|
static String |
GRID_PROPERTY
|
| Constructor Summary | |
|---|---|
Grid()
Construct this object. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. |
protected String |
antToString(String heading)
Return a string representation of the ant based upon the heading. |
void |
clear(int x,
int y)
Clear the cell at the given coordinates. |
Object |
clone()
Return a clone of this instance. |
protected int |
count(int type)
Return the amount of the given item is on the grid. |
int |
foodConsumed()
Return the amount of food consumed from the grid. |
int |
foodCount()
Return the amount of food on the grid. |
String |
getHeading()
|
int |
getInitialFoodCount()
|
boolean |
isAnt(int x,
int y)
Return true if the cell at the given coordinates contains the ant. |
boolean |
isEmpty(int x,
int y)
Return true if the cell at the given coordinates is empty. |
boolean |
isFood(int x,
int y)
Return true if the cell at the given coordinates contains food. |
boolean |
isFootprint(int x,
int y)
Return true if the cell at the given coordinates contains a footprint. |
protected boolean |
isType(int x,
int y,
int type)
Return true if the cell at the given coordinates contains the given type. |
int |
keepOnGrid(int value)
Return a coordinate that is on the grid. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. |
void |
setAnt(int x,
int y,
String heading)
Set the ant at the given coordinates. |
void |
setFood(int x,
int y)
Set food at the given coordinates. |
void |
setFootprint(int x,
int y)
Set a footprint at the given coordinates. |
void |
setHeading(String heading)
|
int |
size()
Return the size of one side of the square grid. |
String |
toString()
Return a string representation of this object. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String GRID_PROPERTY
| Constructor Detail |
|---|
public Grid()
| 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 clear(int x,
int y)
x - X coordinate.y - Y coordinate.public Object clone()
clone in class Objectpublic int foodConsumed()
public int foodCount()
public String getHeading()
public int getInitialFoodCount()
public boolean isAnt(int x,
int y)
x - X coordinate.y - Y coordinate.
public boolean isEmpty(int x,
int y)
x - X coordinate.y - Y coordinate.
public boolean isFood(int x,
int y)
x - X coordinate.y - Y coordinate.
public boolean isFootprint(int x,
int y)
x - X coordinate.y - Y coordinate.public int keepOnGrid(int value)
value - Possible grid coordinate.
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(int x,
int y,
String heading)
x - X coordinate.y - Y coordinate.heading - Ant heading.
public void setFood(int x,
int y)
x - X coordinate.y - Y coordinate.
public void setFootprint(int x,
int y)
x - X coordinate.y - Y coordinate.public void setHeading(String heading)
heading - the heading to setpublic int size()
public String toString()
toString in class Objectprotected String antToString(String heading)
heading - Ant heading.protected int count(int type)
protected boolean isType(int x,
int y,
int type)
x - X coordinate.y - Y coordinate.type - Cell content type.
|
||||||||||
| 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 |