org.nlogo.api
Interface Command

All Superinterfaces:
Primitive
All Known Implementing Classes:
DefaultCommand

public interface Command
extends Primitive

Interface for NetLogo extension commands. Commands are primitives that do not return a value. All new commands must implement this interface.


Method Summary
 boolean getSwitchesBoolean()
          Specifies whether NetLogo should "switch" to another turtle after running this command.
 Command newInstance(String name)
          Returns a new instance of this Command.
 void perform(Argument[] args, Context context)
          Executes this Command.
 
Methods inherited from interface org.nlogo.api.Primitive
getAgentClassString, getSyntax
 

Method Detail

getSwitchesBoolean

boolean getSwitchesBoolean()
Specifies whether NetLogo should "switch" to another turtle after running this command. Generally, this should be true if this Command affects the state of the world (changing a variable, changing graphics, etc.)

Returns:
true if a switch should occur, false otherwise.

newInstance

Command newInstance(String name)
Returns a new instance of this Command. Called by NetLogo every time this Command is encountered during compilation.

Parameters:
name - the name that was found in the code (without the JAR identifer)
Returns:
Command to be peformed during runtime

perform

void perform(Argument[] args,
             Context context)
             throws ExtensionException,
                    LogoException
Executes this Command. Called by NetLogo when this Command is called at run-time.

Parameters:
args - the Arguments that were passed to the command. (May be a Reporter or a constant.) To evaluate arguments, use the typesafe methods in the Argument interface.
context - the current Context allows access to NetLogo internal methods
Throws:
ExtensionException - (if an extension-related problem occurs)
LogoException - (if one of the evaluated arguments throws a LogoException)