java.lang.Objectjava.util.Observable
org.nlogo.agent.Agent
public abstract class Agent
Field Summary | |
---|---|
long |
id
|
Object[] |
variables
|
Constructor Summary | |
---|---|
Agent(World world)
|
Method Summary | |
---|---|
abstract String |
classDisplayName()
Returns a displayable name of this type of agent (Turtle, Link, Patch, Observer) |
int |
compareTo(Agent a)
|
abstract int |
getAgentBit()
|
abstract Class<? extends Agent> |
getAgentClass()
|
abstract Object |
getBreedVariable(String name)
|
abstract Object |
getLinkBreedVariable(String name)
|
abstract Object |
getLinkVariable(int vn)
|
abstract Object |
getObserverVariable(int vn)
|
abstract Patch |
getPatchAtOffsets(double dx,
double dy)
|
abstract Object |
getPatchVariable(int vn)
|
abstract Object |
getTurtleOrLinkVariable(String varName)
|
abstract Object |
getTurtleVariable(int vn)
|
abstract Object |
getVariable(int vn)
Returns the value of the variable in the given position of the agent variable array |
int |
getVariableCount()
|
long |
id()
Returns the id number of this agent. |
abstract void |
setBreedVariable(String name,
Object value)
|
abstract void |
setLinkBreedVariable(String name,
Object value)
|
abstract void |
setLinkVariable(int vn,
double value)
|
abstract void |
setLinkVariable(int vn,
Object value)
|
abstract void |
setObserverVariable(int vn,
Object value)
|
abstract void |
setPatchVariable(int vn,
double value)
|
abstract void |
setPatchVariable(int vn,
Object value)
|
abstract void |
setTurtleOrLinkVariable(String varName,
Object value)
|
abstract void |
setTurtleVariable(int vn,
double value)
|
abstract void |
setTurtleVariable(int vn,
Object value)
|
abstract void |
setVariable(int vn,
Object value)
Sets the variable in the position vn of the agent variable array to value |
ValueConstraint |
variableConstraint(int vn)
|
void |
variableConstraint(int vn,
ValueConstraint con)
|
World |
world()
Returns the world object associated with this agent |
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, toString, wait, wait, wait |
Methods inherited from interface org.nlogo.api.Agent |
---|
shape, size |
Field Detail |
---|
public long id
public Object[] variables
Constructor Detail |
---|
public Agent(World world)
Method Detail |
---|
public World world()
Agent
world
in interface Agent
public long id()
Agent
id
in interface Agent
public int compareTo(Agent a)
compareTo
in interface Comparable<Agent>
public int getVariableCount()
public abstract Object getVariable(int vn)
Agent
getVariable
in interface Agent
vn
- the index into the agent variable arraypublic abstract void setVariable(int vn, Object value) throws AgentException, LogoException
Agent
setVariable
in interface 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 ValueConstraint variableConstraint(int vn)
public void variableConstraint(int vn, ValueConstraint con)
public abstract Object getObserverVariable(int vn)
public abstract Object getTurtleVariable(int vn) throws AgentException
AgentException
public abstract Object getBreedVariable(String name) throws AgentException
AgentException
public abstract Object getLinkBreedVariable(String name) throws AgentException
AgentException
public abstract Object getLinkVariable(int vn) throws AgentException
AgentException
public abstract Object getPatchVariable(int vn) throws AgentException
AgentException
public abstract Object getTurtleOrLinkVariable(String varName) throws AgentException
AgentException
public abstract void setObserverVariable(int vn, Object value) throws AgentException, LogoException
AgentException
LogoException
public abstract void setTurtleVariable(int vn, Object value) throws AgentException
AgentException
public abstract void setTurtleVariable(int vn, double value) throws AgentException
AgentException
public abstract void setLinkVariable(int vn, Object value) throws AgentException
AgentException
public abstract void setLinkVariable(int vn, double value) throws AgentException
AgentException
public abstract void setBreedVariable(String name, Object value) throws AgentException
AgentException
public abstract void setLinkBreedVariable(String name, Object value) throws AgentException
AgentException
public abstract void setPatchVariable(int vn, Object value) throws AgentException
AgentException
public abstract void setPatchVariable(int vn, double value) throws AgentException
AgentException
public abstract void setTurtleOrLinkVariable(String varName, Object value) throws AgentException
AgentException
public abstract Patch getPatchAtOffsets(double dx, double dy) throws AgentException
AgentException
public abstract String classDisplayName()
Agent
classDisplayName
in interface Agent
public abstract Class<? extends Agent> getAgentClass()
public abstract int getAgentBit()