org.nlogo.api
Interface ClassManager

All Known Implementing Classes:
DefaultClassManager

public interface ClassManager

Interface specifies the main class of a NetLogo extension. All NetLogo extensions must include a class that implements this interface. Registers primitives with NetLogo and handles extension initialization and deconstruction.

For example:

 public class FibonacciExtension extends org.nlogo.api.DefaultClassManager
 {
     public void load(org.nlogo.api.PrimitiveManager primManager)
     {
         primManager.addPrimitive("first-n-fibs", new Fibonacci());
     }
 }
 


Method Summary
 void load(PrimitiveManager primManager)
          Loads the primitives in the extension.
 ExtensionObject readExtensionObject(ExtensionManager ws, String typeName, String stringrep)
          Return a new NetLogo ExtensionObject instance of the specified typeName, initialized by stringrep
 void runOnce(ExtensionManager em)
          Initializes the extension.
 void unload()
          Cleans up the extension.
 

Method Detail

runOnce

void runOnce(ExtensionManager em)
             throws ExtensionException
Initializes the extension. This is called once per NetLogo instance.

Throws:
ExtensionException

load

void load(PrimitiveManager primManager)
          throws ExtensionException
Loads the primitives in the extension. This is called each time a model that uses this extension is compiled.

Parameters:
primManager - The manager to transport the primitives to NetLogo
Throws:
ExtensionException

unload

void unload()
            throws ExtensionException
Cleans up the extension. This is called once before load is called.

Throws:
ExtensionException

readExtensionObject

ExtensionObject readExtensionObject(ExtensionManager ws,
                                    String typeName,
                                    String stringrep)
                                    throws ExtensionException
Return a new NetLogo ExtensionObject instance of the specified typeName, initialized by stringrep

Throws:
ExtensionException