Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
6.0 Extension and Controlling API Transition Guide
This is a guide for extension authors about how NetLogo internals have changed in NetLogo 6.0.
A number of classes have been renamed. The following is a list of top-level, public classes known to have changed. If your extension depended on inner classes or package-private classes, those will not be listed here.
core.Token(several fields renamed as well)
- More renames are likely to be listed in the future...
Java 8 Changes
- Many swing classes are now generic
JOGL and java3D
Java 3D is not supported in Java 8. We upgraded JOGL in the 5.3 series of releases and it is also updated here.
The primary difference is the package formerly known as
javax.media.opengl is now
More complex refactors will be needed in some cases involving scala due to the way scala handles static interface members.
Those cases can usually be resolved by changing the name of a class or interface from something like
GL to something like
Simplification of the
The following methods have been removed from
getJarPaths- no longer needed now that applets are dead.
profilingEnabled- check if the profiler extension is one of the
addToLibraryPath- avoid using if possible, but if needed use
new java.io.File(workspace.attachModelDir(path))if needed.
resolvePathAsURL- this was most useful for applets. If you need a file, see
resolvePathabove, otherwise use
ExtensionManager has been split into
This split is purely for interface segregation and extension code should continue to use
The representation of a NetLogo Program has changed dramatically.
The class representing a program is now located in the
Users are advised to consult the source code for a more thorough look at the changes, but the following are some highlights:
scala.collection.Seqis used for list representations instead of
Programs now contain a "dialect", a container for miscellaneous information about the environment (3D vs 2D, Desktop vs Web).
- The handling of breeds is quite different. Breeds are now represented as case classes (see
org.nlogo.core.Breed) which are stored in a map by name.
interfaceGlobalsare available as separate methods or combined in the
globalsmethod along with observer variables.
- Since the breeds are no longer
AgentSets containing the agents within a breed should be retrieved from the
Agent.class as way to identify agent type
The following table shows replacements:
|5.x java||hexy java||5.x scala||hexy scala|
Additionally, the following points are worth noticing:
AgentSets (and their builders) take an
kindmethod which returns the kind of that agent.
The following were formerly fields on
nvm.Procedure and are now methods:
fileName(available as an alias for
No longer available:
isReporter(also changed from an enum to a boolean)
innerSource(String)has been changed to
Renames for task to anonymous procedure
getReporterTaskhas been renamed to
getCommandTaskhas been renamed to
Syntax.ReporterTaskTypehas been renamed to
Syntax.CommandTaskTypehas been renamed to
org.nlogo.api.Reporter. In addition to renaming the superclass, if your primitive overrides
getAgentClassString set that in the
Syntax returned by
getSyntax. If you use
core.Syntax in scala, provide the appropriate named parameter and if you use
core.SyntaxJ in java, call any of the methods which take
agentClassString as a parameter.
world is no longer a field / method on
When constructing an
AgentSet, a world is no longer needed.
world method has been removed from
world method has been added to
ExtensionContext for easy access to the
worldmethod has been added to
ExtensionContextfor easy access to the
logCustomGlobalsmethods have been removed from
ExtensionContext. These can be replaced by calls to the appropriate methods on the workspace.
core.SyntaxJ is recommended for Java users, but it returns the same
core.Syntax objects produced by
If your code depends on the perspective and/or location of the observer, you should review the changes made to
The primary change is the extraction of orientation into a
This has been done to allow headless code to share the API for observer with NetLogo GUI without tracking irrelevant observer location information.
api.World has had an interface -
api.WorldRenderable extracted from it which has various methods on world dealing with rendering updates.
If your use of world depends on any of the methods in
api.WorldRenderable, you should modify your extension to check that the world you are using implements
WorldRenderable before performing those operations on it.
- Extension code which formerly made use of
org.nlogo.util.Femtoshould switch to
org.nlogo.util.Femtois likely to be removed in a future release.
api.Context now has
workspace methods which make it possible to access the current world and workspace without needing to cast the
Context to an
ExtensionContext. It is recommended that extensions which do cast to an
ExtensionContext rely on
Context.workspace and the methods on
api.Workspace if possible.
api.Workspace was introduced in 6.0 and makes available a wealth of functionality which formerly was only available on
nvm.Workspace. Since it's part of the
api.Workspace should remain binary-compatible for the duration of the 6.0 extensions API.
Changes to LogoList
LogoList was moved from
core.LogoList does not implement it.
It is possible to turn a
LogoList into an
AbstractSequentialList by using
toJava (see table below).
LogoList now implements
scala.collection.IndexedSeq[AnyRef], giving it access to a number of powerful features accessible from Scala extensions.
It also had a substantial number of method renames, see the table below:
|5.x name||hexy name||type|
Addendum: non-API changes from 6.0.1 to 6.0.2
Moving from 6.0.1 to 6.0.2 brought some fairly large changes to non-API classes.
Note that while a great deal of code (especially Scala code) using classes which have changed (per the below listing) will remain source-compatible, it is very likely to require recompilation before working 6.0.2 because of binary incompatibility. This will be true for most code which called methods on
org.nlogo.agent.Turtle. Extensions which used only the API classes (
org.nlogo.api.World) are unlikely to need recompilation for 6.0.2.
Following is a more complete listing of changes:
org.nlogo.agent.LogoHashObjecthas been removed. Use
org.nlogo.agent.Topology.getPatchAthas been removed. Use
org.nlogo.agent.Agent(and its subclasses) no longer implement
org.nlogo.agent.World.addWatcher(and related methods) instead.
org.nlogo.agent.Agent(and its subclasses) no longer have the methods
org.nlogo.agent.Agentno longer defines
org.nlogo.agent.Worldis no longer a concrete class and has been split into a hierarchy of classes and traits. Most of these are implementation details, but the general structure is as follows:
- Most uses of
org.nlogo.agent.Worldin 6.0.1 can be replaced by uses of
org.nlogo.agent.World2Din 6.0.1 (except in those cases where NetLogo 3D is concerned, which will require the use of
org.nlogo.agent.Worldis now a Scala abstract class (Java authors may see it as an interface instead) which defines many of the same methods defined on
Worldin 6.0.1, but missing those methods which assumed a 2D world.
org.nlogo.agent.WorldKernelare base classes of
org.nlogo.agent.World. Extension authors (and controlling API authors) should avoid using them as they are very likely to change in future releases
- Most uses of
org.nlogo.agent.Turtlewas a concrete class in 6.0.1, but in 6.0.2 has been split into several classes (like
org.nlogo.agent.Turtlecontains shared methods between 2D and 3D
- When instantiating a turtle, instantiate
- 2D/3D-specific turtle methods should not be accessed before checking whether the turtle is actually a
org.nlogo.agent.Observer.perspective(Perspective)was renamed to
- The constraint methods on observer have been renamed as follows:
org.nlogo.agent.Agent.variablesis now a method instead of a field
org.nlogo.agent.Agent.idis now a method instead of a field
org.nlogo.agent.Agent.getVariableCountis no longer a method. Use
- The constraint methods
variableConstrainthave been removed from
org.nlogo.agent.Agent. They are still available on
org.nlogo.agent.Patch.pcolorDouble()method has been removed. Use
org.nlogo.agent.Patch.pcolor()instead and check the result, which can be either a
org.nlogo.agent.World.ONEhave been removed. Use
org.nlogo.agent.Worldhas had the following fields converted to methods:
- The following methods no longer exist on
org.nlogo.agent.World. Although some of them are methods on
World2D, we recommend against using them if at all possible:
org.nlogo.nvm.AnonymousCommandboth are now initialized with an additional 5th parameter which contains the source code used to create them. Extension authors who instantiate these classes should provide a string indicating something about the contents of the anonymous procedure (and preferably the name of the extension that created it).
org.nlogo.core.BoxedValue.multilineno longer exists.
multilineis still defined on
org.nlogo.core.StringInput. We try to avoid breaking changes to the
apimodules between releases. We made a change here because we believe no extensions will be affected.
- There are various changes to core primitive classes in
org.nlogo.swing.BrowserLauncher.openURLis now deprecated. We advise that extension authors use the
openURImethods (also defined on
- Various changes to classes in
org.nlogo.workspacewhich should not affect most extensions.
- The Pegdown library is no longer included with NetLogo. NetLogo now uses the flexmark-java library instead for markdown processing. If your extension relied on having the Pegdown library on the classpath, upgrade it to use flexmark.
org.nlogo.api.EnumeratedValueSetare now deprecated. Use
Addendum: Proposed API and non-API changes after 6.0.2
AbstractWorkspaceScalainto a unified
org.nlogo.workspace.ExtensionManagerno longer has a method to access the workspace (this method was formerly
workspace). Proposed replacement is to use the workspace provided by the
Contextpassed into each primitive at execution.
org.nlogo.api.HubNetWorkspaceInterfaceno longer implements
CompilerServices, has a field
compilerServiceswhich provides those services.
org.nlogo.api.VersionHistoryno longer has the methods
org.nlogo.app.Appno longer has the following methods:
makeWidgeton the interfacePanel instead)
commandLine* methods. Interrogate
- The following methods are deprecated (need to add suggestions for replacement):
org.nlogo.api.WorldDimensions3Dis deprecated. Use
org.nlogo.util.Picohas been moved to
org.nlogo.api.Pico. Note that we do not recommend extension authors use this class (and have marked it
private[nlogo]to that end).
api.PreviewCommandsno longer extend
ModelSections.ModelSaveable(and thus no longer have an
updateModel(Model): Modelmethod. We do not expect this to affect extension authors.