java.lang.Objectjava.util.Observable
org.nlogo.agent.Agent
org.nlogo.agent.Link
public class Link
Field Summary | |
---|---|
static int |
BIT
|
static Double |
DEFAULT_COLOR
|
int |
LAST_PREDEFINED_VAR
|
static String |
MODE_FIXED
|
static String |
MODE_FREE
|
static String |
MODE_NONE
|
int |
NUMBER_PREDEFINED_VARS
|
static int |
VAR_BREED
|
static int |
VAR_COLOR
|
static int |
VAR_END1
|
static int |
VAR_END2
|
static int |
VAR_LABEL
|
static int |
VAR_SHAPE
|
static int |
VAR_THICKNESS
|
static int |
VAR_TIEMODE
|
Fields inherited from class org.nlogo.agent.Agent |
---|
id, variables |
Constructor Summary | |
---|---|
Link(World world,
Turtle end1,
Turtle end2,
int arraySize)
|
Method Summary | |
---|---|
Object |
agentKey()
|
AgentSet |
bothEnds()
|
Shape |
cachedShape()
|
void |
cachedShape(Shape newShape)
|
String |
classDisplayName()
Returns a displayable name of this type of agent (Turtle, Link, Patch, Observer) |
Object |
color()
Returns the value of the color variable |
void |
color(LogoList rgb)
|
void |
colorDouble(Double boxedColor)
|
void |
colorDoubleUnchecked(Double boxedColor)
|
int |
compareTo(Agent a)
|
void |
die()
|
Turtle |
end1()
Returns the first end point of this link. |
Turtle |
end2()
Returns the second end point of this link. |
int |
getAgentBit()
|
Class<Link> |
getAgentClass()
|
AgentSet |
getBreed()
Returns the breed AgentSet associated with this link, if the link is unbreeded returns the all links AgentSet |
int |
getBreedIndex()
Returns the index of the breed of this link |
Object |
getBreedVariable(String name)
|
Object |
getLinkBreedVariable(String name)
|
Object |
getLinkVariable(int vn)
|
double |
getLinkVariableDouble(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 |
boolean |
hasLabel()
Returns true if there is a value in the label variable |
double |
heading()
Returns the heading towards end2 from end1 |
boolean |
hidden()
Returns the value of the hidden? |
void |
hidden(boolean hidden)
|
boolean |
isDirectedLink()
Returns true if this link is directed |
boolean |
isTied()
|
Object |
label()
|
void |
label(Object label)
|
Object |
labelColor()
Returns the value of the label-color variable |
void |
labelColor(double labelColor)
|
void |
labelColor(LogoList rgb)
|
String |
labelString()
Returns the value of the label variable |
double |
lineThickness()
Returns the value of the thinkness variable |
void |
lineThickness(Double value)
|
double |
linkDestinationSize()
Returns the size of end2 |
double |
midpointX()
Returns the x-coordinate of the midpoint of this link taking wrapping in account. |
double |
midpointY()
Returns the y-coordinate of the midpoint of this link taking wrapping in account. |
String |
mode()
|
void |
mode(String mode)
|
void |
setBreed(AgentSet breed)
|
void |
setBreedVariable(int vn,
double value)
|
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. |
void |
shape(String shape)
|
double |
size()
Returns the size of this agent |
String |
toString()
|
void |
untie()
|
double |
x1()
Returns the x-coordinate of end1 |
double |
x2()
Returns the x-coordinate of end2 this coordinate is "unwrapped" so it may actually be outside the bounds of the world |
double |
y1()
Returns the y-coordinate of end1 |
double |
y2()
Returns the y-coordinate of end2 this coordinate is "unwrapped" so it may actually be outside the bounds of the world |
Methods inherited from class org.nlogo.agent.Agent |
---|
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_END1
public static final int VAR_END2
public static final int VAR_COLOR
public static final int VAR_LABEL
public static final int VAR_BREED
public static final int VAR_THICKNESS
public static final int VAR_SHAPE
public static final int VAR_TIEMODE
public int LAST_PREDEFINED_VAR
public int NUMBER_PREDEFINED_VARS
public static final Double DEFAULT_COLOR
public static final String MODE_NONE
public static final String MODE_FREE
public static final String MODE_FIXED
public static final int BIT
Constructor Detail |
---|
public Link(World world, Turtle end1, Turtle end2, int arraySize)
Method Detail |
---|
public Turtle end1()
Link
end1
in interface Link
public Turtle end2()
Link
end2
in interface Link
public Object agentKey()
public void die()
public Object getVariable(int vn)
Agent
getVariable
in interface Agent
getVariable
in class Agent
vn
- the index into the agent variable arraypublic Object getTurtleOrLinkVariable(String varName)
getTurtleOrLinkVariable
in class Agent
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 Object getObserverVariable(int vn)
getObserverVariable
in class Agent
public Object getLinkVariable(int vn)
getLinkVariable
in class Agent
public double getLinkVariableDouble(int vn)
public void setObserverVariable(int vn, Object value) throws AgentException, LogoException
setObserverVariable
in class Agent
AgentException
LogoException
public void setTurtleOrLinkVariable(String varName, Object value) throws AgentException
setTurtleOrLinkVariable
in class Agent
AgentException
public void setLinkVariable(int vn, double value)
setLinkVariable
in class Agent
public void setLinkVariable(int vn, Object value) throws AgentException
setLinkVariable
in class Agent
AgentException
public Object getTurtleVariable(int vn) throws AgentException
getTurtleVariable
in class Agent
AgentException
public Object getBreedVariable(String name) throws AgentException
getBreedVariable
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 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 setBreedVariable(int vn, double value) throws AgentException
AgentException
public void setLinkBreedVariable(String name, Object value) throws AgentException
setLinkBreedVariable
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 double x1()
Link
x1
in interface Link
public double y1()
Link
y1
in interface Link
public double x2()
Link
x2
in interface Link
public double y2()
Link
y2
in interface Link
public double midpointX()
Link
midpointX
in interface Link
public double midpointY()
Link
midpointY
in interface Link
public double heading()
Link
heading
in interface Link
public double lineThickness()
Link
thinkness
variable
lineThickness
in interface Link
public void lineThickness(Double value)
public boolean isDirectedLink()
Link
isDirectedLink
in interface Link
public double linkDestinationSize()
Link
linkDestinationSize
in interface Link
public double size()
Agent
size
in interface Agent
public Shape cachedShape()
public void cachedShape(Shape newShape)
public String shape()
Agent
shape
in interface Agent
public void shape(String shape)
public String mode()
public void mode(String mode)
public boolean isTied()
public void untie()
public Object color()
Link
color
variable
color
in interface Link
public void colorDouble(Double boxedColor)
public void colorDoubleUnchecked(Double boxedColor)
public void color(LogoList rgb) throws AgentException
AgentException
public AgentSet bothEnds()
public Patch getPatchAtOffsets(double dx, double dy) throws AgentException
getPatchAtOffsets
in class Agent
AgentException
public Object label()
public boolean hasLabel()
Link
label
variable
hasLabel
in interface Link
public String labelString()
Link
label
variable
labelString
in interface Link
public void label(Object label)
public boolean hidden()
Link
hidden?
variable
hidden
in interface Link
public void hidden(boolean hidden)
public AgentSet getBreed()
Link
getBreed
in interface Link
public Object labelColor()
Link
label-color
variable
labelColor
in interface Link
public void labelColor(double labelColor)
public void labelColor(LogoList rgb) throws AgentException
AgentException
public String toString()
toString
in class Object
public String classDisplayName()
Agent
classDisplayName
in interface Agent
classDisplayName
in class Agent
public Class<Link> getAgentClass()
getAgentClass
in class Agent
public int getAgentBit()
getAgentBit
in class Agent
public void setBreed(AgentSet breed)
public int getBreedIndex()
Link
getBreedIndex
in interface Link
public int compareTo(Agent a)
compareTo
in interface Comparable<Agent>
compareTo
in class Agent