java.lang.Objectjava.util.Observable
org.nlogo.agent.Agent
org.nlogo.agent.Patch
public class Patch
| Field Summary | |
|---|---|
static int |
BIT
|
static int |
LAST_PREDEFINED_VAR
|
int |
NUMBER_PREDEFINED_VARS
|
AgentSet |
patchNeighbors
|
AgentSet |
patchNeighbors4
|
int |
pxcor
|
int |
pycor
|
List<Turtle> |
turtlesHere
|
static int |
VAR_PCOLOR
|
static int |
VAR_PLABEL
|
static int |
VAR_PLABELCOLOR
|
static int |
VAR_PXCOR
|
static int |
VAR_PYCOR
|
| Fields inherited from class org.nlogo.agent.Agent |
|---|
id, variables |
| Method Summary | |
|---|---|
String |
classDisplayName()
Returns a displayable name of this type of agent (Turtle, Link, Patch, Observer) |
Patch |
fastGetPatchAt(int x,
int y)
|
int |
getAgentBit()
|
Class<Patch> |
getAgentClass()
|
Object |
getBreedVariable(String name)
|
Object |
getLinkBreedVariable(String name)
|
Object |
getLinkVariable(int vn)
|
AgentSet |
getNeighbors()
|
AgentSet |
getNeighbors4()
|
Object |
getObserverVariable(int vn)
|
Patch |
getPatchAtOffsets(double dx,
double dy)
Returns the patch at dx and dy from this patch |
Patch |
getPatchEast()
|
Patch |
getPatchNorth()
|
Patch |
getPatchNorthEast()
|
Patch |
getPatchNorthWest()
|
Patch |
getPatchSouth()
|
Patch |
getPatchSouthEast()
|
Patch |
getPatchSouthWest()
|
Object |
getPatchVariable(int vn)
|
double |
getPatchVariableDouble(int vn)
|
Patch |
getPatchWest()
|
Object |
getTurtleOrLinkVariable(String varName)
|
Object |
getTurtleVariable(int vn)
|
Object |
getVariable(int vn)
Returns the value of the variable in the given position of the agent variable array |
boolean |
hasLabel()
Returns true if the label variable contains something other than an empty string |
Object |
label()
|
void |
label(Object label)
|
Object |
labelColor()
Returns the value of the label-color variable |
void |
labelColor(double labelColor)
|
void |
labelColor(Double labelColor)
|
void |
labelColor(LogoList rgb,
int varIndex)
|
String |
labelString()
Returns the value of the label variable |
Object |
pcolor()
Returns the value of the pcolor variable |
void |
pcolor(double pcolor)
|
void |
pcolor(Double boxedColor)
|
void |
pcolor(LogoList rgb)
|
void |
pcolor(LogoList rgb,
int varIndex,
boolean allowAlpha)
|
double |
pcolorDouble()
|
void |
pcolorDoubleUnchecked(Double boxedColor)
|
int |
pxcor()
Returns the value of the pxcor variable |
int |
pycor()
Returns the value of the pycor variable |
void |
setBreedVariable(String name,
Object value)
|
void |
setLinkBreedVariable(String name,
Object value)
|
void |
setLinkVariable(int vn,
double value)
|
void |
setLinkVariable(int vn,
Object value)
|
void |
setObserverVariable(int vn,
Object value)
|
void |
setPatchVariable(int vn,
double value)
|
void |
setPatchVariable(int vn,
Object value)
|
void |
setTurtleOrLinkVariable(String varName,
Object value)
|
void |
setTurtleVariable(int vn,
double value)
|
void |
setTurtleVariable(int vn,
Object value)
|
void |
setVariable(int vn,
Object value)
Sets the variable in the position vn of the agent variable array to value |
String |
shape()
Returns the name of the current shape, empty string in the case of patches. |
double |
size()
Returns the size of this agent |
Turtle |
sprout(int c,
int heading,
AgentSet breed)
|
String |
toString()
|
| Methods inherited from class org.nlogo.agent.Agent |
|---|
compareTo, getVariableCount, id, variableConstraint, variableConstraint, world |
| Methods inherited from class java.util.Observable |
|---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.nlogo.api.Agent |
|---|
id, world |
| Field Detail |
|---|
public static final int VAR_PXCOR
public static final int VAR_PYCOR
public static final int VAR_PCOLOR
public static final int VAR_PLABEL
public static final int VAR_PLABELCOLOR
public static final int LAST_PREDEFINED_VAR
public int NUMBER_PREDEFINED_VARS
public final List<Turtle> turtlesHere
public AgentSet patchNeighbors
public AgentSet patchNeighbors4
public final int pxcor
public final int pycor
public static final int BIT
| Method Detail |
|---|
public Object getObserverVariable(int vn)
getObserverVariable in class Agent
public Object getTurtleVariable(int vn)
throws AgentException
getTurtleVariable in class AgentAgentException
public Object getLinkVariable(int vn)
throws AgentException
getLinkVariable in class AgentAgentException
public Object getTurtleOrLinkVariable(String varName)
throws AgentException
getTurtleOrLinkVariable in class AgentAgentException
public Object getLinkBreedVariable(String name)
throws AgentException
getLinkBreedVariable in class AgentAgentException
public Object getBreedVariable(String name)
throws AgentException
getBreedVariable in class AgentAgentExceptionpublic Object getVariable(int vn)
Agent
getVariable in interface AgentgetVariable in class Agentvn - the index into the agent variable array
public void setObserverVariable(int vn,
Object value)
throws AgentException,
LogoException
setObserverVariable in class AgentAgentException
LogoException
public void setTurtleVariable(int vn,
Object value)
throws AgentException
setTurtleVariable in class AgentAgentException
public void setTurtleVariable(int vn,
double value)
throws AgentException
setTurtleVariable in class AgentAgentException
public void setBreedVariable(String name,
Object value)
throws AgentException
setBreedVariable in class AgentAgentException
public void setLinkVariable(int vn,
Object value)
throws AgentException
setLinkVariable in class AgentAgentException
public void setLinkVariable(int vn,
double value)
throws AgentException
setLinkVariable in class AgentAgentException
public void setTurtleOrLinkVariable(String varName,
Object value)
throws AgentException
setTurtleOrLinkVariable in class AgentAgentException
public void setLinkBreedVariable(String name,
Object value)
throws AgentException
setLinkBreedVariable in class AgentAgentException
public void setVariable(int vn,
Object value)
throws AgentException
Agent
setVariable in interface AgentsetVariable in class Agentvn - the index into the agent variable arrayvalue - the new value for the variable
AgentException - If value is the wrong type for the given variable or if you try to change variables that cannot be changed
public void setPatchVariable(int vn,
Object value)
throws AgentException
setPatchVariable in class AgentAgentException
public void setPatchVariable(int vn,
double value)
throws AgentException
setPatchVariable in class AgentAgentExceptionpublic Object getPatchVariable(int vn)
getPatchVariable in class Agentpublic double getPatchVariableDouble(int vn)
public Patch getPatchAtOffsets(double dx,
double dy)
throws AgentException
Patch
getPatchAtOffsets in interface PatchgetPatchAtOffsets in class Agentdx - the x offset from this patchdy - the y offset from this patch
AgentException
public Patch fastGetPatchAt(int x,
int y)
public AgentSet getNeighbors()
public AgentSet getNeighbors4()
public Turtle sprout(int c,
int heading,
AgentSet breed)
public double pcolorDouble()
public Object pcolor()
Patchpcolor variable
pcolor in interface Patchpublic void pcolor(double pcolor)
public void pcolor(Double boxedColor)
public void pcolorDoubleUnchecked(Double boxedColor)
public void pcolor(LogoList rgb)
throws AgentException
AgentException
public void pcolor(LogoList rgb,
int varIndex,
boolean allowAlpha)
throws AgentException
AgentExceptionpublic int pxcor()
Patchpxcor variable
pxcor in interface Patchpublic int pycor()
Patchpycor variable
pycor in interface Patchpublic Object label()
public boolean hasLabel()
Patchlabel variable contains something other than an empty string
hasLabel in interface Patchpublic String labelString()
Patchlabel variable
labelString in interface Patchpublic void label(Object label)
public Object labelColor()
Patchlabel-color variable
labelColor in interface Patchpublic void labelColor(double labelColor)
public void labelColor(Double labelColor)
public void labelColor(LogoList rgb,
int varIndex)
throws AgentException
AgentExceptionpublic String toString()
toString in class Objectpublic String classDisplayName()
Agent
classDisplayName in interface AgentclassDisplayName in class Agentpublic Class<Patch> getAgentClass()
getAgentClass in class Agentpublic int getAgentBit()
getAgentBit in class Agentpublic String shape()
Agent
shape in interface Agentpublic double size()
Agent
size in interface Agentpublic Patch getPatchNorth()
public Patch getPatchSouth()
public Patch getPatchEast()
public Patch getPatchWest()
public Patch getPatchNorthWest()
public Patch getPatchSouthWest()
public Patch getPatchSouthEast()
public Patch getPatchNorthEast()