|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.primordion.xholon.base.Xholon org.primordion.xholon.base.XholonWithPorts org.primordion.xholon.base.AbstractGrid org.primordion.xholon.base.GridEntity org.primordion.xholon.base.Patch
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/
Field Summary | |
int |
pcolor
|
int |
pxcor
|
int |
pycor
|
Fields inherited from class org.primordion.xholon.base.AbstractGrid |
P_BEHAVIOR, P_NEXT, P_PREVIOUS |
Fields inherited from class org.primordion.xholon.base.XholonWithPorts |
port |
Fields inherited from class org.primordion.xholon.base.Xholon |
DEFAULT_LEVEL, interaction, interactionsEnabled |
Fields inherited from interface org.primordion.xholon.base.IPatch |
COMMANDID_NONE, 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 |
Constructor Summary | |
Patch()
|
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)
This works for a torus or grid where each cell has 8 neighbors. |
java.util.Vector |
inRadius(int radius,
int filterId)
This works for a torus or grid where each cell has 8 neighbors. |
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. |
java.lang.String |
toString()
|
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 class org.primordion.xholon.base.GridEntity |
getMaxPorts, setPorts |
Methods inherited from class org.primordion.xholon.base.AbstractGrid |
configure, getNeighType, getNumNeighbors, initialize, moveXholonsToGrid, postConfigure, postReconfigure, preReconfigure, reconfigure, setCaFuture, setCaLeft, setCaRight, setEast, setHex0, setHex1, setHex2, setHex3, setHex4, setHex5, setNorth, setNorthEast, setNorthWest, setSiblingsComplete, setSiblingsCompleteSelf, setSiblingsCycle, setSiblingsWheel, setSouth, setSouthEast, setSouthWest, setWest |
Methods inherited from class org.primordion.xholon.base.XholonWithPorts |
configure, getPort, isActiveObject, isBound, isContainer, isPassiveObject, setMaxPorts, terminate |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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 int pcolor
public int pxcor
public int pycor
Constructor Detail |
public Patch()
Method Detail |
public void beep()
IPatch
beep
in interface IPatch
public double distance(IXholon turtleOrPatch)
IPatch
distance
in interface IPatch
turtleOrPatch
- A turtle or patch object.
public double distancexy(double x, double y)
IPatch
distancexy
in interface IPatch
x
- A global x coordinate.y
- A global y coordinate.
public java.util.Vector inRadius(int radius)
inRadius
in interface IPatch
radius
- Distance from the current patch. The current patch is a radius of 0 from itself.
IPatch.inRadius(int)
public java.util.Vector inRadius(int radius, int filterId)
inRadius
in interface IPatch
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.
IPatch.inRadius(int, int)
public java.util.Vector neighbors()
IPatch
neighbors
in interface IPatch
public java.util.Vector neighbors4()
IPatch
neighbors4
in interface IPatch
public IPatch patch(int pxcor, int pycor)
IPatch
patch
in interface IPatch
pxcor
- An x coordinate.pycor
- A y coordinate.
public IPatch patchAt(int dx, int dy)
IPatch
patchAt
in interface IPatch
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)
IPatch
patchAtHeadingAndDistance
in interface IPatch
heading
- An absolute angle measured in degrees.distance
- A distance measured in units.
public void sprout(IXholonClass xhClazz, int numTurtles, int commandId)
IPatch
sprout
in interface IPatch
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)
IPatch
towards
in interface IPatch
turtleOrPatch
- A turtle or patch object.
public double towardsxy(double x, double y)
IPatch
towardsxy
in interface IPatch
x
- A global x coordinate.y
- A global y coordinate.
public java.util.Vector turtlesAt(int dx, int dy)
IPatch
turtlesAt
in interface IPatch
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()
IPatch
turtlesHere
in interface IPatch
public java.util.Vector turtlesOn()
IPatch
turtlesOn
in interface IPatch
public java.util.Vector with(java.util.Vector vIn, int filterId)
IPatch
with
in interface IPatch
vIn
- A collection of ITurtle instances.filterId
- The ID of a turtle filter.
public int getPcolor()
IPatch
getPcolor
in interface IPatch
public void setPcolor(int pcolor)
IPatch
setPcolor
in interface IPatch
pcolor
- A pcolor value, as defined in ITurtlePatchColor.public java.lang.String getPlabel()
IPatch
getPlabel
in interface IPatch
public void setPlabel(java.lang.String plabel)
IPatch
setPlabel
in interface IPatch
public int getPxcor()
IPatch
getPxcor
in interface IPatch
public void setPxcor(int pxcor)
IPatch
setPxcor
in interface IPatch
public int getPycor()
IPatch
getPycor
in interface IPatch
public void setPycor(int pycor)
IPatch
setPycor
in interface IPatch
public void aggregate(double amount)
IPatch
aggregate
in interface IPatch
amount
- The amount to increment or decrement the current population count.
The amount can be a positive (increment) or negative (decrement) number.public java.lang.String toString()
toString
in class GridEntity
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |