|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A patch is an agent in the turtle mechanism. The turtle mechanism is based on Logo and NetLogo.
NetLogo website http://ccl.northwestern.edu/netlogo/
TODO add (May 15 2007):
beep
inRadius
patch
patchAt
patchAtHeadingAndDistance
sprout
towards
towardsxy
turtlesAt
turtlesHere
turtlesOn
with
Field Summary | |
static int |
COMMANDID_NONE
|
static int |
FILTERID_NONE
|
Fields inherited from interface org.primordion.xholon.base.IXholon |
DEFAULT_SIZE_MSG_Q, NINCLUDE_PSC, NINCLUDE_PSx, NINCLUDE_PxC, NINCLUDE_Pxx, NINCLUDE_xSC, NINCLUDE_xSx, NINCLUDE_xxC, NINCLUDE_xxx |
Fields inherited from interface org.primordion.xholon.base.IGrid |
BOUNDARY_GRID, BOUNDARY_TORUS, NEIGHBORHOOD_1DCA, NEIGHBORHOOD_HEXAGONAL, NEIGHBORHOOD_MOORE, NEIGHBORHOOD_SIBLING, NEIGHBORHOOD_VON_NEUMANN, P_CAFUTURESELF, P_CALEFTNEIGHBOR, P_CARIGHTNEIGHBOR, P_EAST, P_HEX0, P_HEX1, P_HEX2, P_HEX3, P_HEX4, P_HEX5, P_NORTH, P_NORTHEAST, P_NORTHWEST, P_SOUTH, P_SOUTHEAST, P_SOUTHWEST, P_STAYHERE, P_WEST, REGULAR_COMPLETE, REGULAR_COMPLETE_SELF, REGULAR_CYCLE, REGULAR_WHEEL |
Method Summary | |
void |
aggregate(double amount)
Aggregate by keeping a count of the number of individuals of a given type of Patch. |
void |
beep()
Make a single short beep sound. |
double |
distance(IXholon turtleOrPatch)
Return the distance between self and the specified turtle or patch. |
double |
distancexy(double x,
double y)
Return the distance between yourself and the specified x, y coordinates. |
int |
getPcolor()
Get the patch's pcolor. |
java.lang.String |
getPlabel()
Get the patch's label, a String that helps to identify it. |
int |
getPxcor()
Get the patch's x coordinate. |
int |
getPycor()
Get the patch's y coordinate. |
java.util.Vector |
inRadius(int radius)
Return a list of all neighbors (patches) within the specified radius. |
java.util.Vector |
inRadius(int radius,
int filterId)
Return a list of all neighbors (patches) within the specified radius. |
java.util.Vector |
neighbors()
Return the 8 surrounding neighbor patches. |
java.util.Vector |
neighbors4()
Return the 4 surrounding neighbor patches. |
IPatch |
patch(int pxcor,
int pycor)
Return the patch with the specified absolute coordinates. |
IPatch |
patchAt(int dx,
int dy)
Return the single patch at the specified x and y relative distance. |
IPatch |
patchAtHeadingAndDistance(double heading,
double distance)
Return the single patch at the specified absolute heading and relative distance. |
void |
setPcolor(int pcolor)
Set the patch's pcolor. |
void |
setPlabel(java.lang.String plabel)
Set or change the patch's label. |
void |
setPxcor(int pxcor)
Set the patch's x coordinate. |
void |
setPycor(int pycor)
Set the patch's y coordinate. |
void |
sprout(IXholonClass xhClazz,
int numTurtles,
int commandId)
Create a specified number of new turtles on the current patch. |
double |
towards(IXholon turtleOrPatch)
Return the heading between self and the specified turtle or patch. |
double |
towardsxy(double x,
double y)
Return the heading between self and the specified x, y coordinates. |
java.util.Vector |
turtlesAt(int dx,
int dy)
Return the turtles located at the single patch at the specified x and y relative distance. |
java.util.Vector |
turtlesHere()
Return the turtles located at the current patch. |
java.util.Vector |
turtlesOn()
Return the turtles that are on the given patch or patches, or standing on the same patch as the given turtle or turtles. |
java.util.Vector |
with(java.util.Vector vIn,
int filterId)
Filters the input vector to produce an output vector. |
Methods inherited from interface org.primordion.xholon.base.IGrid |
getNeighType, getNumNeighbors, moveXholonsToGrid, setCaFuture, setCaLeft, setCaRight, setEast, setHex0, setHex1, setHex2, setHex3, setHex4, setHex5, setNorth, setNorthEast, setNorthWest, setSiblingsComplete, setSiblingsCompleteSelf, setSiblingsCycle, setSiblingsWheel, setSouth, setSouthEast, setSouthWest, setWest |
Field Detail |
public static final int COMMANDID_NONE
public static final int FILTERID_NONE
Method Detail |
public void beep()
public double distance(IXholon turtleOrPatch)
turtleOrPatch
- A turtle or patch object.
public double distancexy(double x, double y)
x
- A global x coordinate.y
- A global y coordinate.
public java.util.Vector inRadius(int radius)
radius
- Distance from the current patch. The current patch is a radius of 0 from itself.
public java.util.Vector inRadius(int radius, int filterId)
radius
- Distance from the current patch. The current patch is a radius of 0 from itself.filterId
- An ID that can be used by performBooleanActivity() to select a specific filter.
public java.util.Vector neighbors()
public java.util.Vector neighbors4()
public IPatch patch(int pxcor, int pycor)
pxcor
- An x coordinate.pycor
- A y coordinate.
public IPatch patchAt(int dx, int dy)
dx
- A relative distance in the x direction, in patches.dy
- A relative distance in the y direction, in patches.
public IPatch patchAtHeadingAndDistance(double heading, double distance)
heading
- An absolute angle measured in degrees.distance
- A distance measured in units.
public void sprout(IXholonClass xhClazz, int numTurtles, int commandId)
xhClazz
- The XholonClass that the new turtles should be members of.numTurtles
- The number of new turtles to hatch.commandId
- The ID of a set of turtle commands that can be executed
by calling performActivity(int commandId) on each new turtle.public double towards(IXholon turtleOrPatch)
turtleOrPatch
- A turtle or patch object.
public double towardsxy(double x, double y)
x
- A global x coordinate.y
- A global y coordinate.
public java.util.Vector turtlesAt(int dx, int dy)
dx
- A relative distance in the x direction, in patches.dy
- A relative distance in the y direction, in patches.
public java.util.Vector turtlesHere()
public java.util.Vector turtlesOn()
public java.util.Vector with(java.util.Vector vIn, int filterId)
vIn
- A collection of ITurtle instances.filterId
- The ID of a turtle filter.
public int getPcolor()
public void setPcolor(int pcolor)
pcolor
- A pcolor value, as defined in ITurtlePatchColor.public java.lang.String getPlabel()
public void setPlabel(java.lang.String plabel)
public int getPxcor()
public void setPxcor(int pxcor)
public int getPycor()
public void setPycor(int pycor)
public void aggregate(double amount)
amount
- The amount to increment or decrement the current population count.
The amount can be a positive (increment) or negative (decrement) number.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |