java.lang.Objectorg.nlogo.agent.World
public class World
Field Summary | |
---|---|
org.nlogo.util.MersenneTwisterFast |
auxRNG
|
boolean |
comeUpForAir
|
static double[] |
cosTable
|
ExtensionManager |
extensionManager
|
WeakHashMap |
lastRunTimes
|
BreedShapes |
linkBreedShapes
|
LinkManager |
linkManager
|
ShapeList |
linkShapeList
|
org.nlogo.util.MersenneTwisterFast |
mainRNG
|
int |
patchesWithLabels
|
static double[] |
sinTable
|
TieManager |
tieManager
|
BreedShapes |
turtleBreedShapes
|
ShapeList |
turtleShapeList
|
Constructor Summary | |
---|---|
World(Shape defaultShape,
Shape defaultLinkShape)
|
Method Summary | |
---|---|
AgentSet |
agentClassToAgentSet(Class agentClass)
|
double |
averagePathLength(AgentSet nodeSet,
AgentSet linkBreed)
Calculates the average shortest-path length between all (distinct) pairs of nodes in the given nodeSet, by traveling along links of the given linkBreed. |
boolean |
breedOwns(AgentSet breed,
String name)
|
int |
breedsOwnIndexOf(AgentSet breed,
String name)
|
String |
breedsOwnNameAt(AgentSet breed,
int index)
|
void |
changeTopology(boolean xWrapping,
boolean yWrapping)
|
String |
checkLinkShapeName(String name)
|
String |
checksum()
|
String |
checkTurtleShapeName(String name)
|
void |
clearAll()
|
void |
clearDrawing()
|
void |
clearGlobals()
|
void |
clearLinks()
|
void |
clearPatches()
|
void |
clearTurtles()
|
int |
compareLinkBreeds(AgentSet breed1,
AgentSet breed2)
|
void |
createPatches(int minPxcor,
int maxPxcor,
int minPycor,
int maxPycor)
|
void |
createPatches(WorldDimensions dim)
|
Turtle |
createTurtle(AgentSet breed)
|
Turtle |
createTurtle(AgentSet breed,
int c,
int h)
|
Evaluator |
defaultEvaluator()
|
void |
diffuse(double param,
int vn)
|
void |
diffuse4(double param,
int vn)
|
boolean |
displayOn()
|
void |
displayOn(boolean displayOn)
|
double |
distance(Agent agent1,
Agent agent2,
boolean wrap)
|
double |
distance(Agent agent,
double x2,
double y2,
boolean wrap)
|
double |
distance(double x1,
double y1,
double x2,
double y2,
boolean wrap)
|
double |
distanceToLink(RenderableLink link,
double x,
double y)
|
boolean |
equalDimensions(WorldDimensions d)
|
void |
exportWorld(PrintWriter writer,
boolean full)
|
Patch |
fastGetPatchAt(int xc,
int yc)
|
double |
followOffsetX()
|
double |
followOffsetY()
|
double |
generateSeed()
|
AgentSet |
getBreed(String breedName)
|
Map |
getBreeds()
|
String |
getBreedSingular(AgentSet breed)
|
WorldDimensions |
getDimensions()
|
Object |
getDrawing()
|
ExtensionManager |
getExtensionManager()
|
List |
getImplicitLinkVariables()
|
List |
getImplicitObserverVariables()
|
List |
getImplicitPatchVariables()
|
List |
getImplicitTurtleVariables()
|
Link |
getLink(Double end1,
Double end2,
AgentSet breed)
|
AgentSet |
getLinkBreed(String breedName)
|
Map |
getLinkBreeds()
|
String |
getLinkBreedSingular(AgentSet breed)
|
int |
getLinkVariablesArraySize(AgentSet breed)
|
Object |
getObserverVariableByName(String var)
|
Link |
getOrCreateDummyLink(Object end1,
Object end2,
AgentSet breed)
|
Link |
getOrCreateLink(Double end1,
Double end2,
AgentSet breed)
|
Link |
getOrCreateLink(Turtle end1,
Turtle end2,
AgentSet breed)
|
Turtle |
getOrCreateTurtle(long id)
|
Patch |
getPatch(int id)
|
Patch |
getPatchAt(double x,
double y)
|
Patch |
getPatchAtHeadingAndDistance(Agent a,
double heading,
double distance)
|
Patch |
getPatchAtHeadingAndDistance(double x,
double y,
double heading,
double distance)
|
Patch |
getPatchAtWrap(double x,
double y)
|
double[][] |
getPatchScratch()
|
double |
getTimer()
|
Turtle |
getTurtle(long id)
|
int |
getVariablesArraySize(Link link,
AgentSet breed)
|
int |
getVariablesArraySize(Observer observer)
|
int |
getVariablesArraySize(Patch patch)
|
int |
getVariablesArraySize(Turtle turtle,
AgentSet breed)
|
double |
gridRoot(double val)
|
double |
gridRoot(int val)
|
int |
growMax(int min,
int max,
int value,
int d)
|
int |
growMin(int min,
int max,
int value,
int d)
|
void |
importWorld(Importer.ErrorHandler errorHandler,
ImporterUser importerUser,
Importer.StringReader stringReader,
BufferedReader reader)
|
boolean |
inBounds(double x1,
double y1,
double x2,
double y2,
double x,
double y)
|
List |
inCone(Turtle startTurtle,
AgentSet sourceSet,
double radius,
double angle,
boolean wrap)
|
int |
indexOfVariable(Agent agent,
String name)
|
int |
indexOfVariable(Class agentClass,
String name)
|
HashSet |
inNetworkRadius(Turtle sourceNode,
AgentSet sourceSet,
double radius,
AgentSet linkBreed)
This method performs a BFS from the sourceNode, following the network imposed by the given linkBreed, going up to radius layers out, and only collecting nodes that are members of sourceSet. |
List |
inRadius(Agent agent,
AgentSet sourceSet,
double radius,
boolean wrap)
|
void |
invalidateTurtleShape(Shape shapeToInvalidate)
|
boolean |
isBreed(AgentSet breed)
|
boolean |
isDimensionVariable(String variableName)
|
boolean |
isDoubleLinkVariable(int vn)
|
boolean |
isDoublePatchVariable(int vn)
|
boolean |
isDoubleTurtleVariable(int vn)
|
boolean |
isLinkBreed(AgentSet breed)
|
boolean |
isSpecialLinkVariable(int vn)
|
boolean |
isSpecialPatchVariable(int vn)
|
boolean |
isSpecialTurtleVariable(int vn)
|
double |
lineThickness(Agent agent)
|
boolean |
linkBreedOwns(AgentSet breed,
String name)
|
int |
linkBreedsOwnIndexOf(AgentSet breed,
String name)
|
String |
linkBreedsOwnNameAt(AgentSet breed,
int index)
|
AgentSet |
links()
|
int |
linksOwnIndexOf(String name)
|
String |
linksOwnNameAt(int index)
|
void |
markDrawingClean()
|
void |
markPatchColorsClean()
|
void |
markPatchColorsDirty()
|
int |
maxPxcor()
|
Double |
maxPxcorBoxed()
|
int |
maxPycor()
|
Double |
maxPycorBoxed()
|
int |
minPxcor()
|
Double |
minPxcorBoxed()
|
int |
minPycor()
|
Double |
minPycorBoxed()
|
int |
networkDistance(Turtle sourceNode,
Turtle destNode,
AgentSet linkBreed)
This method performs a BFS from the sourceNode, following the network imposed by the given linkBreed, to find the distance to destNode. |
LogoList |
networkShortestPathLinks(org.nlogo.util.MersenneTwisterFast random,
Turtle sourceNode,
Turtle destNode,
AgentSet linkBreed)
|
LogoList |
networkShortestPathNodes(org.nlogo.util.MersenneTwisterFast random,
Turtle sourceNode,
Turtle destNode,
AgentSet linkBreed)
This method performs a BFS from the sourceNode, following the network imposed by the given linkBreed, to find the shortest path to destNode. |
AgentSet |
noLinks()
|
AgentSet |
noPatches()
|
AgentSet |
noTurtles()
|
Observer |
observer()
|
int |
observerOwnsIndexOf(String name)
|
String |
observerOwnsNameAt(int index)
|
AgentSet |
observers()
|
int[] |
patchColors()
|
boolean |
patchColorsDirty()
|
AgentSet |
patches()
|
boolean |
patchesAllBlack()
|
int |
patchesOwnIndexOf(String name)
|
String |
patchesOwnNameAt(int index)
|
double |
patchSize()
|
boolean |
patchSize(double patchSize)
|
Program |
program()
|
void |
program(Program program)
|
void |
realloc()
|
static boolean |
recursivelyEqual(Object o1,
Object o2)
|
void |
rememberOldProgram()
|
void |
removeLineThickness(Agent agent)
|
void |
resetTicks()
|
void |
resetTimer()
|
int |
roundX(double x)
|
int |
roundY(double y)
|
boolean |
sendPixels()
|
void |
setDefaultEvaluator(Evaluator eval)
|
WorldDimensions |
setDimensionVariable(String variableName,
int value,
WorldDimensions d)
|
void |
setExtensionManager(ExtensionManager mgr)
|
void |
setLineThickness(Agent agent,
double size)
|
void |
setObserverVariableByName(String var,
Object value)
|
void |
stamp(Agent agent,
boolean erase)
|
void |
tick()
|
void |
tick(double amount)
|
double |
ticks()
|
void |
ticks(double ticks)
|
double |
towards(Agent fromAgent,
Agent toAgent,
boolean wrap)
|
double |
towards(Agent fromAgent,
double toX,
double toY,
boolean wrap)
|
double |
towards(double fromX,
double fromY,
double toX,
double toY,
boolean wrap)
|
double |
towardsPitch(Agent fromAgent,
Agent toAgent,
boolean wrap)
|
double |
towardsPitch(Agent fromAgent,
double toX,
double toY,
double toZ,
boolean wrap)
|
double |
towardsPitch(double fromX,
double fromY,
double fromZ,
double toX,
double toY,
double toZ,
boolean wrap)
|
void |
trailDrawer(TrailDrawerInterface trailDrawer)
|
AgentSet |
turtles()
|
int |
turtlesOwnIndexOf(String name)
|
String |
turtlesOwnNameAt(int index)
|
boolean |
validPatchCoordinates(int xc,
int yc)
|
int |
worldHeight()
|
Double |
worldHeightBoxed()
|
int |
worldWidth()
|
Double |
worldWidthBoxed()
|
double |
wrap(double pos,
double min,
double max)
|
double |
wrappedObserverX(double x)
|
double |
wrappedObserverY(double y)
|
boolean |
wrappingAllowedInX()
|
boolean |
wrappingAllowedInY()
|
double |
wrapX(double x)
|
double |
wrapY(double y)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final ShapeList turtleShapeList
public final ShapeList linkShapeList
public WeakHashMap lastRunTimes
public LinkManager linkManager
public ExtensionManager extensionManager
public TieManager tieManager
public volatile boolean comeUpForAir
public final org.nlogo.util.MersenneTwisterFast mainRNG
public final org.nlogo.util.MersenneTwisterFast auxRNG
public int patchesWithLabels
public final BreedShapes linkBreedShapes
public final BreedShapes turtleBreedShapes
public static final double[] sinTable
public static final double[] cosTable
Constructor Detail |
---|
public World(Shape defaultShape, Shape defaultLinkShape)
Method Detail |
---|
public AgentSet noTurtles()
public AgentSet noPatches()
public AgentSet noLinks()
public void trailDrawer(TrailDrawerInterface trailDrawer)
public void changeTopology(boolean xWrapping, boolean yWrapping)
public double wrappedObserverX(double x)
public double wrappedObserverY(double y)
public double followOffsetX()
public double followOffsetY()
public boolean wrappingAllowedInX()
wrappingAllowedInX
in interface RenderableWorld
public boolean wrappingAllowedInY()
wrappingAllowedInY
in interface RenderableWorld
public void exportWorld(PrintWriter writer, boolean full)
public void importWorld(Importer.ErrorHandler errorHandler, ImporterUser importerUser, Importer.StringReader stringReader, BufferedReader reader) throws IOException
IOException
public double generateSeed()
public void setLineThickness(Agent agent, double size)
public double lineThickness(Agent agent)
public void removeLineThickness(Agent agent)
public static boolean recursivelyEqual(Object o1, Object o2)
public Double worldWidthBoxed()
public Double worldHeightBoxed()
public Double minPxcorBoxed()
public Double minPycorBoxed()
public Double maxPxcorBoxed()
public Double maxPycorBoxed()
public double ticks()
public void ticks(double ticks)
public void tick()
public void tick(double amount)
public void resetTicks()
public int worldWidth()
worldWidth
in interface RenderableWorld
public int worldHeight()
worldHeight
in interface RenderableWorld
public int minPxcor()
minPxcor
in interface RenderableWorld
public int minPycor()
minPycor
in interface RenderableWorld
public int maxPxcor()
maxPxcor
in interface RenderableWorld
public int maxPycor()
maxPycor
in interface RenderableWorld
public double wrapX(double x) throws AgentException
AgentException
public double wrapY(double y) throws AgentException
AgentException
public double wrap(double pos, double min, double max)
wrap
in interface RenderableWorld
public void diffuse(double param, int vn) throws AgentException, PatchException
AgentException
PatchException
public void diffuse4(double param, int vn) throws AgentException, PatchException
AgentException
PatchException
public int roundX(double x) throws AgentException
AgentException
public int roundY(double y) throws AgentException
AgentException
public double distanceToLink(RenderableLink link, double x, double y)
public boolean inBounds(double x1, double y1, double x2, double y2, double x, double y)
public double distance(Agent agent, double x2, double y2, boolean wrap)
public double distance(Agent agent1, Agent agent2, boolean wrap)
public double gridRoot(double val)
public double gridRoot(int val)
public double distance(double x1, double y1, double x2, double y2, boolean wrap)
public Patch getPatchAtHeadingAndDistance(Agent a, double heading, double distance) throws AgentException
AgentException
public Patch getPatchAtHeadingAndDistance(double x, double y, double heading, double distance) throws AgentException
AgentException
public double towards(Agent fromAgent, Agent toAgent, boolean wrap) throws AgentException
AgentException
public double towards(Agent fromAgent, double toX, double toY, boolean wrap) throws AgentException
AgentException
public double towards(double fromX, double fromY, double toX, double toY, boolean wrap) throws AgentException
AgentException
public double towardsPitch(Agent fromAgent, Agent toAgent, boolean wrap) throws AgentException
AgentException
public double towardsPitch(Agent fromAgent, double toX, double toY, double toZ, boolean wrap) throws AgentException
AgentException
public double towardsPitch(double fromX, double fromY, double fromZ, double toX, double toY, double toZ, boolean wrap) throws AgentException
AgentException
public List inCone(Turtle startTurtle, AgentSet sourceSet, double radius, double angle, boolean wrap) throws AgentException
AgentException
public Turtle createTurtle(AgentSet breed)
public Turtle createTurtle(AgentSet breed, int c, int h)
public List inRadius(Agent agent, AgentSet sourceSet, double radius, boolean wrap)
public AgentSet observers()
public Observer observer()
public AgentSet patches()
public AgentSet turtles()
public AgentSet links()
public AgentSet agentClassToAgentSet(Class agentClass)
public boolean isDoublePatchVariable(int vn)
public boolean isDoubleTurtleVariable(int vn)
public boolean isDoubleLinkVariable(int vn)
public boolean isSpecialTurtleVariable(int vn)
public boolean isSpecialPatchVariable(int vn)
public boolean isSpecialLinkVariable(int vn)
public List getImplicitObserverVariables()
public List getImplicitTurtleVariables()
public List getImplicitPatchVariables()
public List getImplicitLinkVariables()
public WorldDimensions getDimensions()
public boolean isDimensionVariable(String variableName)
public WorldDimensions setDimensionVariable(String variableName, int value, WorldDimensions d) throws WorldDimensionException
WorldDimensionException
public int growMin(int min, int max, int value, int d) throws WorldDimensionException
WorldDimensionException
public int growMax(int min, int max, int value, int d) throws WorldDimensionException
WorldDimensionException
public boolean equalDimensions(WorldDimensions d)
public Patch getPatch(int id)
public Patch getPatchAt(double x, double y) throws AgentException
AgentException
public Patch getPatchAtWrap(double x, double y)
public boolean validPatchCoordinates(int xc, int yc)
public Patch fastGetPatchAt(int xc, int yc)
public Turtle getTurtle(long id)
public Link getLink(Double end1, Double end2, AgentSet breed)
public HashSet inNetworkRadius(Turtle sourceNode, AgentSet sourceSet, double radius, AgentSet linkBreed)
public int networkDistance(Turtle sourceNode, Turtle destNode, AgentSet linkBreed)
public LogoList networkShortestPathNodes(org.nlogo.util.MersenneTwisterFast random, Turtle sourceNode, Turtle destNode, AgentSet linkBreed)
public LogoList networkShortestPathLinks(org.nlogo.util.MersenneTwisterFast random, Turtle sourceNode, Turtle destNode, AgentSet linkBreed)
public double averagePathLength(AgentSet nodeSet, AgentSet linkBreed)
public Turtle getOrCreateTurtle(long id)
public Link getOrCreateLink(Double end1, Double end2, AgentSet breed)
public Link getOrCreateLink(Turtle end1, Turtle end2, AgentSet breed)
public Link getOrCreateDummyLink(Object end1, Object end2, AgentSet breed)
public boolean patchColorsDirty()
public void markPatchColorsDirty()
public void markPatchColorsClean()
public boolean patchesAllBlack()
public int[] patchColors()
public void createPatches(WorldDimensions dim)
public void createPatches(int minPxcor, int maxPxcor, int minPycor, int maxPycor)
public void clearAll()
public void clearDrawing()
public void stamp(Agent agent, boolean erase)
public double patchSize()
patchSize
in interface RenderableWorld
public boolean patchSize(double patchSize)
public Object getDrawing()
public boolean sendPixels()
public void markDrawingClean()
public void clearPatches()
public void clearTurtles()
public void clearLinks()
public void clearGlobals()
public void realloc()
public double[][] getPatchScratch()
public int indexOfVariable(Class agentClass, String name)
public int indexOfVariable(Agent agent, String name)
public String turtlesOwnNameAt(int index)
public int turtlesOwnIndexOf(String name)
public int linksOwnIndexOf(String name)
public String linksOwnNameAt(int index)
public String breedsOwnNameAt(AgentSet breed, int index)
public int breedsOwnIndexOf(AgentSet breed, String name)
public String linkBreedsOwnNameAt(AgentSet breed, int index)
public int linkBreedsOwnIndexOf(AgentSet breed, String name)
public String patchesOwnNameAt(int index)
public int patchesOwnIndexOf(String name)
public String observerOwnsNameAt(int index)
public int observerOwnsIndexOf(String name)
public boolean isBreed(AgentSet breed)
public boolean isLinkBreed(AgentSet breed)
public AgentSet getBreed(String breedName)
public AgentSet getLinkBreed(String breedName)
public String getBreedSingular(AgentSet breed)
public String getLinkBreedSingular(AgentSet breed)
public int compareLinkBreeds(AgentSet breed1, AgentSet breed2)
public int getVariablesArraySize(Observer observer)
public int getVariablesArraySize(Patch patch)
public int getVariablesArraySize(Turtle turtle, AgentSet breed)
public int getVariablesArraySize(Link link, AgentSet breed)
public int getLinkVariablesArraySize(AgentSet breed)
public String checkTurtleShapeName(String name)
public String checkLinkShapeName(String name)
public void invalidateTurtleShape(Shape shapeToInvalidate)
public Map getBreeds()
public boolean breedOwns(AgentSet breed, String name)
public Map getLinkBreeds()
public boolean linkBreedOwns(AgentSet breed, String name)
public Program program()
public void program(Program program)
public void rememberOldProgram()
public boolean displayOn()
public void displayOn(boolean displayOn)
public void resetTimer()
public double getTimer()
public String checksum()
public Object getObserverVariableByName(String var)
public void setObserverVariableByName(String var, Object value) throws AgentException, LogoException
AgentException
LogoException
public void setDefaultEvaluator(Evaluator eval)
public Evaluator defaultEvaluator()
public void setExtensionManager(ExtensionManager mgr)
public ExtensionManager getExtensionManager()