edu.turtlekit2.kernel.environment
Class Patch

java.lang.Object
  extended by edu.turtlekit2.kernel.environment.Patch

public final class Patch
extends Object

The Patch class

Version:
1.2 20/3/2000
Author:
Fabien MICHEL

Field Summary
 boolean change
           
 Color color
           
 double diffusion
           
 Patch[] neighbors
           
 Collection<Turtle> turtlesHere
           
 double[] variableValue
           
 int x
           
 int y
           
 
Constructor Summary
Patch(TurtleEnvironment w, int x, int y)
           
 
Method Summary
 void addAgent(Turtle a)
           
 void dropMark(String markName, Object value)
          Drop a mark on the patch
 Color getColor()
           
 Object getMark(String markName)
          get a mark deposed on the patch
 Patch[] getNeighbors()
           
 Turtle[] getOtherTurtles(Turtle t)
           
 Turtle[] getTurtles()
          returns the turtles who are on the patch
 void incrementPatchVariable(String variableName, double n)
          add n to the value of the corresponding patch variable
 boolean isMarkPresent(String markName)
          tests if the corresponding mark is present on the patch (true or false)
 void removeAgent(Turtle a)
           
 void setColor(Color c)
           
 void setNeighborhood(Patch[] acc)
           
 void setPatchVariable(String variableName, double n)
          set the value of the corresponding patch variable to n, use it with observers in the setup method for example
 int size()
           
 double smell(String variableName)
          return the value of the corresponding variable
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

diffusion

public double diffusion

variableValue

public double[] variableValue

neighbors

public transient Patch[] neighbors

turtlesHere

public Collection<Turtle> turtlesHere

color

public Color color

change

public boolean change

x

public int x

y

public int y
Constructor Detail

Patch

public Patch(TurtleEnvironment w,
             int x,
             int y)
Method Detail

setNeighborhood

public final void setNeighborhood(Patch[] acc)

removeAgent

public final void removeAgent(Turtle a)

addAgent

public final void addAgent(Turtle a)

setPatchVariable

public final void setPatchVariable(String variableName,
                                   double n)
set the value of the corresponding patch variable to n, use it with observers in the setup method for example


incrementPatchVariable

public final void incrementPatchVariable(String variableName,
                                         double n)
add n to the value of the corresponding patch variable


smell

public final double smell(String variableName)
return the value of the corresponding variable


getColor

public final Color getColor()

setColor

public final void setColor(Color c)

getOtherTurtles

public final Turtle[] getOtherTurtles(Turtle t)

size

public final int size()

dropMark

public final void dropMark(String markName,
                           Object value)
Drop a mark on the patch

Parameters:
markName - mark name
value - mark itself, can be any java object

getMark

public final Object getMark(String markName)
get a mark deposed on the patch

Returns:
the correponding java object, null if not present

isMarkPresent

public final boolean isMarkPresent(String markName)
tests if the corresponding mark is present on the patch (true or false)


getTurtles

public final Turtle[] getTurtles()
returns the turtles who are on the patch


getNeighbors

public final Patch[] getNeighbors()

toString

public final String toString()
Overrides:
toString in class Object