Class Madkit
java.lang.Object
madkit.kernel.Madkit
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoAction(KernelAction action, Object... parameters) Makes the kernel do the corresponding action.voidexit()Requests the kernel to exit.Returns the kernel configuration.voidlaunchAgent(Agent a) Launches the specified agent.static voidThe main method for the MaDKit platform.
-
Constructor Details
-
Madkit
Constructs a `Madkit` instance with the specified command-line arguments.- Parameters:
args- the command-line arguments
-
-
Method Details
-
launchAgent
-
doAction
Makes the kernel do the corresponding action. This is done by sending a message directly to the kernel agent. This should not be used intensively since it is better to control the execution flow of the application using the agents running in the kernel. Still it provides a way to launch and manage a kernel from any java application as a third party service.public void somewhereInYourCode() { ... Madkit m = new Madkit(args); ... m.doAction(KernelAction.LAUNCH_NETWORK); //start the network ... m.doAction(KernelAction.LAUNCH_AGENT, new Agent(), true); //launch a new agent with a GUI ... }- Parameters:
action- the action to requestparameters- the parameters of the request. To work properly, the actual class of the parameters should match the class of the parameters of the underlying targeted method. For instance, for launching an Agent, one must usem.doAction(KernelAction.LAUNCH_AGENT, new Agent(),Boolean.TRUE);That is, in this case, using "true" does not work since it is a String.
-
exit
public void exit()Requests the kernel to exit. This will terminate all agents and then the kernel itself. This returns only when the kernel has effectively terminated or after a timeout of 20 seconds. -
getConfig
-
main
The main method for the MaDKit platform.- Parameters:
args- the command-line arguments
-