API V2.1

repast.simphony.relogo
[Java] Class AbstractPatch

java.lang.Object
  repast.simphony.relogo.AbstractPatch
All Implemented Interfaces:
Patch

public abstract class AbstractPatch

Field Summary
double pcolor

double plabelColor

 
Method Summary
AgentSet allLinks()

{@inheritDoc}

boolean allQ(Collection a, Closure closure)

void ask(AgentSet a, Closure askBlock)

Executes a set of commands for an agentset in random order.

void ask(Collection c, Closure askBlock)

Executes a set of commands for a collection of agents.

void ask(Turtle t, Closure askBlock)

Executes a set of commands for a turtle.

void ask(Patch p, Closure askBlock)

void ask(Link l, Closure askBlock)

void askCollection(Collection c, Closure cl)

void askPatch(Closure cl)

int compareTo(Patch p)

double distance(Turtle t)

Returns the distance from the caller to a turtle.

double distance(Patch p)

Returns the distance from the caller to a patch.

double distancexy(Number nx, Number ny)

Returns the distance from the caller to a point.

void fileShow(Object value)

GridPoint getGridLocation()

NdPoint getGridLocationAsNdPoint()

int getMaxPxcor()

Returns the maximum x coordinate for all patches.

int getMaxPycor()

Returns the maximum y coordinate for all patches.

int getMinPxcor()

Returns the minimum x coordinate for all patches.

int getMinPycor()

Returns the minimum y coordinate for all patches.

Observer getMyObserver()

PatchFactory getMyPatchFactory()

double getPcolor()

Returns the color of a patch.

Object getPlabel()

Returns the patch label.

double getPlabelColor()

Returns the patch label color.

int getPxcor()

Returns the x coordinate of patch.

int getPycor()

Returns the y coordinate of patch.

List getRowCol()

int[] getXY()

AgentSet inRadius(Collection a, Number num)

Returns an agentset within a distance of the caller.

Link link(Number oneEnd, Number otherEnd)

Returns the link between two turtles.

Link link(Turtle oneEnd, Turtle otherEnd)

Returns the link between two turtles.

AgentSet links()

{@inheritDoc}

AgentSet maxNOf(int number, Collection a, Closure closure)

ReLogoAgent maxOneOf(Collection a, Closure closure)

AgentSet minNOf(int number, Collection a, Closure closure)

ReLogoAgent minOneOf(Collection a, Closure closure)

Object myself()

The agent that initiated the asking.

AgentSet neighbors()

Returns the agentset of the eight neighboring patches (Moore neighborhood).

AgentSet neighbors(int extent)

{@inheritDoc}

AgentSet neighbors(int extentX, int extentY)

{@inheritDoc}

AgentSet neighbors4()

Returns the agentset of the four neighboring patches (von Neumann neighborhood).

AgentSet neighbors4(int extent)

{@inheritDoc}

AgentSet neighbors4(int extentX, int extentY)

{@inheritDoc}

Stop oldStop()

Stops a patch executing within a command closure.

AgentSet other(Collection a)

Returns an agentset minus the caller.

Patch patch(Number nX, Number nY)

Returns the patch containing a point.

Patch patchAt(Number ndx, Number ndy)

Returns the patch at a direction (ndx, ndy) from the caller.

Patch patchAtHeadingAndDistance(Number heading, Number distance)

Returns the patch that is at a direction and distance from the caller.

AgentSet patches()

Returns an agentset containing all patches.

int randomPxcor()

Returns a random x coordinate for patches.

int randomPycor()

Returns a random y coordinate for patches.

double randomXcor()

Returns a random x coordinate for turtles.

double randomYcor()

Returns a random y coordinate for turtles.

void run(String string)

Object runresult(String string)

Patch self()

Returns this turtle, patch, or link.

void setMyObserver(Observer myObserver)

void setMyPatchFactory(PatchFactory myPatchFactory)

void setMyself(Object o)

Sets the agent that initiated the asking to the value o.

void setPcolor(double pcolor)

Sets the color of a patch to pcolor.

void setPlabel(Object plabel)

Sets the patch label.

void setPlabelColor(Number plabelColor)

Sets the patch label color.

void setToDefault()

{@inheritDoc}

void show(Object value)

AgentSet sprout(Number number)

Makes a number of random new turtles.

AgentSet sprout(Number number, Closure closure)

AgentSet sprout(Number number, Closure closure, String turtleType)

AgentSet sprout(Number number, Closure closure, Class turtleType)

Makes a number of random new turtles of a specific type then executes a set of commands on the created turtles.

String toString()

Turtle turtle(Number number)

Returns the turtle of the given number.

AgentSet turtles()

Returns an agentset containing all turtles.

AgentSet turtlesAt(Number ndx, Number ndy)

Returns the agentset on the patch at the direction (ndx, ndy) from the caller.

AgentSet turtlesHere()

Returns an agentset of turtles from the patch of the caller.

AgentSet turtlesOn(Patch p)

Returns an agentset of turtles on a given patch.

AgentSet turtlesOn(Turtle t)

AgentSet turtlesOn(Collection a)

Returns an agentset of turtles on the patches in a collection or on the patches that a collection of turtles are.

void watchMe()

Does nothing, included for translation compatibility.

int worldHeight()

Returns the height of the world.

int worldWidth()

Returns the width of the world.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

pcolor

public double pcolor


plabelColor

public double plabelColor


 
Method Detail

allLinks

public AgentSet allLinks()
{@inheritDoc}


allQ

public boolean allQ(Collection a, Closure closure)


ask

public void ask(AgentSet a, Closure askBlock)
Executes a set of commands for an agentset in random order.
Parameters:
a - an agentset
askBlock - a set of commands


ask

public void ask(Collection c, Closure askBlock)
Executes a set of commands for a collection of agents.
Parameters:
c - a collection of agents
askBlock - a set of commands


ask

public void ask(Turtle t, Closure askBlock)
Executes a set of commands for a turtle.
Parameters:
t - a turtle
askBlock - a set of commands


ask

public void ask(Patch p, Closure askBlock)


ask

public void ask(Link l, Closure askBlock)


askCollection

public void askCollection(Collection c, Closure cl)


askPatch

public void askPatch(Closure cl)


compareTo

public int compareTo(Patch p)


distance

public double distance(Turtle t)
Returns the distance from the caller to a turtle.
returns:
distance from turtle t to the caller
Parameters:
t - a turtle


distance

public double distance(Patch p)
Returns the distance from the caller to a patch.
returns:
distance from patch p to the caller
Parameters:
p - a patch


distancexy

public double distancexy(Number nx, Number ny)
Returns the distance from the caller to a point.
returns:
distance from the caller to the point (nx,ny)
Parameters:
nx - a number
ny - a number


fileShow

public void fileShow(Object value)


getGridLocation

public GridPoint getGridLocation()


getGridLocationAsNdPoint

public NdPoint getGridLocationAsNdPoint()


getMaxPxcor

public int getMaxPxcor()
Returns the maximum x coordinate for all patches.
Returns:
maximum x coordinate for all patches


getMaxPycor

public int getMaxPycor()
Returns the maximum y coordinate for all patches.
Returns:
maximum y coordinate for all patches


getMinPxcor

public int getMinPxcor()
Returns the minimum x coordinate for all patches.
Returns:
maximum x coordinate for patches


getMinPycor

public int getMinPycor()
Returns the minimum y coordinate for all patches.
Returns:
maximum y coordinate for patches


getMyObserver

public Observer getMyObserver()


getMyPatchFactory

public PatchFactory getMyPatchFactory()


getPcolor

public double getPcolor()
Returns the color of a patch.
Returns:
color of a patch in the range [0, 140)


getPlabel

public Object getPlabel()
Returns the patch label.
Returns:
the patch label


getPlabelColor

public double getPlabelColor()
Returns the patch label color.
Returns:
the patch label color


getPxcor

public int getPxcor()
Returns the x coordinate of patch.
Returns:
x coordinate of patch


getPycor

public int getPycor()
Returns the y coordinate of patch.
Returns:
y coordinate of patch


getRowCol

public List getRowCol()


getXY

public int[] getXY()


inRadius

public AgentSet inRadius(Collection a, Number num)
Returns an agentset within a distance of the caller.
Parameters:
a - a collection of agents
num - a distance
Returns:
agentset subset of collection a within a distance num of the caller


link

public Link link(Number oneEnd, Number otherEnd)
Returns the link between two turtles.
Parameters:
oneEnd - an integer
otherEnd - an integer
Returns:
link between two turtles


link

public Link link(Turtle oneEnd, Turtle otherEnd)
Returns the link between two turtles.
Parameters:
oneEnd - a turtle
otherEnd - a turtle
Returns:
link between two turtles


links

public AgentSet links()
{@inheritDoc}


maxNOf

public AgentSet maxNOf(int number, Collection a, Closure closure)


maxOneOf

public ReLogoAgent maxOneOf(Collection a, Closure closure)


minNOf

public AgentSet minNOf(int number, Collection a, Closure closure)


minOneOf

public ReLogoAgent minOneOf(Collection a, Closure closure)


myself

public Object myself()
The agent that initiated the asking.
Returns:
the agent that initiated the asking


neighbors

public AgentSet neighbors()
Returns the agentset of the eight neighboring patches (Moore neighborhood).
Returns:
agentset of the eight neighboring patches


neighbors

public AgentSet neighbors(int extent)
{@inheritDoc}


neighbors

public AgentSet neighbors(int extentX, int extentY)
{@inheritDoc}


neighbors4

public AgentSet neighbors4()
Returns the agentset of the four neighboring patches (von Neumann neighborhood).
Returns:
agentset of the four neighboring patches


neighbors4

public AgentSet neighbors4(int extent)
{@inheritDoc}


neighbors4

public AgentSet neighbors4(int extentX, int extentY)
{@inheritDoc}


oldStop

@Deprecatedrns the ReLogoAgent with the smallest value when operated on by a set of
	 * comm
public Stop oldStop()
Stops a patch executing within a command closure.
deprecated:
use the Utility.stop method instead.


other

public AgentSet other(Collection a)
Returns an agentset minus the caller.
Parameters:
a - an agentset
Returns:
agentset a minus the caller


patch

public Patch patch(Number nX, Number nY)
Returns the patch containing a point.
Parameters:
nX - x coordinate
nY - y coordinate
Returns:
patch that contains the point (nX, nY)


patchAt

public Patch patchAt(Number ndx, Number ndy)
Returns the patch at a direction (ndx, ndy) from the caller.
Parameters:
ndx - a number
ndy - a number
Returns:
patch at a direction (ndx, ndy) from the caller


patchAtHeadingAndDistance

public Patch patchAtHeadingAndDistance(Number heading, Number distance)
Returns the patch that is at a direction and distance from the caller.
Parameters:
heading - a number
distance - a number
Returns:
patch that is at heading and distance from the caller


patches

public AgentSet patches()
Returns an agentset containing all patches.
Returns:
agentset containing all patches


randomPxcor

public int randomPxcor()
Returns a random x coordinate for patches.
Returns:
random x coordinate for patches


randomPycor

public int randomPycor()
Returns a random y coordinate for patches.
Returns:
random y coordinate for patches


randomXcor

public double randomXcor()
Returns a random x coordinate for turtles.
Returns:
random x coordinate for turtles


randomYcor

public double randomYcor()
Returns a random y coordinate for turtles.
Returns:
random y coordinate for turtles


run

public void run(String string)


runresult

public Object runresult(String string)


self

public Patch self()
Returns this turtle, patch, or link.
Returns:
this turtle, patch, or link.


setMyObserver

public void setMyObserver(Observer myObserver)


setMyPatchFactory

public void setMyPatchFactory(PatchFactory myPatchFactory)


setMyself

public void setMyself(Object o)
Sets the agent that initiated the asking to the value o.
exclude:
Parameters:
o - an object


setPcolor

public void setPcolor(double pcolor)
Sets the color of a patch to pcolor.
Parameters:
pcolor - a number in range [0,140)


setPlabel

public void setPlabel(Object plabel)
Sets the patch label.
Parameters:
plabel - a label


setPlabelColor

public void setPlabelColor(Number plabelColor)
Sets the patch label color.
Parameters:
plabelColor - a numerical color


setToDefault

public void setToDefault()
{@inheritDoc}


show

public void show(Object value)


sprout

public AgentSet sprout(Number number)
Makes a number of random new turtles.
Parameters:
number - a number
Returns:
created turtles


sprout

public AgentSet sprout(Number number, Closure closure)


sprout

public AgentSet sprout(Number number, Closure closure, String turtleType)


sprout

public AgentSet sprout(Number number, Closure closure, Class turtleType)
Makes a number of random new turtles of a specific type then executes a set of commands on the created turtles.
Parameters:
number - a number
closure - a set of commands
turtleType - a turtle class
Returns:
created turtles


toString

public String toString()


turtle

public Turtle turtle(Number number)
Returns the turtle of the given number.
Parameters:
number - a number
Returns:
turtle number


turtles

public AgentSet turtles()
Returns an agentset containing all turtles.
Returns:
agentset of all turtles


turtlesAt

public AgentSet turtlesAt(Number ndx, Number ndy)
Returns the agentset on the patch at the direction (ndx, ndy) from the caller.
returns:
agentset at the direction (ndx, ndy) from the caller
Parameters:
ndx - a number
ndy - a number


turtlesHere

public AgentSet turtlesHere()
Returns an agentset of turtles from the patch of the caller.
Returns:
agentset of turtles from the caller's patch


turtlesOn

public AgentSet turtlesOn(Patch p)
Returns an agentset of turtles on a given patch.
Parameters:
p - a patch
Returns:
agentset of turtles on patch p


turtlesOn

public AgentSet turtlesOn(Turtle t)


turtlesOn

public AgentSet turtlesOn(Collection a)
Returns an agentset of turtles on the patches in a collection or on the patches that a collection of turtles are.
Parameters:
a - a collection
Returns:
agentset of turtles on the patches in collection a or on the patches that collection a turtles are


watchMe

public void watchMe()
Does nothing, included for translation compatibility.


worldHeight

public int worldHeight()
Returns the height of the world.
Returns:
height of the world


worldWidth

public int worldWidth()
Returns the width of the world.
Returns:
width of the world


 

ReLogo API V2.1