API V2.0

repast.simphony.relogo
[Java] Class AbstractTurtle

java.lang.Object
  repast.simphony.relogo.AbstractTurtle
All Implemented Interfaces:
Turtle

public abstract class AbstractTurtle

Field Summary
boolean hiddenQ

 
Method Summary
void addToFixedLeaves(Turtle t)

void addToFreeLeaves(Turtle o)

AgentSet allLinks()

{@inheritDoc}

AgentSet allMyInLinks()

{@inheritDoc}

AgentSet allMyLinks()

{@inheritDoc}

AgentSet allMyOutLinks()

{@inheritDoc}

boolean allQ(Collection a, Closure reporter)

Queries if all agents in a collection are true for a boolean closure.

void ask(AgentSet a, Closure askBlock)

Executes a set of commands for an agentset.

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)

Executes a set of commands for a patch.

void ask(Link l, Closure askBlock)

Executes a set of commands for a link.

void askCollection(Collection l, Closure cl)

void askTurtle(Closure cl)

@exclude

void back(Number num)

Steps turtle backwards by a distance.

void bk(Number num)

Steps turtle backwards by a distance.

boolean canMoveQ(Number nDist)

Queries if turtle can move a distance.

int compareTo(Turtle t)

Link createLinkFrom(Turtle t)

Makes a directed link from a turtle to the caller.

Link createLinkFrom(Turtle t, Closure closure)

Makes a directed link from a turtle to the caller then executes a set of commands on the created link.

Link createLinkTo(Turtle t)

Makes a directed link from the caller to a turtle.

Link createLinkTo(Turtle t, Closure closure)

Makes a directed link from the caller to a turtle then executes a set of commands on the created link.

Link createLinkWith(Turtle t)

Makes a undirected link between the caller and a turtle.

Link createLinkWith(Turtle t, Closure closure)

Makes an undirected link between the caller and a turtle then executes a set of commands on the created link.

AgentSet createLinksFrom(Collection a)

Makes directed links from a collection of agents to the caller.

AgentSet createLinksFrom(AgentSet a, Closure closure)

Makes directed links from an agentset to the caller then executes a set of commands on the created links.

AgentSet createLinksFrom(Collection a, Closure closure)

Makes directed links from a collection of agents to the caller then executes a set of commands on the created links.

AgentSet createLinksTo(Collection a)

Makes directed links from the caller to a collection of agents.

AgentSet createLinksTo(AgentSet a, Closure closure)

Makes directed links from the caller to an agentset then executes a set of commands on the created links.

AgentSet createLinksTo(Collection a, Closure closure)

Makes directed links from the caller to a collection of agents then executes a set of commands on the created links.

AgentSet createLinksWith(Collection a)

Makes undirected links between the caller and a collection of agents.

AgentSet createLinksWith(AgentSet a, Closure closure)

Makes undirected links between the caller and an agentset then executes a set of commands on the created links.

AgentSet createLinksWith(Collection a, Closure closure)

Makes undirected links between the caller and a collection of agents then executes a set of commands on the created links.

void die()

Removes the turtle.

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.

double dx()

Returns the turtleŐs x increment for one step.

double dy()

Returns the turtleŐs y increment for one step.

void face(Turtle t)

Faces the caller towards a turtle.

void face(Patch p)

Faces the caller towards a patch.

void facexy(Number nX, Number nY)

Faces the caller towards a point.

void fd(Number num)

Steps turtle forward by a distance.

void fileShow(Object value)

Prints value with agent identifier to current file with a newline.

boolean fixedLeavesContains(Turtle t)

void forward(Number num)

Steps turtle forward by a distance.

boolean freeLeavesContains(Object o)

double getColor()

Returns the color of a turtle.

double getHeading()

Returns the heading of the turtle.

double getHeadingInRads()

Object getLabel()

Returns the label.

double getLabelColor()

Returns the label color for a turtle or link.

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()

TurtleFactory getMyTurtleFactory()

double getPcolor()

Returns the color of patch here.

int getPenMode()

Returns the pen setting of a turtle.

int getPenSize()

Returns the pen width of a turtle.

int getPxcor()

Returns the x coordinate of patch here.

int getPycor()

Returns the y coordinate of patch here.

String getShape()

Returns the shape of a turtle.

double getSize()

Returns the size of a turtle.

NdPoint getTurtleLocation()

String getTurtleType()

int getWho()

Returns the id number of a turtle.

static int getWhoCounter()

double getXcor()

Returns the x coordinate of a turtle.

double getYcor()

Returns the y coordinate of a turtle.

AgentSet hatch(Number number)

Makes a number of new turtles.

AgentSet hatch(Number number, Closure closure)

Makes a number of new turtles and then executes a set of commands on the created turtles.

AgentSet hatch(Number number, Closure closure, String childType)

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

AgentSet hatch(Number number, Closure closure, Class childType)

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

void hideTurtle()

Turtle appears hidden.

void home()

Turtle goes to (0,0).

void ht()

Turtle appears hidden.

AgentSet inCone(Collection a, Number num, Number angle)

Returns an agentset within a distance and heading cone of the caller.

Link inLinkFrom(Turtle t)

Returns the directed link from a turtle to the caller.

boolean inLinkNeighborQ(Turtle t)

Queries if there is a directed link from a turtle to the caller.

AgentSet inLinkNeighbors()

Returns the agentset with directed links to the caller.

AgentSet inRadius(Collection a, Number num)

Returns an agentset within a distance of the caller.

boolean isHiddenQ()

Queries if caller is hidden.

boolean isShapeChanged()

boolean isVisibilityChanged()

void jump(Number num)

Moves turtle forward num units.

void left(Number num)

Rotates the turtle to the left num degrees.

Link link(Number oneEnd, Number otherEnd)

Returns the link between two turtles.

Link link(Turtle oneEnd, Turtle otherEnd)

Returns the link between two turtles.

boolean linkNeighborQ(Turtle t)

Reports true if there is an undirected link connecting t and the caller.

AgentSet linkNeighbors()

Reports the agentset of all turtles found at the other end of undirected links connected to the calling turtle.

Link linkWith(Turtle t)

Report the link between t and the caller.

AgentSet links()

{@inheritDoc}

void lt(Number num)

Rotates the turtle to the left num degrees.

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

Returns an agentset consisting of a specified number of agents which have the greatest value when operated on by a set of commands.

ReLogoAgent maxOneOf(Collection a, Closure reporter)

Returns the ReLogoAgent with the largest value when operated on by a set of commands.

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

Returns an agentset consisting of a specified number of agents which have the lowest value when operated on by a set of commands.

ReLogoAgent minOneOf(Collection a, Closure reporter)

Returns the ReLogoAgent with the smallest value when operated on by a set of commands.

void move(Number nNumber)

void moveTo(Turtle t)

Moves a turtle to the same location as turtle t.

void moveTo(Patch p)

Moves a turtle to the same location as patch p.

void mv(Number nNumber)

AgentSet myInLinks()

{@inheritDoc}

AgentSet myLinks()

{@inheritDoc}

AgentSet myOutLinks()

{@inheritDoc}

Object myself()

The agent that initiated the asking.

AgentSet neighbors()

{@inheritDoc}

AgentSet neighbors(int extent)

{@inheritDoc}

AgentSet neighbors(int extentX, int extentY)

{@inheritDoc}

AgentSet neighbors4()

{@inheritDoc}

AgentSet neighbors4(int extent)

{@inheritDoc}

AgentSet neighbors4(int extentX, int extentY)

{@inheritDoc}

void notifySubscribers()

AgentSet other(Collection a)

Returns an agentset minus the caller.

Turtle otherEnd()

Returns the turtle opposite the asking link.

boolean outLinkNeighborQ(Turtle t)

Queries if there is a directed link from the caller to the turtle.

AgentSet outLinkNeighbors()

Returns the agentset of the callerŐs out link neighbor turtles.

Link outLinkTo(Turtle t)

Returns the callerŐs directed link to a turtle.

Patch patch(Number nX, Number nY)

Returns the patch containing a point.

Patch patchAhead(Number distance)

Returns the patch that is at a distance ahead of a turtle.

Patch patchAt(Number nX, Number nY)

Returns the patch at a direction (nX, nY) from the caller.

Patch patchAtHeadingAndDistance(Number nHeading, Number nDistance)

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

Patch patchHere()

Returns the patch where the turtle is located.

Patch patchLeftAndAhead(Number nAngle, Number nDistance)

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

Patch patchRightAndAhead(Number nAngle, Number nDistance)

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

AgentSet patches()

Returns an agentset containing all patches.

void pd()

Sets the turtleŐs pen to draw lines.

void pe()

Does nothing, included for translation compatibility.

void penDown()

Sets the turtleŐs pen to draw lines.

void penErase()

Does nothing, included for translation compatibility.

void penUp()

Sets the turtleŐs pen to stop drawing lines.

void pu()

Sets the turtleŐs pen to stop drawing lines.

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 registerSubscriber(Turtle t)

void removeFromFixedLeaves(OutOfContextSubject t)

void removeFromFreeLeaves(Turtle o)

void removeSubscriber(Turtle t)

void right(Number num)

Rotates the turtle to the right num degrees.

void rt(Number num)

Rotates the turtle to the right num degrees.

void run(String string)

Interprets a string as commands then runs the commands.

Object runresult(String string)

Interprets a string as a command then returns the result.

Turtle self()

Returns this turtle, patch, or link.

void setBaseTurtleProperties(Observer observer, TurtleFactory turtleFactory, String turtleShape, double heading, double color, NdPoint loc)

void setColor(Number color)

Sets the color of a turtle to the value color.

void setHeading(Number nNum)

Sets the heading of the turtle to nNum.

void setHiddenQ(boolean hidden)

Sets turtle visibility.

void setLabel(Object label)

Sets the label.

void setLabelColor(Number labelColor)

Sets the label color for a turtle to labelColor.

void setMyObserver(Observer myObserver)

void setMyTurtleFactory(TurtleFactory myTurtleFactory)

void setMyself(Object o)

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

void setPcolor(Number color)

Sets the color of patch here to pcolor.

void setPenMode(Number penMode)

Sets the pen setting of a turtle to penMode.

void setPenSize(Number penSize)

Sets the pen width of a turtle to penSize.

void setShape(String shape)

Sets the shape of a turtle to shape.

void setShapeChanged(boolean shapeChanged)

void setSize(Number size)

Sets the size of a turtle to size.

void setUserDefinedVariables(Turtle parent)

void setVisibilityChanged(boolean visibilityChanged)

static void setWhoCounter(Number whoCounter)

void setXcor(Number number)

Sets the x coordinate of a turtle to number.

void setYcor(Number number)

Sets the y coordinate of a turtle to number.

void setxy(Number nX, Number nY)

Sets the x-y coordinates of a turtle to (nX, nY).

void show(Object value)

Prints value with agent identifier to the console.

void showTurtle()

Makes turtle visible.

void st()

Makes turtle visible.

Stop stop()

Stops a turtle executing within a command closure.

String toString()

This method provides a human-readable name for the agent.

double towards(Turtle t)

Returns the direction to turtle t.

double towards(Patch p)

Returns the direction to patch p.

double towardsxy(Number nX, Number nY)

Returns the direction from a turtle or patch to a point.

Turtle turtle(Number number)

Returns the turtle of the given number.

AgentSet turtles()

Returns an agentset containing all turtles.

AgentSet turtlesAt(Number nX, Number nY)

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)

Returns an agentset of turtles on the same patch as a turtle.

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 update(Turtle o)

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

hiddenQ

public boolean hiddenQ


 
Method Detail

addToFixedLeaves

public void addToFixedLeaves(Turtle t)


addToFreeLeaves

public void addToFreeLeaves(Turtle o)


allLinks

public AgentSet allLinks()
{@inheritDoc}


allMyInLinks

public AgentSet allMyInLinks()
{@inheritDoc}


allMyLinks

public AgentSet allMyLinks()
{@inheritDoc}


allMyOutLinks

public AgentSet allMyOutLinks()
{@inheritDoc}


allQ

public boolean allQ(Collection a, Closure reporter)
Queries if all agents in a collection are true for a boolean closure.
Parameters:
a - a collection of ReLogoAgents
reporter - a boolean closure
Returns:
true or false based on whether all agents in a collection are true for reporter


ask

public void ask(AgentSet a, Closure askBlock)
Executes a set of commands for an agentset.
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)
Executes a set of commands for a patch.
Parameters:
p - a patch
askBlock - a set of commands


ask

public void ask(Link l, Closure askBlock)
Executes a set of commands for a link.
Parameters:
l - a link
askBlock - a set of commands


askCollection

public void askCollection(Collection l, Closure cl)


askTurtle

public void askTurtle(Closure cl)
exclude:


back

public void back(Number num)
Steps turtle backwards by a distance.
Parameters:
num - a distance


bk

public void bk(Number num)
Steps turtle backwards by a distance.
Parameters:
num - a distance


canMoveQ

public boolean canMoveQ(Number nDist)
Queries if turtle can move a distance.
Parameters:
nDist - a distance
Returns:
true or false based on whether turtle can move distance


compareTo

public int compareTo(Turtle t)


createLinkFrom

public Link createLinkFrom(Turtle t)
Makes a directed link from a turtle to the caller.
Parameters:
t - a turtle
Returns:
created link


createLinkFrom

public Link createLinkFrom(Turtle t, Closure closure)
Makes a directed link from a turtle to the caller then executes a set of commands on the created link.
Parameters:
t - a turtle
closure - a set of commands
Returns:
created link


createLinkTo

public Link createLinkTo(Turtle t)
Makes a directed link from the caller to a turtle.
Parameters:
t - a turtle
Returns:
created link


createLinkTo

public Link createLinkTo(Turtle t, Closure closure)
Makes a directed link from the caller to a turtle then executes a set of commands on the created link.
Parameters:
t - a turtle
closure - a set of commands
Returns:
created link


createLinkWith

public Link createLinkWith(Turtle t)
Makes a undirected link between the caller and a turtle.
Parameters:
t - a turtle
Returns:
created link


createLinkWith

public Link createLinkWith(Turtle t, Closure closure)
Makes an undirected link between the caller and a turtle then executes a set of commands on the created link.
Parameters:
t - a turtle
closure - a set of commands
Returns:
created link


createLinksFrom

public AgentSet createLinksFrom(Collection a)
Makes directed links from a collection of agents to the caller.
Parameters:
a - a collection of agents
Returns:
created links


createLinksFrom

public AgentSet createLinksFrom(AgentSet a, Closure closure)
Makes directed links from an agentset to the caller then executes a set of commands on the created links.
Parameters:
a - an agentset
closure - a set of commands
Returns:
created links


createLinksFrom

public AgentSet createLinksFrom(Collection a, Closure closure)
Makes directed links from a collection of agents to the caller then executes a set of commands on the created links.
Parameters:
a - a collection of agents
closure - a set of commands
Returns:
created links


createLinksTo

public AgentSet createLinksTo(Collection a)
Makes directed links from the caller to a collection of agents.
Parameters:
a - a collection of agents
Returns:
created links


createLinksTo

public AgentSet createLinksTo(AgentSet a, Closure closure)
Makes directed links from the caller to an agentset then executes a set of commands on the created links.
Parameters:
a - an agentset
closure - a set of commands
Returns:
created links


createLinksTo

public AgentSet createLinksTo(Collection a, Closure closure)
Makes directed links from the caller to a collection of agents then executes a set of commands on the created links.
Parameters:
a - a collection of agents
closure - a set of commands
Returns:
created links


createLinksWith

public AgentSet createLinksWith(Collection a)
Makes undirected links between the caller and a collection of agents.
Parameters:
a - an collection of agents
Returns:
created links


createLinksWith

public AgentSet createLinksWith(AgentSet a, Closure closure)
Makes undirected links between the caller and an agentset then executes a set of commands on the created links.
Parameters:
a - an agentset
closure - a set of commands
Returns:
created links


createLinksWith

public AgentSet createLinksWith(Collection a, Closure closure)
Makes undirected links between the caller and a collection of agents then executes a set of commands on the created links.
Parameters:
a - a collection of agents
closure - a set of commands
Returns:
created links


die

public void die()
Removes the turtle.


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


dx

public double dx()
Returns the turtleŐs x increment for one step.
returns:
turtleŐs x increment for one step


dy

public double dy()
Returns the turtleŐs y increment for one step.
returns:
turtleŐs y increment for one step


face

public void face(Turtle t)
Faces the caller towards a turtle.
Parameters:
t - a turtle


face

public void face(Patch p)
Faces the caller towards a patch.
Parameters:
p - a patch


facexy

public void facexy(Number nX, Number nY)
Faces the caller towards a point.
Parameters:
nX - x coordinate
nY - y coordinate


fd

public void fd(Number num)
Steps turtle forward by a distance.
Parameters:
num - a distance


fileShow

public void fileShow(Object value)
Prints value with agent identifier to current file with a newline.
Parameters:
value - any object


fixedLeavesContains

public boolean fixedLeavesContains(Turtle t)


forward

public void forward(Number num)
Steps turtle forward by a distance.
Parameters:
num - a distance


freeLeavesContains

public boolean freeLeavesContains(Object o)


getColor

public double getColor()
Returns the color of a turtle. @ returns color of a turtle in the range [0, 140)


getHeading

public double getHeading()
Returns the heading of the turtle. @ return heading of the turtle in the range [0, 360)


getHeadingInRads

public double getHeadingInRads()


getLabel

public Object getLabel()
Returns the label.
Returns:
the turtle label


getLabelColor

public double getLabelColor()
Returns the label color for a turtle or link. @ returns label color in the range [0, 140)


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()


getMyTurtleFactory

public TurtleFactory getMyTurtleFactory()


getPcolor

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


getPenMode

public int getPenMode()
Returns the pen setting of a turtle.
Returns:
pen setting of a turtle, PEN_UP or PEN_DOWN


getPenSize

public int getPenSize()
Returns the pen width of a turtle.
Returns:
pen width of a turtle


getPxcor

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


getPycor

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


getShape

public String getShape()
Returns the shape of a turtle.
Returns:
shape of a turtle


getSize

public double getSize()
Returns the size of a turtle.
Returns:
size of a turtle


getTurtleLocation

public NdPoint getTurtleLocation()


getTurtleType

public String getTurtleType()


getWho

public int getWho()
Returns the id number of a turtle.
Returns:
id number of a turtle


getWhoCounter

public static int getWhoCounter()


getXcor

public double getXcor()
Returns the x coordinate of a turtle.
Returns:
present x coordinate of the turtle


getYcor

public double getYcor()
Returns the y coordinate of a turtle.
Returns:
y coordinate of a turtle


hatch

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


hatch

public AgentSet hatch(Number number, Closure closure)
Makes a number of new turtles and then executes a set of commands on the created turtles.
Parameters:
number - a number
closure - a set of commands
Returns:
created turtles


hatch

public AgentSet hatch(Number number, Closure closure, String childType)
Makes a number of new turtles of a specific type and then executes a set of commands on the created turtles.
Parameters:
number - a number
closure - a set of commands
childType - a string
number
closure
childType
Returns:
created turtles


hatch

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


hideTurtle

public void hideTurtle()
Turtle appears hidden.


home

public void home()
Turtle goes to (0,0).


ht

public void ht()
Turtle appears hidden.


inCone

public AgentSet inCone(Collection a, Number num, Number angle)
Returns an agentset within a distance and heading cone of the caller.
Parameters:
a - a collection of agents
num - a distance
anlge - the cone angle centered on caller's heading
Returns:
agentset subset of collection a within a distance num and within cone angle of the caller


inLinkFrom

public Link inLinkFrom(Turtle t)
Returns the directed link from a turtle to the caller.
Parameters:
t - a turtle
Returns:
directed link from turtle t to the caller


inLinkNeighborQ

public boolean inLinkNeighborQ(Turtle t)
Queries if there is a directed link from a turtle to the caller.
Parameters:
t - a turtle
Returns:
true or false based on whether there is a directed link from turtle t to the caller


inLinkNeighbors

public AgentSet inLinkNeighbors()
Returns the agentset with directed links to the caller.
Returns:
agentset with directed links to the caller


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


isHiddenQ

public boolean isHiddenQ()
Queries if caller is hidden.
Returns:
true or false based on whether caller is hidden


isShapeChanged

public boolean isShapeChanged()


isVisibilityChanged

public boolean isVisibilityChanged()


jump

public void jump(Number num)
Moves turtle forward num units.
Parameters:
num - a number


left

public void left(Number num)
Rotates the turtle to the left num degrees.
Parameters:
num - an angle in degrees in the range [0, 360]


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


linkNeighborQ

public boolean linkNeighborQ(Turtle t)
Reports true if there is an undirected link connecting t and the caller.


linkNeighbors

public AgentSet linkNeighbors()
Reports the agentset of all turtles found at the other end of undirected links connected to the calling turtle.


linkWith

public Link linkWith(Turtle t)
Report the link between t and the caller. If no link exists then it reports null.


links

public AgentSet links()
{@inheritDoc}


lt

public void lt(Number num)
Rotates the turtle to the left num degrees.
Parameters:
num - an angle in degrees in the range [0, 360]


maxNOf

public AgentSet maxNOf(int number, Collection a, Closure reporter)
Returns an agentset consisting of a specified number of agents which have the greatest value when operated on by a set of commands.
Parameters:
number - an integer
a - a collection
closure - a set of commands
Returns:
agentset containing number agents with largest values when operated on by closure


maxOneOf

public ReLogoAgent maxOneOf(Collection a, Closure reporter)
Returns the ReLogoAgent with the largest value when operated on by a set of commands.
Parameters:
a - a collection
closure - a set of commands
Returns:
ReLogoAgent with the largest value when operated on by closure


minNOf

public AgentSet minNOf(int number, Collection a, Closure reporter)
Returns an agentset consisting of a specified number of agents which have the lowest value when operated on by a set of commands.
Parameters:
number - an integer
a - a collection
closure - a set of commands
Returns:
agentset containing number agents with smallest values when operated on by closure


minOneOf

public ReLogoAgent minOneOf(Collection a, Closure reporter)
Returns the ReLogoAgent with the smallest value when operated on by a set of commands.
Parameters:
a - a collection
closure - a set of commands
Returns:
ReLogoAgent with the smallest value when operated on by closure


move

public void move(Number nNumber)


moveTo

public void moveTo(Turtle t)
Moves a turtle to the same location as turtle t.
Parameters:
t - a turtle


moveTo

public void moveTo(Patch p)
Moves a turtle to the same location as patch p.
Parameters:
p - a patch


mv

public void mv(Number nNumber)


myInLinks

public AgentSet myInLinks()
{@inheritDoc}


myLinks

public AgentSet myLinks()
{@inheritDoc}


myOutLinks

public AgentSet myOutLinks()
{@inheritDoc}


myself

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


neighbors

public AgentSet neighbors()
{@inheritDoc}


neighbors

public AgentSet neighbors(int extent)
{@inheritDoc}


neighbors

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


neighbors4

public AgentSet neighbors4()
{@inheritDoc}


neighbors4

public AgentSet neighbors4(int extent)
{@inheritDoc}


neighbors4

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


notifySubscribers

public void notifySubscribers()


other

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


otherEnd

public Turtle otherEnd()
Returns the turtle opposite the asking link.
Returns:
turtle opposite the asking link


outLinkNeighborQ

public boolean outLinkNeighborQ(Turtle t)
Queries if there is a directed link from the caller to the turtle.
Parameters:
t - a turtle
Returns:
true or false based on whether there is a directed link from the caller to the turtle.


outLinkNeighbors

public AgentSet outLinkNeighbors()
Returns the agentset of the callerŐs out link neighbor turtles.
Returns:
agentset of the callerŐs out link neighbor turtles


outLinkTo

public Link outLinkTo(Turtle t)
Returns the callerŐs directed link to a turtle.
Parameters:
t - a turtle
Returns:
the callerŐs directed link to turtle t


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)


patchAhead

public Patch patchAhead(Number distance)
Returns the patch that is at a distance ahead of a turtle.
Parameters:
distance - a number
Returns:
patch that is at distance from the calling turtle


patchAt

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


patchAtHeadingAndDistance

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


patchHere

public Patch patchHere()
Returns the patch where the turtle is located.
Returns:
patch where the turtle is located


patchLeftAndAhead

public Patch patchLeftAndAhead(Number nAngle, Number nDistance)
Returns the patch that is at a distance and degrees left from the caller.
Parameters:
nAngle - an angle in degrees
nDistance - a number
Returns:
patch that is at nDistance and nAngle left from the caller


patchRightAndAhead

public Patch patchRightAndAhead(Number nAngle, Number nDistance)
Returns the patch that is at a distance and degrees right from the caller.
Parameters:
nAngle - an angle in degrees
nDistance - a number
Returns:
patch that is at nDistance and nAngle right from the caller


patches

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


pd

public void pd()
Sets the turtleŐs pen to draw lines.


pe

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


penDown

public void penDown()
Sets the turtleŐs pen to draw lines.


penErase

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


penUp

public void penUp()
Sets the turtleŐs pen to stop drawing lines.


pu

public void pu()
Sets the turtleŐs pen to stop drawing lines.


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


registerSubscriber

public void registerSubscriber(Turtle t)


removeFromFixedLeaves

public void removeFromFixedLeaves(OutOfContextSubject t)


removeFromFreeLeaves

public void removeFromFreeLeaves(Turtle o)


removeSubscriber

public void removeSubscriber(Turtle t)


right

public void right(Number num)
Rotates the turtle to the right num degrees.
Parameters:
num - an angle in degrees in the range [0, 360]


rt

public void rt(Number num)
Rotates the turtle to the right num degrees.
Parameters:
num - an angle in degrees in the range [0, 360]


run

public void run(String string)
Interprets a string as commands then runs the commands.
Parameters:
string - a string


runresult

public Object runresult(String string)
Interprets a string as a command then returns the result.
Parameters:
string - a string
Returns:
result of interpreting string


self

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


setBaseTurtleProperties

public void setBaseTurtleProperties(Observer observer, TurtleFactory turtleFactory, String turtleShape, double heading, double color, NdPoint loc)


setColor

public void setColor(Number color)
Sets the color of a turtle to the value color.
Parameters:
color - a number


setHeading

public void setHeading(Number nNum)
Sets the heading of the turtle to nNum.
Parameters:
nNum - a number in degrees


setHiddenQ

public void setHiddenQ(boolean hidden)
Sets turtle visibility.
Parameters:
hidden - boolean visibility


setLabel

public void setLabel(Object label)
Sets the label.
Parameters:
label - a label


setLabelColor

public void setLabelColor(Number labelColor)
Sets the label color for a turtle to labelColor.
Parameters:
labelColor - a number in range [0, 140)


setMyObserver

public void setMyObserver(Observer myObserver)


setMyTurtleFactory

public void setMyTurtleFactory(TurtleFactory myTurtleFactory)


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(Number color)
Sets the color of patch here to pcolor.
Parameters:
pcolor - a number in range [0,140)


setPenMode

public void setPenMode(Number penMode)
Sets the pen setting of a turtle to penMode.
Parameters:
penMode - a pen mode, PEN_UP or PEN_DOWN


setPenSize

public void setPenSize(Number penSize)
Sets the pen width of a turtle to penSize.
Parameters:
penSize - a number


setShape

public void setShape(String shape)
Sets the shape of a turtle to shape.
Parameters:
shape - a string


setShapeChanged

public void setShapeChanged(boolean shapeChanged)


setSize

public void setSize(Number size)
Sets the size of a turtle to size.
Parameters:
size - a number


setUserDefinedVariables

public void setUserDefinedVariables(Turtle parent)


setVisibilityChanged

public void setVisibilityChanged(boolean visibilityChanged)


setWhoCounter

public static void setWhoCounter(Number whoCounter)


setXcor

public void setXcor(Number number)
Sets the x coordinate of a turtle to number.
Parameters:
number - a number


setYcor

public void setYcor(Number number)
Sets the y coordinate of a turtle to number.
Parameters:
number - a number


setxy

public void setxy(Number nX, Number nY)
Sets the x-y coordinates of a turtle to (nX, nY).
Parameters:
nX - a number
nY - a number


show

public void show(Object value)
Prints value with agent identifier to the console.
Parameters:
value - any object


showTurtle

public void showTurtle()
Makes turtle visible.


st

public void st()
Makes turtle visible.


stop

public Stop stop()
Stops a turtle executing within a command closure.


toString

public String toString()
This method provides a human-readable name for the agent.
method:
toString


towards

public double towards(Turtle t)
Returns the direction to turtle t.
Parameters:
t - a turtle
Returns:
direction from this turtle to turtle t


towards

public double towards(Patch p)
Returns the direction to patch p.
Parameters:
p - a patch
Returns:
direction from this patch to patch p


towardsxy

public double towardsxy(Number nX, Number nY)
Returns the direction from a turtle or patch to a point.
Parameters:
nX - a number
nY - a number
Returns:
direction from a turtle or patch to the point (nX, nY)


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 nX, Number nY)
Returns the agentset on the patch at the direction (ndx, ndy) from the caller.
returns:
agentset at the direction (nX, nY) from the caller
Parameters:
nX - a number
nY - 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)
Returns an agentset of turtles on the same patch as a turtle.
Parameters:
t - a turtle
Returns:
agentset of turtles on the same patch at 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


update

public void update(Turtle o)


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.0