org.nlogo.agent
Class World
java.lang.Object
org.nlogo.agent.World
- All Implemented Interfaces:
- World
- Direct Known Subclasses:
- World3D
public class World
- extends Object
- implements World
Constructor Summary |
World()
|
Method Summary |
AgentSet |
agentClassToAgentSet(Class<? extends Agent> agentClass)
|
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 |
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)
|
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<String,Object> |
getBreeds()
|
String |
getBreedSingular(AgentSet breed)
|
WorldDimensions |
getDimensions()
|
Object |
getDrawing()
|
Link |
getLink(Object end1,
Object end2,
AgentSet breed)
|
AgentSet |
getLinkBreed(String breedName)
|
Map<String,Object> |
getLinkBreeds()
|
String |
getLinkBreedSingular(AgentSet breed)
|
Shape |
getLinkShape(String name)
|
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 |
getPatchAtWrap(double x,
double y)
|
double[][] |
getPatchScratch()
|
Turtle |
getTurtle(long id)
|
int |
getVariablesArraySize(Link link,
AgentSet breed)
|
int |
getVariablesArraySize(Observer observer)
|
int |
getVariablesArraySize(Patch patch)
|
int |
getVariablesArraySize(Turtle turtle,
AgentSet breed)
|
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)
|
int |
indexOfVariable(Agent agent,
String name)
|
int |
indexOfVariable(Class<? extends Agent> agentClass,
String name)
|
void |
invalidateTurtleShape(Shape shapeToInvalidate)
|
boolean |
isBreed(AgentSet breed)
|
boolean |
isDimensionVariable(String variableName)
|
boolean |
isLinkBreed(AgentSet breed)
|
double |
lineThickness(Agent agent)
|
boolean |
linkBreedOwns(AgentSet breed,
String name)
|
int |
linkBreedsOwnIndexOf(AgentSet breed,
String name)
|
String |
linkBreedsOwnNameAt(AgentSet breed,
int index)
|
AgentSet |
links()
|
ShapeList |
linkShapeList()
|
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()
|
Program |
newProgram()
|
Program |
newProgram(List<String> interfaceGlobals)
|
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)
|
int |
patchesWithLabels()
|
double |
patchSize()
|
boolean |
patchSize(double patchSize)
|
Program |
program()
|
void |
program(Program program)
|
Protractor |
protractor()
|
void |
realloc()
|
void |
rememberOldProgram()
|
void |
removeLineThickness(Agent agent)
|
int |
roundX(double x)
|
int |
roundY(double y)
|
boolean |
sendPixels()
|
void |
setDefaultEvaluator(Evaluator eval)
|
WorldDimensions |
setDimensionVariable(String variableName,
int value,
WorldDimensions d)
|
void |
setLineThickness(Agent agent,
double size)
|
void |
setObserverVariableByName(String var,
Object value)
|
void |
stamp(Agent agent,
boolean erase)
|
double |
ticks()
|
void |
trailDrawer(TrailDrawerInterface trailDrawer)
|
AgentSet |
turtles()
|
ShapeList |
turtleShapeList()
|
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)
|
ZERO
public static final Double ZERO
ONE
public static final Double ONE
tickCounter
public final TickCounter tickCounter
timer
public final Timer timer
protractor
public Protractor protractor
linkManager
public LinkManager linkManager
tieManager
public TieManager tieManager
inRadiusOrCone
public InRadiusOrCone inRadiusOrCone
comeUpForAir
public volatile boolean comeUpForAir
mainRNG
public final org.nlogo.util.MersenneTwisterFast mainRNG
auxRNG
public final org.nlogo.util.MersenneTwisterFast auxRNG
linkBreedShapes
public final BreedShapes linkBreedShapes
turtleBreedShapes
public final BreedShapes turtleBreedShapes
World
public World()
ticks
public double ticks()
- Specified by:
ticks
in interface World
turtleShapeList
public ShapeList turtleShapeList()
- Specified by:
turtleShapeList
in interface World
linkShapeList
public ShapeList linkShapeList()
- Specified by:
linkShapeList
in interface World
protractor
public Protractor protractor()
- Specified by:
protractor
in interface World
noTurtles
public AgentSet noTurtles()
noPatches
public AgentSet noPatches()
noLinks
public AgentSet noLinks()
trailDrawer
public void trailDrawer(TrailDrawerInterface trailDrawer)
changeTopology
public void changeTopology(boolean xWrapping,
boolean yWrapping)
wrappedObserverX
public double wrappedObserverX(double x)
- Specified by:
wrappedObserverX
in interface World
wrappedObserverY
public double wrappedObserverY(double y)
- Specified by:
wrappedObserverY
in interface World
followOffsetX
public double followOffsetX()
- Specified by:
followOffsetX
in interface World
followOffsetY
public double followOffsetY()
- Specified by:
followOffsetY
in interface World
wrappingAllowedInX
public boolean wrappingAllowedInX()
- Specified by:
wrappingAllowedInX
in interface World
wrappingAllowedInY
public boolean wrappingAllowedInY()
- Specified by:
wrappingAllowedInY
in interface World
exportWorld
public void exportWorld(PrintWriter writer,
boolean full)
importWorld
public void importWorld(Importer.ErrorHandler errorHandler,
ImporterUser importerUser,
Importer.StringReader stringReader,
BufferedReader reader)
throws IOException
- Throws:
IOException
generateSeed
public double generateSeed()
setLineThickness
public void setLineThickness(Agent agent,
double size)
lineThickness
public double lineThickness(Agent agent)
removeLineThickness
public void removeLineThickness(Agent agent)
worldWidthBoxed
public Double worldWidthBoxed()
worldHeightBoxed
public Double worldHeightBoxed()
minPxcorBoxed
public Double minPxcorBoxed()
minPycorBoxed
public Double minPycorBoxed()
maxPxcorBoxed
public Double maxPxcorBoxed()
maxPycorBoxed
public Double maxPycorBoxed()
worldWidth
public int worldWidth()
- Specified by:
worldWidth
in interface World
worldHeight
public int worldHeight()
- Specified by:
worldHeight
in interface World
minPxcor
public int minPxcor()
- Specified by:
minPxcor
in interface World
minPycor
public int minPycor()
- Specified by:
minPycor
in interface World
maxPxcor
public int maxPxcor()
- Specified by:
maxPxcor
in interface World
maxPycor
public int maxPycor()
- Specified by:
maxPycor
in interface World
wrapX
public double wrapX(double x)
throws AgentException
- Specified by:
wrapX
in interface World
- Throws:
AgentException
wrapY
public double wrapY(double y)
throws AgentException
- Specified by:
wrapY
in interface World
- Throws:
AgentException
wrap
public double wrap(double pos,
double min,
double max)
- Specified by:
wrap
in interface World
diffuse
public void diffuse(double param,
int vn)
throws AgentException,
PatchException
- Throws:
AgentException
PatchException
diffuse4
public void diffuse4(double param,
int vn)
throws AgentException,
PatchException
- Throws:
AgentException
PatchException
roundX
public int roundX(double x)
throws AgentException
- Throws:
AgentException
roundY
public int roundY(double y)
throws AgentException
- Throws:
AgentException
createTurtle
public Turtle createTurtle(AgentSet breed)
createTurtle
public Turtle createTurtle(AgentSet breed,
int c,
int h)
observers
public AgentSet observers()
observer
public Observer observer()
- Specified by:
observer
in interface World
patches
public AgentSet patches()
- Specified by:
patches
in interface World
turtles
public AgentSet turtles()
- Specified by:
turtles
in interface World
links
public AgentSet links()
- Specified by:
links
in interface World
agentClassToAgentSet
public AgentSet agentClassToAgentSet(Class<? extends Agent> agentClass)
getDimensions
public WorldDimensions getDimensions()
isDimensionVariable
public boolean isDimensionVariable(String variableName)
setDimensionVariable
public WorldDimensions setDimensionVariable(String variableName,
int value,
WorldDimensions d)
throws WorldDimensionException
- Throws:
WorldDimensionException
growMin
public int growMin(int min,
int max,
int value,
int d)
throws WorldDimensionException
- Throws:
WorldDimensionException
growMax
public int growMax(int min,
int max,
int value,
int d)
throws WorldDimensionException
- Throws:
WorldDimensionException
equalDimensions
public boolean equalDimensions(WorldDimensions d)
getPatch
public Patch getPatch(int id)
- Specified by:
getPatch
in interface World
getPatchAt
public Patch getPatchAt(double x,
double y)
throws AgentException
- Specified by:
getPatchAt
in interface World
- Throws:
AgentException
getPatchAtWrap
public Patch getPatchAtWrap(double x,
double y)
validPatchCoordinates
public boolean validPatchCoordinates(int xc,
int yc)
fastGetPatchAt
public Patch fastGetPatchAt(int xc,
int yc)
- Specified by:
fastGetPatchAt
in interface World
getTurtle
public Turtle getTurtle(long id)
getLink
public Link getLink(Object end1,
Object end2,
AgentSet breed)
getOrCreateTurtle
public Turtle getOrCreateTurtle(long id)
getOrCreateLink
public Link getOrCreateLink(Double end1,
Double end2,
AgentSet breed)
getOrCreateLink
public Link getOrCreateLink(Turtle end1,
Turtle end2,
AgentSet breed)
getOrCreateDummyLink
public Link getOrCreateDummyLink(Object end1,
Object end2,
AgentSet breed)
patchColorsDirty
public boolean patchColorsDirty()
- Specified by:
patchColorsDirty
in interface World
markPatchColorsDirty
public void markPatchColorsDirty()
- Specified by:
markPatchColorsDirty
in interface World
markPatchColorsClean
public void markPatchColorsClean()
- Specified by:
markPatchColorsClean
in interface World
patchesAllBlack
public boolean patchesAllBlack()
- Specified by:
patchesAllBlack
in interface World
patchColors
public int[] patchColors()
- Specified by:
patchColors
in interface World
patchesWithLabels
public int patchesWithLabels()
- Specified by:
patchesWithLabels
in interface World
createPatches
public void createPatches(WorldDimensions dim)
createPatches
public void createPatches(int minPxcor,
int maxPxcor,
int minPycor,
int maxPycor)
clearAll
public void clearAll()
clearDrawing
public void clearDrawing()
stamp
public void stamp(Agent agent,
boolean erase)
patchSize
public double patchSize()
- Specified by:
patchSize
in interface World
patchSize
public boolean patchSize(double patchSize)
getDrawing
public Object getDrawing()
- Specified by:
getDrawing
in interface World
sendPixels
public boolean sendPixels()
- Specified by:
sendPixels
in interface World
markDrawingClean
public void markDrawingClean()
- Specified by:
markDrawingClean
in interface World
clearPatches
public void clearPatches()
clearTurtles
public void clearTurtles()
clearLinks
public void clearLinks()
clearGlobals
public void clearGlobals()
realloc
public void realloc()
getPatchScratch
public double[][] getPatchScratch()
indexOfVariable
public int indexOfVariable(Class<? extends Agent> agentClass,
String name)
indexOfVariable
public int indexOfVariable(Agent agent,
String name)
turtlesOwnNameAt
public String turtlesOwnNameAt(int index)
- Specified by:
turtlesOwnNameAt
in interface World
turtlesOwnIndexOf
public int turtlesOwnIndexOf(String name)
linksOwnIndexOf
public int linksOwnIndexOf(String name)
linksOwnNameAt
public String linksOwnNameAt(int index)
- Specified by:
linksOwnNameAt
in interface World
breedsOwnNameAt
public String breedsOwnNameAt(AgentSet breed,
int index)
- Specified by:
breedsOwnNameAt
in interface World
breedsOwnIndexOf
public int breedsOwnIndexOf(AgentSet breed,
String name)
linkBreedsOwnNameAt
public String linkBreedsOwnNameAt(AgentSet breed,
int index)
linkBreedsOwnIndexOf
public int linkBreedsOwnIndexOf(AgentSet breed,
String name)
patchesOwnNameAt
public String patchesOwnNameAt(int index)
patchesOwnIndexOf
public int patchesOwnIndexOf(String name)
observerOwnsNameAt
public String observerOwnsNameAt(int index)
observerOwnsIndexOf
public int observerOwnsIndexOf(String name)
isBreed
public boolean isBreed(AgentSet breed)
isLinkBreed
public boolean isLinkBreed(AgentSet breed)
getBreed
public AgentSet getBreed(String breedName)
getLinkBreed
public AgentSet getLinkBreed(String breedName)
getBreedSingular
public String getBreedSingular(AgentSet breed)
getLinkBreedSingular
public String getLinkBreedSingular(AgentSet breed)
compareLinkBreeds
public int compareLinkBreeds(AgentSet breed1,
AgentSet breed2)
getVariablesArraySize
public int getVariablesArraySize(Observer observer)
getVariablesArraySize
public int getVariablesArraySize(Patch patch)
getVariablesArraySize
public int getVariablesArraySize(Turtle turtle,
AgentSet breed)
- Specified by:
getVariablesArraySize
in interface World
getVariablesArraySize
public int getVariablesArraySize(Link link,
AgentSet breed)
- Specified by:
getVariablesArraySize
in interface World
getLinkVariablesArraySize
public int getLinkVariablesArraySize(AgentSet breed)
checkTurtleShapeName
public String checkTurtleShapeName(String name)
checkLinkShapeName
public String checkLinkShapeName(String name)
getLinkShape
public Shape getLinkShape(String name)
invalidateTurtleShape
public void invalidateTurtleShape(Shape shapeToInvalidate)
getBreeds
public Map<String,Object> getBreeds()
breedOwns
public boolean breedOwns(AgentSet breed,
String name)
getLinkBreeds
public Map<String,Object> getLinkBreeds()
linkBreedOwns
public boolean linkBreedOwns(AgentSet breed,
String name)
program
public Program program()
- Specified by:
program
in interface World
program
public void program(Program program)
newProgram
public Program newProgram()
newProgram
public Program newProgram(List<String> interfaceGlobals)
rememberOldProgram
public void rememberOldProgram()
displayOn
public boolean displayOn()
displayOn
public void displayOn(boolean displayOn)
getObserverVariableByName
public Object getObserverVariableByName(String var)
setObserverVariableByName
public void setObserverVariableByName(String var,
Object value)
throws AgentException,
LogoException
- Throws:
AgentException
LogoException
setDefaultEvaluator
public void setDefaultEvaluator(Evaluator eval)
defaultEvaluator
public Evaluator defaultEvaluator()