Class Cell

java.lang.Object
  extended by Cell
Direct Known Subclasses:
Elevator

public abstract class Cell
extends Object

A parent class for Cell objects. This class handles location functionality of agents on a Landscape.

This is an abstract class, as three methods are abstract and must be implemented by the child classes.

isNeighbor(Cell cell): returns true of the query cell is a neighbor

updateState(Landscpae scape ): updates the Cell's state

draw( Graphics g, int x, int y, int scale ): draw the Cell into the window


Field Summary
(package private)  int type
          a unique type identifier
(package private)  double x
          x-position in units
(package private)  double y
          y-position int units
 
Constructor Summary
Cell(double x0, double y0, int t)
          Constructor that places the cell and sets its type.
 
Method Summary
abstract  void draw(Graphics g, int x, int y, int scale)
           
 int getCol()
           
 int getRow()
           
 int getType()
           
 double getX()
           
 double getY()
           
abstract  boolean isNeighbor(Cell cell)
           
 void setPosition(double tx, double ty)
           
 void setType(int t)
           
 String toString()
           
abstract  void updateState(Landscape scape)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

double x
x-position in units


y

double y
y-position int units


type

int type
a unique type identifier

Constructor Detail

Cell

public Cell(double x0,
            double y0,
            int t)
Constructor that places the cell and sets its type.

Parameters:
x0 - x-location
y0 - y-location
t - type identifier
Method Detail

setPosition

public void setPosition(double tx,
                        double ty)

setType

public void setType(int t)

getType

public int getType()

getX

public double getX()

getCol

public int getCol()

getY

public double getY()

getRow

public int getRow()

toString

public String toString()
Overrides:
toString in class Object

isNeighbor

public abstract boolean isNeighbor(Cell cell)

updateState

public abstract void updateState(Landscape scape)

draw

public abstract void draw(Graphics g,
                          int x,
                          int y,
                          int scale)