java.lang.Objectorg.nlogo.workspace.AbstractWorkspace
public abstract class AbstractWorkspace
Nested Class Summary | |
---|---|
static interface |
AbstractWorkspace.HubNetManagerFactory
|
Nested classes/interfaces inherited from interface org.nlogo.nvm.Workspace |
---|
Workspace.BehaviorSpaceFormat, Workspace.OutputDestination, Workspace.UpdateMode |
Field Summary | |
---|---|
WeakHashMap<String,Procedure> |
codeBits
|
static String |
DEFAULT_PREVIEW_COMMANDS
previewCommands used by make-preview and model test |
JobManagerInterface |
jobManager
|
String |
previewCommands
|
World |
world
|
Method Summary | |
---|---|
void |
addJobFromJobThread(Job job)
|
String |
attachModelDir(String filePath)
attaches the current model directory to a relative path, if necessary. |
String |
autoConvert(String source,
boolean subprogram,
boolean reporter,
String modelVersion)
|
org.nlogo.util.MersenneTwisterFast |
auxRNG()
|
int |
behaviorSpaceRunNumber()
|
void |
behaviorSpaceRunNumber(int n)
|
void |
checkCommandSyntax(String source)
|
void |
checkReporterSyntax(String source)
|
void |
clearAll()
|
abstract void |
clearDrawing()
|
void |
clearLastLogoException()
|
Procedure |
compileCommands(String source)
|
Procedure |
compileCommands(String source,
Class<? extends Agent> agentClass)
|
Procedure |
compileForRun(String source,
Context context,
boolean reporter)
|
abstract CompilerInterface |
compiler()
|
Procedure |
compileReporter(String source)
|
boolean |
computerHubNetRunning()
|
void |
computerHubNetRunning(boolean computerHubNetRunning)
|
void |
convertToNormal()
instantly converts the current model to ModelType.NORMAL. |
void |
currentPlot(String plot)
|
void |
dispose()
Shuts down the background thread associated with this workspace, allowing resources to be freed. |
void |
evaluateCommands(String source)
|
void |
evaluateCommands(String source,
Agent agent,
boolean waitForCompletion)
|
void |
evaluateCommands(String source,
Class<? extends Agent> agentClass,
boolean waitForCompletion)
|
Object |
evaluateReporter(String source)
|
Object |
evaluateReporter(String source,
Agent agent)
|
void |
exportAllPlots(String filename)
|
File |
exportBehaviors(String filename,
String experimentName,
boolean includeHeader)
|
abstract void |
exportDrawingToCSV(PrintWriter writer)
|
abstract void |
exportOutputAreaToCSV(PrintWriter writer)
|
void |
exportPlot(String plotName,
String filename)
|
void |
exportWorld(PrintWriter writer)
|
void |
exportWorld(String filename)
|
FileManager |
fileManager()
|
Map<String,List<Object>> |
findProcedurePositions(String source)
|
boolean |
forceSaveAs()
whether the user needs to enter a new filename to save this model. |
ExtensionManager |
getExtensionManager()
|
HubNetInterface |
getHubNetManager()
|
boolean |
getIsApplet()
|
String |
getModelDir()
returns the full path to the directory from which the current model was loaded. |
String |
getModelFileName()
returns the name of the file from which the current model was loaded. |
String |
getModelPath()
returns the full pathname of the currently loaded model, if any. |
ModelType |
getModelType()
|
PlotInterface |
getPlot(String plot)
|
Map<String,Procedure> |
getProcedures()
|
WorldPropertiesInterface |
getPropertiesInterface()
|
String |
getSource(String filename)
|
org.nlogo.api.Token |
getTokenAtPosition(String s,
int pos)
|
String |
guessExportName(String defaultName)
|
void |
halt()
|
HubNetInterface |
hubnetManager()
|
void |
importDrawing(String filename)
|
void |
importExtensionData(String name,
List<String[]> data,
ImportErrorHandler handler)
|
void |
importWorld(String filename)
|
void |
init()
|
static boolean |
isApp()
|
static void |
isApp(boolean isApp)
|
static boolean |
isApplet()
|
static void |
isApplet(boolean isApplet)
|
boolean |
isCompilerTestingMode()
Internal use only. |
boolean |
isConstant(String string)
|
boolean |
isExtensionName(String name)
|
abstract boolean |
isHeadless()
|
boolean |
isValidIdentifier(String s)
|
void |
joinForeverButtons(Agent agent)
|
LogoException |
lastLogoException()
|
WeakHashMap<Job,WeakHashMap<Agent,WeakHashMap<Command,MutableLong>>> |
lastRunTimes()
|
void |
loadWorld(String[] strings,
String version,
WorldLoaderInterface worldInterface)
|
abstract void |
magicOpen(String name)
|
org.nlogo.util.MersenneTwisterFast |
mainRNG()
|
Thunk |
makeThunk(String source,
Agent agent,
Object owner)
|
String |
modelNameForDisplay()
|
abstract void |
open(String path)
|
abstract void |
openString(String modelContents)
|
void |
outputObject(Object object,
Object owner,
boolean addNewline,
boolean readable,
Workspace.OutputDestination destination)
|
abstract void |
perhapsUpdateDisplay()
|
org.nlogo.plot.PlotManager |
plotManager()
|
Object |
readFromString(String string)
|
Object |
readNumberFromString(String source)
|
abstract void |
requestDisplayUpdate(boolean force)
|
boolean |
runCompiledCommands(Procedure procedure)
|
Object |
runCompiledReporter(Procedure procedure)
|
Object |
runCompiledReporter(Procedure procedure,
org.nlogo.util.MersenneTwisterFast rng)
|
void |
setModelPath(String modelPath)
|
void |
setOutputAreaContents(String text)
|
void |
setProcedures(Map<String,Procedure> procedures)
|
org.nlogo.api.Token[] |
tokenizeForColorization(String s)
|
Workspace.UpdateMode |
updateMode()
|
void |
updateMode(Workspace.UpdateMode updateMode)
|
boolean |
warningMessage(String message)
Displays a warning to the user, and determine whether to continue. |
World |
world()
|
abstract void |
writeGraphicsData(PrintWriter writer)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.nlogo.nvm.Workspace |
---|
aggregateManager, changeTopology, clearOutput, deleteLogFiles, exportDrawing, exportInterface, exportOutput, exportView, exportView, getAndCreateDrawing, inspectAgent, inspectAgent, openIndex, openNext, openPrevious, patchSize, startLogging, waitFor, waitForQueuedEvents, waitForResult, zipLogFiles |
Methods inherited from interface org.nlogo.api.WorldResizer |
---|
patchSize, resizeView, setDimensions, setDimensions |
Methods inherited from interface org.nlogo.nvm.JobManagerOwner |
---|
ownerFinished, periodicUpdate, runtimeError, updateDisplay |
Field Detail |
---|
public final World world
public final JobManagerInterface jobManager
public static final String DEFAULT_PREVIEW_COMMANDS
public String previewCommands
public WeakHashMap<String,Procedure> codeBits
Method Detail |
---|
public World world()
world
in interface Workspace
public FileManager fileManager()
fileManager
in interface Workspace
public org.nlogo.plot.PlotManager plotManager()
plotManager
in interface Workspace
public WeakHashMap<Job,WeakHashMap<Agent,WeakHashMap<Command,MutableLong>>> lastRunTimes()
lastRunTimes
in interface Workspace
public ExtensionManager getExtensionManager()
getExtensionManager
in interface Workspace
public boolean isExtensionName(String name)
isExtensionName
in interface ImporterUser
public void importExtensionData(String name, List<String[]> data, ImportErrorHandler handler) throws ExtensionException
importExtensionData
in interface ImporterUser
ExtensionException
public boolean isCompilerTestingMode()
public void dispose() throws InterruptedException
dispose
in interface Workspace
InterruptedException
public abstract boolean isHeadless()
isHeadless
in interface Workspace
public boolean warningMessage(String message)
public static boolean isApp()
public static void isApp(boolean isApp)
public static boolean isApplet()
public static void isApplet(boolean isApplet)
public boolean getIsApplet()
getIsApplet
in interface Workspace
public HubNetInterface getHubNetManager()
getHubNetManager
in interface Workspace
public HubNetInterface hubnetManager()
public boolean computerHubNetRunning()
public void computerHubNetRunning(boolean computerHubNetRunning)
computerHubNetRunning
in interface HubNetWorkspaceInterface
public WorldPropertiesInterface getPropertiesInterface()
getPropertiesInterface
in interface HubNetWorkspaceInterface
public void setModelPath(String modelPath)
setModelPath
in interface Workspace
public String attachModelDir(String filePath) throws MalformedURLException
attachModelDir
in interface Workspace
MalformedURLException
public void convertToNormal() throws IOException
convertToNormal
in interface Workspace
IOException
public String getModelPath()
getModelPath
in interface Workspace
public String getModelFileName()
getModelFileName
in interface Workspace
public String getModelDir()
getModelDir
in interface Workspace
public ModelType getModelType()
public boolean forceSaveAs()
public String modelNameForDisplay()
modelNameForDisplay
in interface HubNetWorkspaceInterface
public Map<String,Procedure> getProcedures()
getProcedures
in interface Workspace
public void setProcedures(Map<String,Procedure> procedures)
setProcedures
in interface Workspace
public void init()
public void clearAll()
clearAll
in interface Workspace
public void joinForeverButtons(Agent agent)
joinForeverButtons
in interface Workspace
public void addJobFromJobThread(Job job)
addJobFromJobThread
in interface Workspace
public abstract void magicOpen(String name)
magicOpen
in interface Workspace
public Procedure compileForRun(String source, Context context, boolean reporter) throws CompilerException
compileForRun
in interface Workspace
CompilerException
public Workspace.UpdateMode updateMode()
public void updateMode(Workspace.UpdateMode updateMode)
public abstract void open(String path) throws IOException, CompilerException, LogoException
open
in interface Workspace
IOException
CompilerException
LogoException
public abstract void openString(String modelContents) throws CompilerException, LogoException
openString
in interface Workspace
CompilerException
LogoException
public void halt()
public abstract void requestDisplayUpdate(boolean force)
requestDisplayUpdate
in interface Workspace
public abstract void perhapsUpdateDisplay()
perhapsUpdateDisplay
in interface Workspace
public void outputObject(Object object, Object owner, boolean addNewline, boolean readable, Workspace.OutputDestination destination) throws LogoException
outputObject
in interface Workspace
LogoException
public void setOutputAreaContents(String text)
setOutputAreaContents
in interface ImporterUser
public abstract void clearDrawing()
clearDrawing
in interface Workspace
public void exportPlot(String plotName, String filename) throws IOException
exportPlot
in interface Workspace
IOException
public void exportAllPlots(String filename) throws IOException
exportAllPlots
in interface Workspace
IOException
public void exportWorld(String filename) throws IOException
exportWorld
in interface Workspace
IOException
public void exportWorld(PrintWriter writer)
public abstract void exportDrawingToCSV(PrintWriter writer)
public abstract void exportOutputAreaToCSV(PrintWriter writer)
public abstract void writeGraphicsData(PrintWriter writer)
public void importWorld(String filename) throws IOException
importWorld
in interface Workspace
IOException
public void importDrawing(String filename) throws IOException
importDrawing
in interface Workspace
IOException
public void currentPlot(String plot)
currentPlot
in interface ImporterUser
public PlotInterface getPlot(String plot)
getPlot
in interface ImporterUser
public String guessExportName(String defaultName)
public File exportBehaviors(String filename, String experimentName, boolean includeHeader) throws IOException
IOException
public int behaviorSpaceRunNumber()
behaviorSpaceRunNumber
in interface Workspace
public void behaviorSpaceRunNumber(int n)
behaviorSpaceRunNumber
in interface Workspace
public Thunk makeThunk(String source, Agent agent, Object owner) throws CompilerException
makeThunk
in interface Evaluator
CompilerException
public void evaluateCommands(String source) throws CompilerException
evaluateCommands
in interface Workspace
CompilerException
public void evaluateCommands(String source, Agent agent, boolean waitForCompletion) throws CompilerException
evaluateCommands
in interface Workspace
CompilerException
public void evaluateCommands(String source, Class<? extends Agent> agentClass, boolean waitForCompletion) throws CompilerException
evaluateCommands
in interface Workspace
CompilerException
public Object evaluateReporter(String source) throws CompilerException
evaluateReporter
in interface Workspace
CompilerException
public Object evaluateReporter(String source, Agent agent) throws CompilerException
evaluateReporter
in interface Workspace
CompilerException
public Procedure compileCommands(String source) throws CompilerException
compileCommands
in interface Workspace
CompilerException
public Procedure compileCommands(String source, Class<? extends Agent> agentClass) throws CompilerException
compileCommands
in interface Workspace
CompilerException
public Procedure compileReporter(String source) throws CompilerException
compileReporter
in interface Workspace
CompilerException
public boolean runCompiledCommands(Procedure procedure)
runCompiledCommands
in interface Workspace
public Object runCompiledReporter(Procedure procedure)
runCompiledReporter
in interface Workspace
public Object runCompiledReporter(Procedure procedure, org.nlogo.util.MersenneTwisterFast rng)
runCompiledReporter
in interface Workspace
public boolean isConstant(String string)
isConstant
in interface Evaluator
public Object readFromString(String string) throws CompilerException
readFromString
in interface Evaluator
readFromString
in interface org.nlogo.api.CompilerServices
CompilerException
public String getSource(String filename) throws IOException
IOException
public String autoConvert(String source, boolean subprogram, boolean reporter, String modelVersion)
autoConvert
in interface org.nlogo.api.CompilerServices
public void loadWorld(String[] strings, String version, WorldLoaderInterface worldInterface)
public org.nlogo.util.MersenneTwisterFast auxRNG()
auxRNG
in interface RandomServices
public org.nlogo.util.MersenneTwisterFast mainRNG()
mainRNG
in interface RandomServices
public Object readNumberFromString(String source) throws CompilerException
readNumberFromString
in interface org.nlogo.api.CompilerServices
CompilerException
public void checkReporterSyntax(String source) throws CompilerException
checkReporterSyntax
in interface org.nlogo.api.CompilerServices
CompilerException
public void checkCommandSyntax(String source) throws CompilerException
checkCommandSyntax
in interface org.nlogo.api.CompilerServices
CompilerException
public boolean isValidIdentifier(String s)
isValidIdentifier
in interface org.nlogo.api.CompilerServices
public org.nlogo.api.Token[] tokenizeForColorization(String s)
tokenizeForColorization
in interface org.nlogo.api.CompilerServices
public org.nlogo.api.Token getTokenAtPosition(String s, int pos)
getTokenAtPosition
in interface org.nlogo.api.CompilerServices
public Map<String,List<Object>> findProcedurePositions(String source)
findProcedurePositions
in interface org.nlogo.api.CompilerServices
public abstract CompilerInterface compiler()
compiler
in interface Workspace
public LogoException lastLogoException()
lastLogoException
in interface Workspace
public void clearLastLogoException()
clearLastLogoException
in interface Workspace