org.nlogo.agent
Class Link

java.lang.Object
  extended by java.util.Observable
      extended by org.nlogo.agent.Agent
          extended by org.nlogo.agent.Link
All Implemented Interfaces:
Comparable, RenderableAgent, RenderableLink, Agent, Link
Direct Known Subclasses:
DummyLink, Link3D

public class Link
extends Agent
implements Link, RenderableLink


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()
           
 Object color()
           
 void color(LogoList rgb)
           
 void colorDouble(Double boxedColor)
           
 void colorDoubleUnchecked(Double boxedColor)
           
 int compareTo(Object o)
           
 void die()
           
 Turtle end1()
           
 Turtle end2()
           
 int getAgentBit()
           
 Class getAgentClass()
           
 AgentSet getBreed()
           
 int getBreedIndex()
           
 Object getBreedVariable(String name)
           
static List getImplicitVariables()
           
 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)
           
 double getPatchVariableDouble(int vn)
           
 Object getTurtleOrLinkVariable(String varName)
           
 Object getTurtleVariable(int vn)
           
 double getTurtleVariableDouble(int vn)
           
 Object getVariable(int vn)
           
 boolean hasLabel()
           
 double heading()
           
 Double id()
           
 boolean isDirectedLink()
           
static boolean isDoubleVariable(int vn)
           
static boolean isSpecialVariable(int vn)
           
 boolean isTied()
           
 Object label()
           
 void label(Object label)
           
 Object labelColor()
           
 void labelColor(double labelColor)
           
 void labelColor(LogoList rgb)
           
 String labelString()
           
 boolean lhidden()
           
 void lhidden(boolean hidden)
           
 double lineThickness()
           
 void lineThickness(Double value)
           
 double linkDestinationSize()
           
 double midpointX()
           
 double midpointY()
           
 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)
           
 String shape()
           
 void shape(String shape)
           
 double size()
           
 String toString()
           
 void untie()
           
 double x1()
           
 double x2()
           
 double y1()
           
 double y2()
           
 
Methods inherited from class org.nlogo.agent.Agent
getVariableCount, 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
 

Field Detail

VAR_END1

public static final int VAR_END1
See Also:
Constant Field Values

VAR_END2

public static final int VAR_END2
See Also:
Constant Field Values

VAR_COLOR

public static final int VAR_COLOR
See Also:
Constant Field Values

VAR_LABEL

public static final int VAR_LABEL
See Also:
Constant Field Values

VAR_BREED

public static final int VAR_BREED
See Also:
Constant Field Values

VAR_THICKNESS

public static final int VAR_THICKNESS
See Also:
Constant Field Values

VAR_SHAPE

public static final int VAR_SHAPE
See Also:
Constant Field Values

VAR_TIEMODE

public static final int VAR_TIEMODE
See Also:
Constant Field Values

LAST_PREDEFINED_VAR

public int LAST_PREDEFINED_VAR

NUMBER_PREDEFINED_VARS

public int NUMBER_PREDEFINED_VARS

DEFAULT_COLOR

public static final Double DEFAULT_COLOR

MODE_NONE

public static final String MODE_NONE
See Also:
Constant Field Values

MODE_FREE

public static final String MODE_FREE
See Also:
Constant Field Values

MODE_FIXED

public static final String MODE_FIXED
See Also:
Constant Field Values

BIT

public static final int BIT
See Also:
Constant Field Values
Constructor Detail

Link

public Link(World world,
            Turtle end1,
            Turtle end2,
            int arraySize)
Method Detail

end1

public Turtle end1()

end2

public Turtle end2()

id

public Double id()

agentKey

public Object agentKey()

getImplicitVariables

public static List getImplicitVariables()

die

public void die()

isDoubleVariable

public static boolean isDoubleVariable(int vn)

isSpecialVariable

public static boolean isSpecialVariable(int vn)

getVariable

public Object getVariable(int vn)
Specified by:
getVariable in class Agent

getTurtleOrLinkVariable

public Object getTurtleOrLinkVariable(String varName)
                               throws AgentException
Specified by:
getTurtleOrLinkVariable in class Agent
Throws:
AgentException

setVariable

public void setVariable(int vn,
                        Object value)
                 throws AgentException
Specified by:
setVariable in class Agent
Throws:
AgentException

getObserverVariable

public Object getObserverVariable(int vn)
Specified by:
getObserverVariable in class Agent

getLinkVariable

public Object getLinkVariable(int vn)
Specified by:
getLinkVariable in class Agent

getLinkVariableDouble

public double getLinkVariableDouble(int vn)
Specified by:
getLinkVariableDouble in class Agent

setObserverVariable

public void setObserverVariable(int vn,
                                Object value)
                         throws AgentException,
                                LogoException
Specified by:
setObserverVariable in class Agent
Throws:
AgentException
LogoException

setTurtleOrLinkVariable

public void setTurtleOrLinkVariable(String varName,
                                    Object value)
                             throws AgentException
Specified by:
setTurtleOrLinkVariable in class Agent
Throws:
AgentException

setLinkVariable

public void setLinkVariable(int vn,
                            double value)
                     throws AgentException
Specified by:
setLinkVariable in class Agent
Throws:
AgentException

setLinkVariable

public void setLinkVariable(int vn,
                            Object value)
                     throws AgentException
Specified by:
setLinkVariable in class Agent
Throws:
AgentException

getTurtleVariable

public Object getTurtleVariable(int vn)
                         throws AgentException
Specified by:
getTurtleVariable in class Agent
Throws:
AgentException

getTurtleVariableDouble

public double getTurtleVariableDouble(int vn)
                               throws AgentException
Specified by:
getTurtleVariableDouble in class Agent
Throws:
AgentException

getBreedVariable

public Object getBreedVariable(String name)
                        throws AgentException
Specified by:
getBreedVariable in class Agent
Throws:
AgentException

getLinkBreedVariable

public Object getLinkBreedVariable(String name)
                            throws AgentException
Specified by:
getLinkBreedVariable in class Agent
Throws:
AgentException

getPatchVariable

public Object getPatchVariable(int vn)
                        throws AgentException
Specified by:
getPatchVariable in class Agent
Throws:
AgentException

getPatchVariableDouble

public double getPatchVariableDouble(int vn)
                              throws AgentException
Specified by:
getPatchVariableDouble in class Agent
Throws:
AgentException

setTurtleVariable

public void setTurtleVariable(int vn,
                              Object value)
                       throws AgentException
Specified by:
setTurtleVariable in class Agent
Throws:
AgentException

setTurtleVariable

public void setTurtleVariable(int vn,
                              double value)
                       throws AgentException
Specified by:
setTurtleVariable in class Agent
Throws:
AgentException

setBreedVariable

public void setBreedVariable(String name,
                             Object value)
                      throws AgentException
Specified by:
setBreedVariable in class Agent
Throws:
AgentException

setBreedVariable

public void setBreedVariable(int vn,
                             double value)
                      throws AgentException
Throws:
AgentException

setLinkBreedVariable

public void setLinkBreedVariable(String name,
                                 Object value)
                          throws AgentException
Specified by:
setLinkBreedVariable in class Agent
Throws:
AgentException

setPatchVariable

public void setPatchVariable(int vn,
                             Object value)
                      throws AgentException
Specified by:
setPatchVariable in class Agent
Throws:
AgentException

setPatchVariable

public void setPatchVariable(int vn,
                             double value)
                      throws AgentException
Specified by:
setPatchVariable in class Agent
Throws:
AgentException

x1

public double x1()
Specified by:
x1 in interface RenderableLink

y1

public double y1()
Specified by:
y1 in interface RenderableLink

x2

public double x2()
Specified by:
x2 in interface RenderableLink

y2

public double y2()
Specified by:
y2 in interface RenderableLink

midpointX

public double midpointX()
Specified by:
midpointX in interface RenderableLink

midpointY

public double midpointY()
Specified by:
midpointY in interface RenderableLink

heading

public double heading()
Specified by:
heading in interface RenderableLink

lineThickness

public double lineThickness()
Specified by:
lineThickness in interface RenderableAgent

lineThickness

public void lineThickness(Double value)

isDirectedLink

public boolean isDirectedLink()
Specified by:
isDirectedLink in interface RenderableLink

linkDestinationSize

public double linkDestinationSize()
Specified by:
linkDestinationSize in interface RenderableLink

size

public double size()
Specified by:
size in interface RenderableAgent

cachedShape

public Shape cachedShape()

cachedShape

public void cachedShape(Shape newShape)

shape

public String shape()
Specified by:
shape in interface RenderableAgent

shape

public void shape(String shape)

mode

public String mode()

mode

public void mode(String mode)

isTied

public boolean isTied()

untie

public void untie()

color

public Object color()
Specified by:
color in interface RenderableAgent

colorDouble

public void colorDouble(Double boxedColor)

colorDoubleUnchecked

public void colorDoubleUnchecked(Double boxedColor)

color

public void color(LogoList rgb)
           throws AgentException
Throws:
AgentException

bothEnds

public AgentSet bothEnds()

getPatchAtOffsets

public Patch getPatchAtOffsets(double dx,
                               double dy)
                        throws AgentException
Specified by:
getPatchAtOffsets in class Agent
Throws:
AgentException

label

public Object label()

hasLabel

public boolean hasLabel()
Specified by:
hasLabel in interface RenderableAgent

labelString

public String labelString()
Specified by:
labelString in interface RenderableAgent

label

public void label(Object label)

lhidden

public boolean lhidden()

lhidden

public void lhidden(boolean hidden)

getBreed

public AgentSet getBreed()

labelColor

public Object labelColor()
Specified by:
labelColor in interface RenderableAgent

labelColor

public void labelColor(double labelColor)

labelColor

public void labelColor(LogoList rgb)
                throws AgentException
Throws:
AgentException

toString

public String toString()
Overrides:
toString in class Object

classDisplayName

public String classDisplayName()
Specified by:
classDisplayName in class Agent

getAgentClass

public Class getAgentClass()
Specified by:
getAgentClass in class Agent

getAgentBit

public int getAgentBit()
Specified by:
getAgentBit in class Agent

setBreed

public void setBreed(AgentSet breed)

getBreedIndex

public int getBreedIndex()

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class Agent