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 Agent
AgentException
public Object getLinkVariable(int vn) throws AgentException
getLinkVariable
in class Agent
AgentException
public Object getTurtleOrLinkVariable(String varName) throws AgentException
getTurtleOrLinkVariable
in class Agent
AgentException
public Object getLinkBreedVariable(String name) throws AgentException
getLinkBreedVariable
in class Agent
AgentException
public Object getBreedVariable(String name) throws AgentException
getBreedVariable
in class Agent
AgentException
public Object getVariable(int vn)
Agent
getVariable
in interface Agent
getVariable
in class Agent
vn
- the index into the agent variable arraypublic void setObserverVariable(int vn, Object value) throws AgentException, LogoException
setObserverVariable
in class Agent
AgentException
LogoException
public void setTurtleVariable(int vn, Object value) throws AgentException
setTurtleVariable
in class Agent
AgentException
public void setTurtleVariable(int vn, double value) throws AgentException
setTurtleVariable
in class Agent
AgentException
public void setBreedVariable(String name, Object value) throws AgentException
setBreedVariable
in class Agent
AgentException
public void setLinkVariable(int vn, Object value) throws AgentException
setLinkVariable
in class Agent
AgentException
public void setLinkVariable(int vn, double value) throws AgentException
setLinkVariable
in class Agent
AgentException
public void setTurtleOrLinkVariable(String varName, Object value) throws AgentException
setTurtleOrLinkVariable
in class Agent
AgentException
public void setLinkBreedVariable(String name, Object value) throws AgentException
setLinkBreedVariable
in class Agent
AgentException
public void setVariable(int vn, Object value) throws AgentException
Agent
setVariable
in interface Agent
setVariable
in class Agent
vn
- 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 changedpublic void setPatchVariable(int vn, Object value) throws AgentException
setPatchVariable
in class Agent
AgentException
public void setPatchVariable(int vn, double value) throws AgentException
setPatchVariable
in class Agent
AgentException
public Object getPatchVariable(int vn)
getPatchVariable
in class Agent
public double getPatchVariableDouble(int vn)
public Patch getPatchAtOffsets(double dx, double dy) throws AgentException
Patch
getPatchAtOffsets
in interface Patch
getPatchAtOffsets
in class Agent
dx
- 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()
Patch
pcolor
variable
pcolor
in interface Patch
public 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
AgentException
public int pxcor()
Patch
pxcor
variable
pxcor
in interface Patch
public int pycor()
Patch
pycor
variable
pycor
in interface Patch
public Object label()
public boolean hasLabel()
Patch
label
variable contains something other than an empty string
hasLabel
in interface Patch
public String labelString()
Patch
label
variable
labelString
in interface Patch
public void label(Object label)
public Object labelColor()
Patch
label-color
variable
labelColor
in interface Patch
public void labelColor(double labelColor)
public void labelColor(Double labelColor)
public void labelColor(LogoList rgb, int varIndex) throws AgentException
AgentException
public String toString()
toString
in class Object
public String classDisplayName()
Agent
classDisplayName
in interface Agent
classDisplayName
in class Agent
public Class<Patch> getAgentClass()
getAgentClass
in class Agent
public int getAgentBit()
getAgentBit
in class Agent
public String shape()
Agent
shape
in interface Agent
public double size()
Agent
size
in interface Agent
public Patch getPatchNorth()
public Patch getPatchSouth()
public Patch getPatchEast()
public Patch getPatchWest()
public Patch getPatchNorthWest()
public Patch getPatchSouthWest()
public Patch getPatchSouthEast()
public Patch getPatchNorthEast()