madkit.kernel
Class Kernel

java.lang.Object
  extended by madkit.kernel.Kernel

public final class Kernel
extends java.lang.Object

This class is the heart of the MadKit micro-kernel. Most of these methods will only be useful to "system" agents developpers

Version:
4.4
Author:
Ol Gutknecht, Fabien Michel since MadKit 3.0 - org operations are now implemented in the Organization class - there are also changes in messaging routines - hooks are now called only when the considered operation is effectively done - new features have been added: - migration of agents (for the moment for security reason, this feature has been more or less disabled). - communities

Field Summary
static int ADD_MEMBER_ROLE
           
static boolean agressiveHeapMode
           
static java.lang.String BUGREPORT
           
static int CONNECTED_TO
           
static int CONNECTION
           
static int CREATE_GROUP
           
static boolean debug
           
static int DECONNECTION
           
static java.lang.String DEFAULT_COMMUNITY
           
static int defaultAgentsAllocation
           
static int DELETE_COMMUNITY
           
static int DISCONNECTED_FROM
           
static int DUMP_COMMUNITIES
           
static int DUMP_ORGANIZATION
           
static int GET_AGENTINFO
           
static int GET_AGENTS
           
static int GET_GROUPS
           
static int KILL_AGENT
           
static int LAUNCH_AGENT
           
static int LEAVE_GROUP
           
static int MIGRATION
           
static int NEW_COMMUNITY
           
static int REMOVE_MEMBER_ROLE
           
static int RESTORE_AGENT
           
static int SEND_BROADCAST_MESSAGE
           
static int SEND_MESSAGE
           
static java.lang.String VERSION
           
 
Constructor Summary
Kernel(java.lang.String theName)
           
Kernel(java.lang.String theName, boolean ipnumeric)
           
Kernel(java.lang.String theName, boolean ipnumeric, java.lang.String ipaddress)
           
 
Method Summary
static void debugString()
           
 void destroyGroup(java.lang.String communityName, java.lang.String groupName)
           
 void display(java.lang.String s)
          A generic display method adapting its output to the kernel environment (console, GUI, applet...)
 void displayln(java.lang.String s)
          A generic display method adapting its output to the kernel environment (console, GUI, applet...)
static KernelAddress getAddress()
           
 KernelAddress getAgencyNamed(java.lang.String name)
           
static int getAgentsNb()
           
 java.lang.String[] getCurrentGroupsOf(AgentAddress theAgent, java.lang.String communityName)
           
 java.lang.String[] getExistingGroups(java.lang.String communityName)
           
 java.lang.String[] getExistingRoles(java.lang.String communityName, java.lang.String groupName)
           
 java.util.Vector getMemberRoles(java.lang.String theGroup, AgentAddress theAgent)
          Deprecated. As of MadKit 3.0. replaced by getGroupRolesOf(AgentAddress, String, String)please use getGroupRolesOf instead
 java.lang.String getName()
           
 AgentAddress[] getRolePlayers(java.lang.String communityName, java.lang.String groupName, java.lang.String roleName)
           
 void killAgent(AbstractAgent theAgent)
          Kill a given agent (also manage groups update).
 void launchAgent(AbstractAgent agent, java.lang.String name, java.lang.Object creator, boolean startGUI)
           
 void launchAgent(AbstractAgent agent, java.lang.String name, java.lang.Object creator, boolean startGUI, java.awt.Point position, java.awt.Dimension dim)
          Launch an agent.
 void launchMirror(Mirror mirror, AgentAddress address, java.lang.String name, java.lang.Object creator, boolean startGUI)
           
 void registerGUI(GraphicShell g)
           
 void setOutputStream(java.io.Writer o)
          Reassigns the "standard" agent text output stream (used by println method).
 void stopKernel()
          Request a kernel stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

BUGREPORT

public static final java.lang.String BUGREPORT
See Also:
Constant Field Values

DEFAULT_COMMUNITY

public static final java.lang.String DEFAULT_COMMUNITY

SEND_MESSAGE

public static final int SEND_MESSAGE
See Also:
Constant Field Values

SEND_BROADCAST_MESSAGE

public static final int SEND_BROADCAST_MESSAGE
See Also:
Constant Field Values

KILL_AGENT

public static final int KILL_AGENT
See Also:
Constant Field Values

CREATE_GROUP

public static final int CREATE_GROUP
See Also:
Constant Field Values

LEAVE_GROUP

public static final int LEAVE_GROUP
See Also:
Constant Field Values

ADD_MEMBER_ROLE

public static final int ADD_MEMBER_ROLE
See Also:
Constant Field Values

REMOVE_MEMBER_ROLE

public static final int REMOVE_MEMBER_ROLE
See Also:
Constant Field Values

RESTORE_AGENT

public static final int RESTORE_AGENT
See Also:
Constant Field Values

LAUNCH_AGENT

public static final int LAUNCH_AGENT
See Also:
Constant Field Values

CONNECTED_TO

public static final int CONNECTED_TO
See Also:
Constant Field Values

DISCONNECTED_FROM

public static final int DISCONNECTED_FROM
See Also:
Constant Field Values

NEW_COMMUNITY

public static final int NEW_COMMUNITY
See Also:
Constant Field Values

DELETE_COMMUNITY

public static final int DELETE_COMMUNITY
See Also:
Constant Field Values

MIGRATION

public static final int MIGRATION
See Also:
Constant Field Values

GET_GROUPS

public static final int GET_GROUPS
See Also:
Constant Field Values

GET_AGENTS

public static final int GET_AGENTS
See Also:
Constant Field Values

DUMP_ORGANIZATION

public static final int DUMP_ORGANIZATION
See Also:
Constant Field Values

GET_AGENTINFO

public static final int GET_AGENTINFO
See Also:
Constant Field Values

CONNECTION

public static final int CONNECTION
See Also:
Constant Field Values

DECONNECTION

public static final int DECONNECTION
See Also:
Constant Field Values

DUMP_COMMUNITIES

public static final int DUMP_COMMUNITIES
See Also:
Constant Field Values

agressiveHeapMode

public static boolean agressiveHeapMode

defaultAgentsAllocation

public static int defaultAgentsAllocation
Constructor Detail

Kernel

public Kernel(java.lang.String theName,
              boolean ipnumeric)

Kernel

public Kernel(java.lang.String theName,
              boolean ipnumeric,
              java.lang.String ipaddress)

Kernel

public Kernel(java.lang.String theName)
Method Detail

getAgentsNb

public static int getAgentsNb()

getAddress

public static KernelAddress getAddress()

registerGUI

public void registerGUI(GraphicShell g)

getName

public java.lang.String getName()

getAgencyNamed

public KernelAddress getAgencyNamed(java.lang.String name)

launchMirror

public void launchMirror(Mirror mirror,
                         AgentAddress address,
                         java.lang.String name,
                         java.lang.Object creator,
                         boolean startGUI)

launchAgent

public final void launchAgent(AbstractAgent agent,
                              java.lang.String name,
                              java.lang.Object creator,
                              boolean startGUI)
                       throws madkit.kernel.LaunchAgentException
Throws:
madkit.kernel.LaunchAgentException

launchAgent

public final void launchAgent(AbstractAgent agent,
                              java.lang.String name,
                              java.lang.Object creator,
                              boolean startGUI,
                              java.awt.Point position,
                              java.awt.Dimension dim)
                       throws madkit.kernel.LaunchAgentException
Launch an agent.

Parameters:
agent - the agent
name - the name
creator - the creator
startGUI - the start gui
position - the position
dim - the dim
Throws:
LaunchAgentException

killAgent

public final void killAgent(AbstractAgent theAgent)
Kill a given agent (also manage groups update).

Parameters:
theAgent - the agent

getCurrentGroupsOf

public final java.lang.String[] getCurrentGroupsOf(AgentAddress theAgent,
                                                   java.lang.String communityName)

getExistingGroups

public final java.lang.String[] getExistingGroups(java.lang.String communityName)

getRolePlayers

public final AgentAddress[] getRolePlayers(java.lang.String communityName,
                                           java.lang.String groupName,
                                           java.lang.String roleName)
                                    throws madkit.kernel.CGRException
Throws:
madkit.kernel.CGRException

getExistingRoles

public final java.lang.String[] getExistingRoles(java.lang.String communityName,
                                                 java.lang.String groupName)

stopKernel

public void stopKernel()
Request a kernel stop. All agents are (hopefully) cleanly killed


displayln

public void displayln(java.lang.String s)
A generic display method adapting its output to the kernel environment (console, GUI, applet...)

Parameters:
s - string to be displayed, add a newline at the end of the string

display

public void display(java.lang.String s)
A generic display method adapting its output to the kernel environment (console, GUI, applet...)

Parameters:
s - string to be displayed

setOutputStream

public void setOutputStream(java.io.Writer o)
Reassigns the "standard" agent text output stream (used by println method).


getMemberRoles

@Deprecated
public java.util.Vector getMemberRoles(java.lang.String theGroup,
                                                  AgentAddress theAgent)
Deprecated. As of MadKit 3.0. replaced by getGroupRolesOf(AgentAddress, String, String)please use getGroupRolesOf instead


debugString

public static void debugString()

destroyGroup

public void destroyGroup(java.lang.String communityName,
                         java.lang.String groupName)


Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.