// Implements basic spatial elements of an agent. // The expectation is that this would be extended, but it is left non-abstract // incase wanted for early model development. // Each animal has an x and y coordinate. public class Animal implements Agent { // Note use in the instance variables of the // protected keyword to allow direct subclass access. // Reference to the environment set up in Model. protected Environment world = null; // Spatial x coordinate. protected int x = 0; // Spatial y coordinate. protected int y = 0; // Constructor. Just defaults the x and y to 50 and 150. public Animal (Environment worldIn) { world = worldIn; x = 50; y = 150; } // Empty run method. public void run () { } // Gets the x coordinate. public int getX() { return x; } // Gets the x coordinate. public int getY() { return y; } }