package SimFrameWork;
import java.util.List;
import java.util.ArrayList;
public abstract class Patch{
public Patch(){
neighbours=new Patch[8];
turtles=new ArrayList();
}
public abstract void update();
public final void addTurtle(Turtle t){
turtles.add(t);
}
public final int turtleCount(){
return turtles.size();
}
public final void removeTurtle(Turtle t){
turtles.remove(t);
}
public final List getTurtles(){
return turtles;
}
public final Patch getNeighbour(int i){
return neighbours[i];
}
public int value(){
return patchValue;
}
public void incrValue(){
patchValue+=1;
}
public void decrValue(){
patchValue-=1;
}
protected final void setNeighbour(int nbour,Patch p){
neighbours[nbour]=p;
}
public final static int N=0;
public final static int NE=1;
public final static int E=2;
public final static int SE=3;
public final static int S=4;
public final static int SW=5;
public final static int W=6;
public final static int NW=7;
protected int patchValue;
private Patch[] neighbours;
private List turtles;
}