org.nlogo.api
Interface Agent

All Known Subinterfaces:
Link, Link3D, LinkStamp3D, Observer, Patch, Patch3D, Turtle, Turtle3D, TurtleStamp3D
All Known Implementing Classes:
Agent, DummyLink, Link, Link3D, LinkStamp3D, Observer, Observer3D, Patch, Patch3D, Turtle, Turtle3D, TurtleStamp3D

public interface Agent

Interface provides access to NetLogo agents. NetLogo agents include turtles, patches, links and the observer.


Method Summary
 String classDisplayName()
          Returns a displayable name of this type of agent (Turtle, Link, Patch, Observer)
 Object getVariable(int vn)
          Returns the value of the variable in the given position of the agent variable array
 long id()
          Returns the id number of this agent.
 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
 World world()
          Returns the world object associated with this agent
 

Method Detail

classDisplayName

String classDisplayName()
Returns a displayable name of this type of agent (Turtle, Link, Patch, Observer)


world

World world()
Returns the world object associated with this agent


id

long id()
Returns the id number of this agent. The who number in the case of a turtle, index into the array in the case of patches


shape

String shape()
Returns the name of the current shape, empty string in the case of patches.


size

double size()
Returns the size of this agent


setVariable

void setVariable(int vn,
                 Object value)
                 throws LogoException,
                        AgentException
Sets the variable in the position vn of the agent variable array to value

Parameters:
vn - the index into the agent variable array
value - the new value for the variable
Throws:
LogoException
AgentException - If value is the wrong type for the given variable or if you try to change variables that cannot be changed

getVariable

Object getVariable(int vn)
Returns the value of the variable in the given position of the agent variable array

Parameters:
vn - the index into the agent variable array