public class Agent { private int x = 0; private int y = 0; private Landscape landscape = null; private int densityLimit = 0; public void step() { if (landscape.getDensity(x,y) > densityLimit) { x = (new Double(Math.random()*(double)landscape.getWidth())).intValue(); y = (new Double(Math.random()*(double)landscape.getHeight())).intValue(); } } public void setX(int x) { this.x = x; } public int getX () { return x; } public void setY(int y) { this.y = y; } public int getY () { return y; } public void setLandscape(Landscape landscape) { this.landscape = landscape; } public void setDensityLimit(int densityLimit) { this.densityLimit = densityLimit; } }