java.lang.Objectjava.util.Observable
org.nlogo.agent.Agent
org.nlogo.agent.Observer
public class Observer
Field Summary | |
---|---|
static int |
BIT
|
Fields inherited from class org.nlogo.agent.Agent |
---|
id, variables |
Constructor Summary | |
---|---|
Observer(World world)
|
Method Summary | |
---|---|
void |
assertVariableConstraint(int vn,
Object value)
|
boolean |
atHome2D()
|
boolean |
atHome3D()
|
String |
classDisplayName()
Returns a displayable name of this type of agent (Turtle, Link, Patch, Observer) |
double |
dist()
|
double |
distance(Agent agent)
|
double |
distance(Turtle t)
|
double |
dx()
|
double |
dy()
|
double |
dz()
|
void |
face(Agent agent)
|
void |
face(double x,
double y)
|
int |
followDistance()
Returns the current distance behind the followed turtle the 3D view is displaying |
void |
followDistance(int followDistance)
|
double |
followOffsetX()
|
double |
followOffsetY()
|
int |
getAgentBit()
|
Class<Observer> |
getAgentClass()
|
Object |
getBreedVariable(String name)
|
Object |
getLinkBreedVariable(String name)
|
Object |
getLinkVariable(int vn)
|
Object |
getObserverVariable(int vn)
|
Patch |
getPatchAtOffsets(double dx,
double dy)
|
Object |
getPatchVariable(int vn)
|
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 |
double |
heading()
|
void |
heading(double heading)
|
void |
home()
|
void |
moveto(Agent otherAgent)
|
void |
orbitRight(double delta)
|
void |
orbitUp(double delta)
|
double |
oxcor()
|
void |
oxcor(double oxcor)
|
void |
oxyandzcor(double oxcor,
double oycor,
double ozcor)
|
double |
oycor()
|
void |
oycor(double oycor)
|
double |
ozcor()
|
void |
ozcor(double ozcor)
|
Perspective |
perspective()
Returns the current perspective |
void |
perspective(Perspective perspective)
|
double |
pitch()
|
void |
pitch(double pitch)
|
void |
resetPerspective()
|
double |
roll()
|
void |
roll(double roll)
|
Vect |
rotationPoint()
|
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 |
setOrientation(double heading,
double pitch,
double roll)
|
void |
setPatchVariable(int vn,
double value)
|
void |
setPatchVariable(int vn,
Object value)
|
void |
setPerspective(Perspective perspective)
|
void |
setPerspective(Perspective perspective,
Agent agent)
|
void |
setRotationPoint(Agent agent)
|
void |
setRotationPoint(double x,
double y,
double z)
|
void |
setRotationPoint(Vect v)
|
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 |
Agent |
targetAgent()
Returns the currently watched or followed agent (or nobody) |
void |
targetAgent(Agent agent)
|
String |
toString()
|
void |
translate(double thetaX,
double thetaY)
|
boolean |
updatePosition()
|
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 BIT
Constructor Detail |
---|
public Observer(World world)
Method Detail |
---|
public Object getVariable(int vn)
Agent
getVariable
in interface Agent
getVariable
in class Agent
vn
- the index into the agent variable arraypublic Object getObserverVariable(int vn)
getObserverVariable
in class Agent
public Object getTurtleVariable(int vn) throws AgentException
getTurtleVariable
in class Agent
AgentException
public Object getTurtleOrLinkVariable(String varName) throws AgentException
getTurtleOrLinkVariable
in class Agent
AgentException
public Object getBreedVariable(String name) throws AgentException
getBreedVariable
in class Agent
AgentException
public Object getLinkVariable(int vn) throws AgentException
getLinkVariable
in class Agent
AgentException
public Object getLinkBreedVariable(String name) throws AgentException
getLinkBreedVariable
in class Agent
AgentException
public Object getPatchVariable(int vn) throws AgentException
getPatchVariable
in class Agent
AgentException
public void setVariable(int vn, Object value) throws AgentException, LogoException
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 changed
LogoException
public void assertVariableConstraint(int vn, Object value) throws AgentException, LogoException
AgentException
LogoException
public 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 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 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 setLinkBreedVariable(String name, Object value) throws AgentException
setLinkBreedVariable
in class Agent
AgentException
public void setTurtleOrLinkVariable(String varName, Object value) throws AgentException
setTurtleOrLinkVariable
in class Agent
AgentException
public Perspective perspective()
Observer
perspective
in interface Observer
public void perspective(Perspective perspective)
public Agent targetAgent()
Observer
targetAgent
in interface Observer
public void targetAgent(Agent agent)
public double oxcor()
oxcor
in interface Observer
public void oxcor(double oxcor)
public double oycor()
oycor
in interface Observer
public void oycor(double oycor)
public double ozcor()
ozcor
in interface Observer
public void ozcor(double ozcor)
public double followOffsetX()
public double followOffsetY()
public double heading()
heading
in interface Observer
public void heading(double heading)
public double pitch()
pitch
in interface Observer
public void pitch(double pitch)
public double roll()
roll
in interface Observer
public void roll(double roll)
public double dist()
dist
in interface Observer
public void setRotationPoint(Vect v)
public void setRotationPoint(double x, double y, double z)
public void setRotationPoint(Agent agent)
public Vect rotationPoint()
public int followDistance()
Observer
followDistance
in interface Observer
public void followDistance(int followDistance)
public void oxyandzcor(double oxcor, double oycor, double ozcor)
public void setOrientation(double heading, double pitch, double roll)
public double dx()
dx
in interface Observer
public double dy()
dy
in interface Observer
public double dz()
dz
in interface Observer
public void face(Agent agent)
public void face(double x, double y)
public void moveto(Agent otherAgent) throws AgentException
AgentException
public void setPerspective(Perspective perspective, Agent agent)
setPerspective
in interface Observer
public void setPerspective(Perspective perspective)
public boolean updatePosition()
public double distance(Agent agent)
public double distance(Turtle t)
public void resetPerspective()
public void home()
public boolean atHome2D()
public boolean atHome3D()
public Patch getPatchAtOffsets(double dx, double dy) throws AgentException
getPatchAtOffsets
in class Agent
AgentException
public String toString()
toString
in class Object
public String classDisplayName()
Agent
classDisplayName
in interface Agent
classDisplayName
in class Agent
public Class<Observer> 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 void orbitRight(double delta)
public void orbitUp(double delta)
public void translate(double thetaX, double thetaY)